| 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) | 7 #if defined(_MSC_VER) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #else | 9 #else |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 REGISTER_TEST_CASE(Core); | 29 REGISTER_TEST_CASE(Core); |
| 30 | 30 |
| 31 bool TestCore::Init() { | 31 bool TestCore::Init() { |
| 32 return true; | 32 return true; |
| 33 } | 33 } |
| 34 | 34 |
| 35 void TestCore::RunTest() { | 35 void TestCore::RunTests(const std::string& filter) { |
| 36 RUN_TEST(Time); | 36 RUN_TEST(Time, filter); |
| 37 RUN_TEST(TimeTicks); | 37 RUN_TEST(TimeTicks, filter); |
| 38 } | 38 } |
| 39 | 39 |
| 40 std::string TestCore::TestTime() { | 40 std::string TestCore::TestTime() { |
| 41 pp::Core* core = pp::Module::Get()->core(); | 41 pp::Core* core = pp::Module::Get()->core(); |
| 42 PP_Time time1 = core->GetTime(); | 42 PP_Time time1 = core->GetTime(); |
| 43 ASSERT_TRUE(time1 > 0); | 43 ASSERT_TRUE(time1 > 0); |
| 44 | 44 |
| 45 PlatformSleep(100); // 0.1 second | 45 PlatformSleep(100); // 0.1 second |
| 46 | 46 |
| 47 PP_Time time2 = core->GetTime(); | 47 PP_Time time2 = core->GetTime(); |
| 48 ASSERT_TRUE(time2 > time1); | 48 ASSERT_TRUE(time2 > time1); |
| 49 | 49 |
| 50 PASS(); | 50 PASS(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 std::string TestCore::TestTimeTicks() { | 53 std::string TestCore::TestTimeTicks() { |
| 54 pp::Core* core = pp::Module::Get()->core(); | 54 pp::Core* core = pp::Module::Get()->core(); |
| 55 PP_Time time1 = core->GetTimeTicks(); | 55 PP_Time time1 = core->GetTimeTicks(); |
| 56 ASSERT_TRUE(time1 > 0); | 56 ASSERT_TRUE(time1 > 0); |
| 57 | 57 |
| 58 PlatformSleep(100); // 0.1 second | 58 PlatformSleep(100); // 0.1 second |
| 59 | 59 |
| 60 PP_Time time2 = core->GetTimeTicks(); | 60 PP_Time time2 = core->GetTimeTicks(); |
| 61 ASSERT_TRUE(time2 > time1); | 61 ASSERT_TRUE(time2 > time1); |
| 62 | 62 |
| 63 PASS(); | 63 PASS(); |
| 64 } | 64 } |
| 65 | 65 |
| OLD | NEW |