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.
5 #include "ppapi/shared_impl/test_globals.h"
9 TestGlobals::TestGlobals()
10 : ppapi::PpapiGlobals(),
11 resource_tracker_(ResourceTracker::THREAD_SAFE
),
12 callback_tracker_(new CallbackTracker
) {}
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
) {}
19 TestGlobals::~TestGlobals() {}
21 ResourceTracker
* TestGlobals::GetResourceTracker() {
22 return &resource_tracker_
;
25 VarTracker
* TestGlobals::GetVarTracker() { return &var_tracker_
; }
27 CallbackTracker
* TestGlobals::GetCallbackTrackerForInstance(
28 PP_Instance instance
) {
29 return callback_tracker_
.get();
32 thunk::PPB_Instance_API
* TestGlobals::GetInstanceAPI(PP_Instance instance
) {
36 thunk::ResourceCreationAPI
* TestGlobals::GetResourceCreationAPI(
37 PP_Instance instance
) {
41 PP_Module
TestGlobals::GetModuleForInstance(PP_Instance instance
) { return 0; }
43 std::string
TestGlobals::GetCmdLine() { return std::string(); }
45 void TestGlobals::PreCacheFontForFlash(const void* /* logfontw */) {}
47 void TestGlobals::LogWithSource(PP_Instance instance
,
49 const std::string
& source
,
50 const std::string
& value
) {}
52 void TestGlobals::BroadcastLogWithSource(PP_Module module
,
54 const std::string
& source
,
55 const std::string
& value
) {}
57 MessageLoopShared
* TestGlobals::GetCurrentMessageLoop() { return NULL
; }
59 base::TaskRunner
* TestGlobals::GetFileTaskRunner() { return NULL
; }
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?