[email protected] | 97f706c | 2011-07-11 20:32:53 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "ppapi/tests/test_core.h" | ||||
6 | |||||
[email protected] | 97f706c | 2011-07-11 20:32:53 | [diff] [blame] | 7 | #include "ppapi/cpp/core.h" |
8 | #include "ppapi/cpp/module.h" | ||||
[email protected] | 3c149c6 | 2011-11-11 23:22:52 | [diff] [blame] | 9 | #include "ppapi/tests/test_utils.h" |
[email protected] | 97f706c | 2011-07-11 20:32:53 | [diff] [blame] | 10 | #include "ppapi/tests/testing_instance.h" |
11 | |||||
[email protected] | 97f706c | 2011-07-11 20:32:53 | [diff] [blame] | 12 | REGISTER_TEST_CASE(Core); |
13 | |||||
14 | bool TestCore::Init() { | ||||
15 | return true; | ||||
16 | } | ||||
17 | |||||
[email protected] | 2622d6b | 2011-11-16 04:28:02 | [diff] [blame] | 18 | void TestCore::RunTests(const std::string& filter) { |
19 | RUN_TEST(Time, filter); | ||||
20 | RUN_TEST(TimeTicks, filter); | ||||
[email protected] | 97f706c | 2011-07-11 20:32:53 | [diff] [blame] | 21 | } |
22 | |||||
23 | std::string TestCore::TestTime() { | ||||
24 | pp::Core* core = pp::Module::Get()->core(); | ||||
25 | PP_Time time1 = core->GetTime(); | ||||
26 | ASSERT_TRUE(time1 > 0); | ||||
27 | |||||
28 | PlatformSleep(100); // 0.1 second | ||||
29 | |||||
30 | PP_Time time2 = core->GetTime(); | ||||
31 | ASSERT_TRUE(time2 > time1); | ||||
32 | |||||
33 | PASS(); | ||||
34 | } | ||||
35 | |||||
36 | std::string TestCore::TestTimeTicks() { | ||||
37 | pp::Core* core = pp::Module::Get()->core(); | ||||
38 | PP_Time time1 = core->GetTimeTicks(); | ||||
39 | ASSERT_TRUE(time1 > 0); | ||||
40 | |||||
41 | PlatformSleep(100); // 0.1 second | ||||
42 | |||||
43 | PP_Time time2 = core->GetTimeTicks(); | ||||
44 | ASSERT_TRUE(time2 > time1); | ||||
45 | |||||
46 | PASS(); | ||||
47 | } | ||||
48 |