OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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/proxy/ppapi_proxy_test.h" |
| 6 |
| 7 #include "ppapi/c/pp_errors.h" |
| 8 |
| 9 namespace pp { |
| 10 namespace proxy { |
| 11 |
| 12 namespace { |
| 13 |
| 14 const void* MockGetInterface(const char*) { |
| 15 return NULL; |
| 16 } |
| 17 |
| 18 int32_t MockInitModule(PP_Module, Dispatcher::GetInterfaceFunc) { |
| 19 return PP_OK; |
| 20 } |
| 21 |
| 22 void MockShutdownModuleFunc() { |
| 23 } |
| 24 |
| 25 } // namespace |
| 26 |
| 27 PluginProxyTest::PluginProxyTest() { |
| 28 } |
| 29 |
| 30 PluginProxyTest::~PluginProxyTest() { |
| 31 } |
| 32 |
| 33 void PluginProxyTest::SetUp() { |
| 34 // These must be first since the dispatcher set-up uses them. |
| 35 PluginResourceTracker::SetInstanceForTest(&resource_tracker_); |
| 36 PluginVarTracker::SetInstanceForTest(&var_tracker_); |
| 37 |
| 38 pp_instance_ = 0x1234; |
| 39 plugin_dispatcher_.reset(new PluginDispatcher( |
| 40 base::Process::Current().handle(), |
| 41 &MockGetInterface, |
| 42 &MockInitModule, |
| 43 &MockShutdownModuleFunc)); |
| 44 plugin_dispatcher_->InitWithTestSink(&sink_); |
| 45 // When the plugin dispatcher is per-instance, this is the line to use: |
| 46 // PluginDispatcher::SetForInstance(pp_instance_, plugin_dispatcher_.get()); |
| 47 PluginDispatcher::SetGlobal(plugin_dispatcher_.get()); |
| 48 } |
| 49 |
| 50 void PluginProxyTest::TearDown() { |
| 51 PluginDispatcher::SetGlobal(NULL); |
| 52 plugin_dispatcher_.reset(); |
| 53 |
| 54 PluginVarTracker::SetInstanceForTest(NULL); |
| 55 PluginResourceTracker::SetInstanceForTest(NULL); |
| 56 } |
| 57 |
| 58 } // namespace proxy |
| 59 } // namespace pp |
OLD | NEW |