blob: d0e2ea088c1d96385460db0aada7fdb67526e052 [file] [log] [blame]
[email protected]97f706c2011-07-11 20:32:531// 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]97f706c2011-07-11 20:32:537#include "ppapi/cpp/core.h"
8#include "ppapi/cpp/module.h"
[email protected]3c149c62011-11-11 23:22:529#include "ppapi/tests/test_utils.h"
[email protected]97f706c2011-07-11 20:32:5310#include "ppapi/tests/testing_instance.h"
11
[email protected]97f706c2011-07-11 20:32:5312REGISTER_TEST_CASE(Core);
13
14bool TestCore::Init() {
15 return true;
16}
17
[email protected]2622d6b2011-11-16 04:28:0218void TestCore::RunTests(const std::string& filter) {
19 RUN_TEST(Time, filter);
20 RUN_TEST(TimeTicks, filter);
[email protected]97f706c2011-07-11 20:32:5321}
22
23std::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
36std::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