| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "ipc/ipc_sync_channel.h" | 10 #include "ipc/ipc_sync_channel.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 plugin_dispatcher_->InitWithTestSink(&sink()); | 159 plugin_dispatcher_->InitWithTestSink(&sink()); |
| 160 plugin_dispatcher_->DidCreateInstance(pp_instance()); | 160 plugin_dispatcher_->DidCreateInstance(pp_instance()); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void PluginProxyTestHarness::SetUpHarnessWithChannel( | 163 void PluginProxyTestHarness::SetUpHarnessWithChannel( |
| 164 const IPC::ChannelHandle& channel_handle, | 164 const IPC::ChannelHandle& channel_handle, |
| 165 base::MessageLoopProxy* ipc_message_loop, | 165 base::MessageLoopProxy* ipc_message_loop, |
| 166 base::WaitableEvent* shutdown_event, | 166 base::WaitableEvent* shutdown_event, |
| 167 bool is_client) { | 167 bool is_client) { |
| 168 // These must be first since the dispatcher set-up uses them. | 168 // These must be first since the dispatcher set-up uses them. |
| 169 PpapiGlobals::SetPpapiGlobalsForTest(GetGlobals()); |
| 169 resource_tracker().DidCreateInstance(pp_instance()); | 170 resource_tracker().DidCreateInstance(pp_instance()); |
| 170 plugin_delegate_mock_.Init(ipc_message_loop, shutdown_event); | 171 plugin_delegate_mock_.Init(ipc_message_loop, shutdown_event); |
| 171 | 172 |
| 172 plugin_dispatcher_.reset(new PluginDispatcher( | 173 plugin_dispatcher_.reset(new PluginDispatcher( |
| 173 base::Process::Current().handle(), | 174 base::Process::Current().handle(), |
| 174 &MockGetInterface)); | 175 &MockGetInterface)); |
| 175 plugin_dispatcher_->InitPluginWithChannel(&plugin_delegate_mock_, | 176 plugin_dispatcher_->InitPluginWithChannel(&plugin_delegate_mock_, |
| 176 channel_handle, | 177 channel_handle, |
| 177 is_client); | 178 is_client); |
| 178 plugin_dispatcher_->DidCreateInstance(pp_instance()); | 179 plugin_dispatcher_->DidCreateInstance(pp_instance()); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 &MockGetInterface)); | 266 &MockGetInterface)); |
| 266 host_dispatcher_->InitWithTestSink(&sink()); | 267 host_dispatcher_->InitWithTestSink(&sink()); |
| 267 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); | 268 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); |
| 268 } | 269 } |
| 269 | 270 |
| 270 void HostProxyTestHarness::SetUpHarnessWithChannel( | 271 void HostProxyTestHarness::SetUpHarnessWithChannel( |
| 271 const IPC::ChannelHandle& channel_handle, | 272 const IPC::ChannelHandle& channel_handle, |
| 272 base::MessageLoopProxy* ipc_message_loop, | 273 base::MessageLoopProxy* ipc_message_loop, |
| 273 base::WaitableEvent* shutdown_event, | 274 base::WaitableEvent* shutdown_event, |
| 274 bool is_client) { | 275 bool is_client) { |
| 276 // These must be first since the dispatcher set-up uses them. |
| 277 PpapiGlobals::SetPpapiGlobalsForTest(GetGlobals()); |
| 275 delegate_mock_.Init(ipc_message_loop, shutdown_event); | 278 delegate_mock_.Init(ipc_message_loop, shutdown_event); |
| 279 |
| 276 host_dispatcher_.reset(new HostDispatcher( | 280 host_dispatcher_.reset(new HostDispatcher( |
| 277 base::Process::Current().handle(), | 281 base::Process::Current().handle(), |
| 278 pp_module(), | 282 pp_module(), |
| 279 &MockGetInterface)); | 283 &MockGetInterface)); |
| 280 ppapi::Preferences preferences; | 284 ppapi::Preferences preferences; |
| 281 host_dispatcher_->InitHostWithChannel(&delegate_mock_, channel_handle, | 285 host_dispatcher_->InitHostWithChannel(&delegate_mock_, channel_handle, |
| 282 is_client, preferences); | 286 is_client, preferences); |
| 283 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); | 287 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); |
| 284 } | 288 } |
| 285 | 289 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 } | 342 } |
| 339 | 343 |
| 340 void TwoWayTest::SetUp() { | 344 void TwoWayTest::SetUp() { |
| 341 base::Thread::Options options; | 345 base::Thread::Options options; |
| 342 options.message_loop_type = MessageLoop::TYPE_IO; | 346 options.message_loop_type = MessageLoop::TYPE_IO; |
| 343 io_thread_.StartWithOptions(options); | 347 io_thread_.StartWithOptions(options); |
| 344 plugin_thread_.Start(); | 348 plugin_thread_.Start(); |
| 345 | 349 |
| 346 IPC::ChannelHandle handle; | 350 IPC::ChannelHandle handle; |
| 347 handle.name = "TwoWayTestChannel"; | 351 handle.name = "TwoWayTestChannel"; |
| 348 | |
| 349 base::WaitableEvent remote_harness_set_up(true, false); | 352 base::WaitableEvent remote_harness_set_up(true, false); |
| 350 plugin_thread_.message_loop_proxy()->PostTask( | 353 plugin_thread_.message_loop_proxy()->PostTask( |
| 351 FROM_HERE, | 354 FROM_HERE, |
| 352 base::Bind(&SetUpRemoteHarness, | 355 base::Bind(&SetUpRemoteHarness, |
| 353 remote_harness_, | 356 remote_harness_, |
| 354 handle, | 357 handle, |
| 355 io_thread_.message_loop_proxy(), | 358 io_thread_.message_loop_proxy(), |
| 356 &shutdown_event_, | 359 &shutdown_event_, |
| 357 &remote_harness_set_up)); | 360 &remote_harness_set_up)); |
| 358 remote_harness_set_up.Wait(); | 361 remote_harness_set_up.Wait(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 372 remote_harness_torn_down.Wait(); | 375 remote_harness_torn_down.Wait(); |
| 373 | 376 |
| 374 local_harness_->TearDownHarness(); | 377 local_harness_->TearDownHarness(); |
| 375 | 378 |
| 376 io_thread_.Stop(); | 379 io_thread_.Stop(); |
| 377 } | 380 } |
| 378 | 381 |
| 379 | 382 |
| 380 } // namespace proxy | 383 } // namespace proxy |
| 381 } // namespace ppapi | 384 } // namespace ppapi |
| OLD | NEW |