| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/proxy/ppapi_proxy_test.h" | 5 #include "ppapi/proxy/ppapi_proxy_test.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 Dispatcher* HostProxyTestHarness::GetDispatcher() { | 273 Dispatcher* HostProxyTestHarness::GetDispatcher() { |
| 274 return host_dispatcher_.get(); | 274 return host_dispatcher_.get(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void HostProxyTestHarness::SetUpHarness() { | 277 void HostProxyTestHarness::SetUpHarness() { |
| 278 // These must be first since the dispatcher set-up uses them. | 278 // These must be first since the dispatcher set-up uses them. |
| 279 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); | 279 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); |
| 280 host_dispatcher_.reset(new HostDispatcher( | 280 host_dispatcher_.reset(new HostDispatcher( |
| 281 pp_module(), | 281 pp_module(), |
| 282 &MockGetInterface, | 282 &MockGetInterface, |
| 283 status_receiver_.get())); | 283 status_receiver_.release())); |
| 284 host_dispatcher_->InitWithTestSink(&sink()); | 284 host_dispatcher_->InitWithTestSink(&sink()); |
| 285 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); | 285 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); |
| 286 } | 286 } |
| 287 | 287 |
| 288 void HostProxyTestHarness::SetUpHarnessWithChannel( | 288 void HostProxyTestHarness::SetUpHarnessWithChannel( |
| 289 const IPC::ChannelHandle& channel_handle, | 289 const IPC::ChannelHandle& channel_handle, |
| 290 base::MessageLoopProxy* ipc_message_loop, | 290 base::MessageLoopProxy* ipc_message_loop, |
| 291 base::WaitableEvent* shutdown_event, | 291 base::WaitableEvent* shutdown_event, |
| 292 bool is_client) { | 292 bool is_client) { |
| 293 // These must be first since the dispatcher set-up uses them. | 293 // These must be first since the dispatcher set-up uses them. |
| 294 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); | 294 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); |
| 295 delegate_mock_.Init(ipc_message_loop, shutdown_event); | 295 delegate_mock_.Init(ipc_message_loop, shutdown_event); |
| 296 | 296 |
| 297 host_dispatcher_.reset(new HostDispatcher( | 297 host_dispatcher_.reset(new HostDispatcher( |
| 298 pp_module(), | 298 pp_module(), |
| 299 &MockGetInterface, | 299 &MockGetInterface, |
| 300 status_receiver_.get())); | 300 status_receiver_.release())); |
| 301 ppapi::Preferences preferences; | 301 ppapi::Preferences preferences; |
| 302 host_dispatcher_->InitHostWithChannel(&delegate_mock_, channel_handle, | 302 host_dispatcher_->InitHostWithChannel(&delegate_mock_, channel_handle, |
| 303 is_client, preferences); | 303 is_client, preferences); |
| 304 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); | 304 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); |
| 305 } | 305 } |
| 306 | 306 |
| 307 void HostProxyTestHarness::TearDownHarness() { | 307 void HostProxyTestHarness::TearDownHarness() { |
| 308 HostDispatcher::RemoveForInstance(pp_instance()); | 308 HostDispatcher::RemoveForInstance(pp_instance()); |
| 309 host_dispatcher_.reset(); | 309 host_dispatcher_.reset(); |
| 310 } | 310 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 remote_harness_torn_down.Wait(); | 402 remote_harness_torn_down.Wait(); |
| 403 | 403 |
| 404 local_harness_->TearDownHarness(); | 404 local_harness_->TearDownHarness(); |
| 405 | 405 |
| 406 io_thread_.Stop(); | 406 io_thread_.Stop(); |
| 407 } | 407 } |
| 408 | 408 |
| 409 | 409 |
| 410 } // namespace proxy | 410 } // namespace proxy |
| 411 } // namespace ppapi | 411 } // namespace ppapi |
| OLD | NEW |