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 TestGlobals::TestGlobals(PpapiGlobals::PerThreadForTest per_thread_for_test)
     15     : ppapi::PpapiGlobals(per_thread_for_test),
     16       resource_tracker_(ResourceTracker::THREAD_SAFE),
     17       callback_tracker_(new CallbackTracker) {}
     18 
     19 TestGlobals::~TestGlobals() {}
     20 
     21 ResourceTracker* TestGlobals::GetResourceTracker() {
     22   return &resource_tracker_;
     23 }
     24 
     25 VarTracker* TestGlobals::GetVarTracker() { return &var_tracker_; }
     26 
     27 CallbackTracker* TestGlobals::GetCallbackTrackerForInstance(
     28     PP_Instance instance) {
     29   return callback_tracker_.get();
     30 }
     31 
     32 thunk::PPB_Instance_API* TestGlobals::GetInstanceAPI(PP_Instance instance) {
     33   return NULL;
     34 }
     35 
     36 thunk::ResourceCreationAPI* TestGlobals::GetResourceCreationAPI(
     37     PP_Instance instance) {
     38   return NULL;
     39 }
     40 
     41 PP_Module TestGlobals::GetModuleForInstance(PP_Instance instance) { return 0; }
     42 
     43 std::string TestGlobals::GetCmdLine() { return std::string(); }
     44 
     45 void TestGlobals::PreCacheFontForFlash(const void* /* logfontw */) {}
     46 
     47 void TestGlobals::LogWithSource(PP_Instance instance,
     48                                 PP_LogLevel level,
     49                                 const std::string& source,
     50                                 const std::string& value) {}
     51 
     52 void TestGlobals::BroadcastLogWithSource(PP_Module module,
     53                                          PP_LogLevel level,
     54                                          const std::string& source,
     55                                          const std::string& value) {}
     56 
     57 MessageLoopShared* TestGlobals::GetCurrentMessageLoop() { return NULL; }
     58 
     59 base::TaskRunner* TestGlobals::GetFileTaskRunner() { return NULL; }
     60 
     61 bool TestGlobals::IsHostGlobals() const {
     62   // Pretend to be the host-side, for code that expects one or the other.
     63   // TODO(dmichael): just make it settable which one we're pretending to be?
     64   return true;
     65 }
     66 
     67 }  // namespace ppapi
     68