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
TestGlobals()9 TestGlobals::TestGlobals()
10 : ppapi::PpapiGlobals(),
11 resource_tracker_(ResourceTracker::THREAD_SAFE),
12 callback_tracker_(new CallbackTracker) {}
13
TestGlobals(PpapiGlobals::PerThreadForTest per_thread_for_test)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
~TestGlobals()19 TestGlobals::~TestGlobals() {}
20
GetResourceTracker()21 ResourceTracker* TestGlobals::GetResourceTracker() {
22 return &resource_tracker_;
23 }
24
GetVarTracker()25 VarTracker* TestGlobals::GetVarTracker() { return &var_tracker_; }
26
GetCallbackTrackerForInstance(PP_Instance instance)27 CallbackTracker* TestGlobals::GetCallbackTrackerForInstance(
28 PP_Instance instance) {
29 return callback_tracker_.get();
30 }
31
GetInstanceAPI(PP_Instance instance)32 thunk::PPB_Instance_API* TestGlobals::GetInstanceAPI(PP_Instance instance) {
33 return NULL;
34 }
35
GetResourceCreationAPI(PP_Instance instance)36 thunk::ResourceCreationAPI* TestGlobals::GetResourceCreationAPI(
37 PP_Instance instance) {
38 return NULL;
39 }
40
GetModuleForInstance(PP_Instance instance)41 PP_Module TestGlobals::GetModuleForInstance(PP_Instance instance) { return 0; }
42
GetCmdLine()43 std::string TestGlobals::GetCmdLine() { return std::string(); }
44
PreCacheFontForFlash(const void *)45 void TestGlobals::PreCacheFontForFlash(const void* /* logfontw */) {}
46
LogWithSource(PP_Instance instance,PP_LogLevel level,const std::string & source,const std::string & value)47 void TestGlobals::LogWithSource(PP_Instance instance,
48 PP_LogLevel level,
49 const std::string& source,
50 const std::string& value) {}
51
BroadcastLogWithSource(PP_Module module,PP_LogLevel level,const std::string & source,const std::string & value)52 void TestGlobals::BroadcastLogWithSource(PP_Module module,
53 PP_LogLevel level,
54 const std::string& source,
55 const std::string& value) {}
56
GetCurrentMessageLoop()57 MessageLoopShared* TestGlobals::GetCurrentMessageLoop() { return NULL; }
58
GetFileTaskRunner()59 base::TaskRunner* TestGlobals::GetFileTaskRunner() { return NULL; }
60
IsHostGlobals() const61 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