From f7189d0156f542131ba619dc2493aa64c4f070d5 Mon Sep 17 00:00:00 2001 From: "pinkerton@google.com" Date: Wed, 13 Aug 2008 22:55:45 +0000 Subject: Turn on most tests for posix. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@839 0039d316-1c4b-4281-b951-d872f2087c98 --- base/time_unittest.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/base/time_unittest.cc b/base/time_unittest.cc index 214ec50..ca99da8 100644 --- a/base/time_unittest.cc +++ b/base/time_unittest.cc @@ -27,10 +27,14 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include #include +#if defined(OS_WIN) +#include +#endif + #include "base/time.h" +#include "base/platform_thread.h" #include "testing/gtest/include/gtest/gtest.h" // Test conversions to/from time_t and exploding/unexploding. @@ -38,7 +42,11 @@ TEST(Time, TimeT) { // C library time and exploded time. time_t now_t_1 = time(NULL); struct tm tms; +#if defined(OS_WIN) localtime_s(&tms, &now_t_1); +#elif defined(OS_POSIX) + localtime_r(&now_t_1, &tms); +#endif // Convert to ours. Time our_time_1 = Time::FromTimeT(now_t_1); @@ -93,7 +101,7 @@ TEST(Time, UTCExplode) { TEST(TimeTicks, Deltas) { TimeTicks ticks_start = TimeTicks::Now(); - Sleep(10); + PlatformThread::Sleep(10); TimeTicks ticks_stop = TimeTicks::Now(); TimeDelta delta = ticks_stop - ticks_start; EXPECT_GE(delta.InMilliseconds(), 10); @@ -101,6 +109,10 @@ TEST(TimeTicks, Deltas) { EXPECT_EQ(delta.InSeconds(), 0); } +#if defined(OS_WIN) + +// TODO(pinkerton): Need to find a way to mock this for non-windows. + namespace { class MockTimeTicks : public TimeTicks { @@ -193,3 +205,5 @@ TEST(TimeTicks, Rollover) { MockTimeTicks::UninstallTicker(); } } + +#endif -- cgit v1.1