Home | History | Annotate | Download | only in tests
      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 
      7 #include "ppapi/cpp/core.h"
      8 #include "ppapi/cpp/module.h"
      9 #include "ppapi/tests/test_utils.h"
     10 #include "ppapi/tests/testing_instance.h"
     11 
     12 REGISTER_TEST_CASE(Core);
     13 
     14 bool TestCore::Init() {
     15   return true;
     16 }
     17 
     18 void TestCore::RunTests(const std::string& filter) {
     19   RUN_TEST(Time, filter);
     20   RUN_TEST(TimeTicks, filter);
     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 
     49