| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/tests/test_core.h" | 5 #include "ppapi/tests/test_core.h" |
| 6 | 6 |
| 7 #if defined(_MSC_VER) | |
| 8 #include <windows.h> | |
| 9 #else | |
| 10 #include <unistd.h> | |
| 11 #endif | |
| 12 | |
| 13 #include "ppapi/cpp/core.h" | 7 #include "ppapi/cpp/core.h" |
| 14 #include "ppapi/cpp/module.h" | 8 #include "ppapi/cpp/module.h" |
| 9 #include "ppapi/tests/test_utils.h" |
| 15 #include "ppapi/tests/testing_instance.h" | 10 #include "ppapi/tests/testing_instance.h" |
| 16 | 11 |
| 17 namespace { | |
| 18 | |
| 19 void PlatformSleep(int duration_ms) { | |
| 20 #if defined(_MSC_VER) | |
| 21 ::Sleep(duration_ms); | |
| 22 #else | |
| 23 usleep(duration_ms * 1000); | |
| 24 #endif | |
| 25 } | |
| 26 | |
| 27 } // namespace | |
| 28 | |
| 29 REGISTER_TEST_CASE(Core); | 12 REGISTER_TEST_CASE(Core); |
| 30 | 13 |
| 31 bool TestCore::Init() { | 14 bool TestCore::Init() { |
| 32 return true; | 15 return true; |
| 33 } | 16 } |
| 34 | 17 |
| 35 void TestCore::RunTest() { | 18 void TestCore::RunTest() { |
| 36 RUN_TEST(Time); | 19 RUN_TEST(Time); |
| 37 RUN_TEST(TimeTicks); | 20 RUN_TEST(TimeTicks); |
| 38 } | 21 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 56 ASSERT_TRUE(time1 > 0); | 39 ASSERT_TRUE(time1 > 0); |
| 57 | 40 |
| 58 PlatformSleep(100); // 0.1 second | 41 PlatformSleep(100); // 0.1 second |
| 59 | 42 |
| 60 PP_Time time2 = core->GetTimeTicks(); | 43 PP_Time time2 = core->GetTimeTicks(); |
| 61 ASSERT_TRUE(time2 > time1); | 44 ASSERT_TRUE(time2 > time1); |
| 62 | 45 |
| 63 PASS(); | 46 PASS(); |
| 64 } | 47 } |
| 65 | 48 |
| OLD | NEW |