Home | History | Annotate | Download | only in shared_impl
      1 // Copyright (c) 2012 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/shared_impl/test_globals.h"
      6 
      7 namespace ppapi {
      8 
      9 TestGlobals::TestGlobals()
     10     : ppapi::PpapiGlobals(),
     11       resource_tracker_(ResourceTracker::THREAD_SAFE),
     12       callback_tracker_(new CallbackTracker) {
     13 }
     14 
     15 TestGlobals::TestGlobals(PpapiGlobals::PerThreadForTest per_thread_for_test)
     16     : ppapi::PpapiGlobals(per_thread_for_test),
     17       resource_tracker_(ResourceTracker::THREAD_SAFE),
     18       callback_tracker_(new CallbackTracker) {
     19 }
     20 
     21 TestGlobals::~TestGlobals() {
     22 }
     23 
     24 ResourceTracker* TestGlobals::GetResourceTracker() {
     25   return &resource_tracker_;
     26 }
     27 
     28 VarTracker* TestGlobals::GetVarTracker() {
     29   return &var_tracker_;
     30 }
     31 
     32 CallbackTracker* TestGlobals::GetCallbackTrackerForInstance(
     33     PP_Instance instance) {
     34   return callback_tracker_.get();
     35 }
     36 
     37 thunk::PPB_Instance_API* TestGlobals::GetInstanceAPI(
     38     PP_Instance instance) {
     39   return NULL;
     40 }
     41 
     42 thunk::ResourceCreationAPI* TestGlobals::GetResourceCreationAPI(
     43     PP_Instance instance) {
     44   return NULL;
     45 }
     46 
     47 PP_Module TestGlobals::GetModuleForInstance(PP_Instance instance) {
     48   return 0;
     49 }
     50 
     51 std::string TestGlobals::GetCmdLine() {
     52   return std::string();
     53 }
     54 
     55 void TestGlobals::PreCacheFontForFlash(const void* /* logfontw */) {
     56 }
     57 
     58 void TestGlobals::LogWithSource(PP_Instance instance,
     59                                 PP_LogLevel level,
     60                                 const std::string& source,
     61                                 const std::string& value) {
     62 }
     63 
     64 void TestGlobals::BroadcastLogWithSource(PP_Module module,
     65                                          PP_LogLevel level,
     66                                          const std::string& source,
     67                                          const std::string& value) {
     68 }
     69 
     70 MessageLoopShared* TestGlobals::GetCurrentMessageLoop() {
     71   return NULL;
     72 }
     73 
     74 base::TaskRunner* TestGlobals::GetFileTaskRunner() {
     75   return NULL;
     76 }
     77 
     78 bool TestGlobals::IsHostGlobals() const {
     79   // Pretend to be the host-side, for code that expects one or the other.
     80   // TODO(dmichael): just make it settable which one we're pretending to be?
     81   return true;
     82 }
     83 
     84 }  // namespace ppapi
     85