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 #include "ppapi/cpp/core.h" | 7 #include "ppapi/cpp/core.h" |
8 #include "ppapi/cpp/module.h" | 8 #include "ppapi/cpp/module.h" |
9 #include "ppapi/tests/test_utils.h" | 9 #include "ppapi/tests/test_utils.h" |
10 #include "ppapi/tests/testing_instance.h" | 10 #include "ppapi/tests/testing_instance.h" |
11 | 11 |
12 REGISTER_TEST_CASE(Core); | 12 REGISTER_TEST_CASE(Core); |
13 | 13 |
14 bool TestCore::Init() { | 14 bool TestCore::Init() { |
15 return true; | 15 return true; |
16 } | 16 } |
17 | 17 |
18 void TestCore::RunTest() { | 18 void TestCore::RunTests(const std::string& filter) { |
19 RUN_TEST(Time); | 19 RUN_TEST(Time, filter); |
20 RUN_TEST(TimeTicks); | 20 RUN_TEST(TimeTicks, filter); |
21 } | 21 } |
22 | 22 |
23 std::string TestCore::TestTime() { | 23 std::string TestCore::TestTime() { |
24 pp::Core* core = pp::Module::Get()->core(); | 24 pp::Core* core = pp::Module::Get()->core(); |
25 PP_Time time1 = core->GetTime(); | 25 PP_Time time1 = core->GetTime(); |
26 ASSERT_TRUE(time1 > 0); | 26 ASSERT_TRUE(time1 > 0); |
27 | 27 |
28 PlatformSleep(100); // 0.1 second | 28 PlatformSleep(100); // 0.1 second |
29 | 29 |
30 PP_Time time2 = core->GetTime(); | 30 PP_Time time2 = core->GetTime(); |
31 ASSERT_TRUE(time2 > time1); | 31 ASSERT_TRUE(time2 > time1); |
32 | 32 |
33 PASS(); | 33 PASS(); |
34 } | 34 } |
35 | 35 |
36 std::string TestCore::TestTimeTicks() { | 36 std::string TestCore::TestTimeTicks() { |
37 pp::Core* core = pp::Module::Get()->core(); | 37 pp::Core* core = pp::Module::Get()->core(); |
38 PP_Time time1 = core->GetTimeTicks(); | 38 PP_Time time1 = core->GetTimeTicks(); |
39 ASSERT_TRUE(time1 > 0); | 39 ASSERT_TRUE(time1 > 0); |
40 | 40 |
41 PlatformSleep(100); // 0.1 second | 41 PlatformSleep(100); // 0.1 second |
42 | 42 |
43 PP_Time time2 = core->GetTimeTicks(); | 43 PP_Time time2 = core->GetTimeTicks(); |
44 ASSERT_TRUE(time2 > time1); | 44 ASSERT_TRUE(time2 > time1); |
45 | 45 |
46 PASS(); | 46 PASS(); |
47 } | 47 } |
48 | 48 |
OLD | NEW |