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