diff options
author | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-13 22:55:45 +0000 |
---|---|---|
committer | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-13 22:55:45 +0000 |
commit | f7189d0156f542131ba619dc2493aa64c4f070d5 (patch) | |
tree | 7e0edc4bb307185324c60411adcce245c9e1136d /base/time_unittest.cc | |
parent | 077bf89f7c5934cd90ccdb21f3d96bda665ba182 (diff) | |
download | chromium_src-f7189d0156f542131ba619dc2493aa64c4f070d5.zip chromium_src-f7189d0156f542131ba619dc2493aa64c4f070d5.tar.gz chromium_src-f7189d0156f542131ba619dc2493aa64c4f070d5.tar.bz2 |
Turn on most tests for posix.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@839 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/time_unittest.cc')
-rw-r--r-- | base/time_unittest.cc | 18 |
1 files 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 <process.h> #include <time.h> +#if defined(OS_WIN) +#include <process.h> +#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 |