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 <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
14 #include "base/run_loop.h" | |
14 #include "ipc/ipc_sync_channel.h" | 15 #include "ipc/ipc_sync_channel.h" |
15 #include "ppapi/c/pp_errors.h" | 16 #include "ppapi/c/pp_errors.h" |
16 #include "ppapi/c/private/ppb_proxy_private.h" | 17 #include "ppapi/c/private/ppb_proxy_private.h" |
17 #include "ppapi/proxy/ppapi_messages.h" | 18 #include "ppapi/proxy/ppapi_messages.h" |
19 #include "ppapi/proxy/ppb_message_loop_proxy.h" | |
20 #include "ppapi/shared_impl/proxy_lock.h" | |
18 | 21 |
19 namespace ppapi { | 22 namespace ppapi { |
20 namespace proxy { | 23 namespace proxy { |
21 | 24 |
22 namespace { | 25 namespace { |
23 // HostDispatcher requires a PPB_Proxy_Private, so we always provide a fallback | 26 // HostDispatcher requires a PPB_Proxy_Private, so we always provide a fallback |
24 // do-nothing implementation. | 27 // do-nothing implementation. |
25 void PluginCrashed(PP_Module module) { | 28 void PluginCrashed(PP_Module module) { |
26 NOTREACHED(); | 29 NOTREACHED(); |
27 }; | 30 }; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 TupleTypes<PpapiMsg_SupportsInterface::ReplyParam>::ValueTuple reply_data; | 145 TupleTypes<PpapiMsg_SupportsInterface::ReplyParam>::ValueTuple reply_data; |
143 EXPECT_TRUE(PpapiMsg_SupportsInterface::ReadReplyParam( | 146 EXPECT_TRUE(PpapiMsg_SupportsInterface::ReadReplyParam( |
144 reply_msg, &reply_data)); | 147 reply_msg, &reply_data)); |
145 | 148 |
146 sink().ClearMessages(); | 149 sink().ClearMessages(); |
147 return reply_data.a; | 150 return reply_data.a; |
148 } | 151 } |
149 | 152 |
150 // PluginProxyTestHarness ------------------------------------------------------ | 153 // PluginProxyTestHarness ------------------------------------------------------ |
151 | 154 |
152 PluginProxyTestHarness::PluginProxyTestHarness() { | 155 PluginProxyTestHarness::PluginProxyTestHarness(bool per_thread_globals) |
156 : per_thread_globals_(per_thread_globals) { | |
153 } | 157 } |
154 | 158 |
155 PluginProxyTestHarness::~PluginProxyTestHarness() { | 159 PluginProxyTestHarness::~PluginProxyTestHarness() { |
156 } | 160 } |
157 | 161 |
158 PpapiGlobals* PluginProxyTestHarness::GetGlobals() { | 162 PpapiGlobals* PluginProxyTestHarness::GetGlobals() { |
159 return plugin_globals_.get(); | 163 return plugin_globals_.get(); |
160 } | 164 } |
161 | 165 |
162 Dispatcher* PluginProxyTestHarness::GetDispatcher() { | 166 Dispatcher* PluginProxyTestHarness::GetDispatcher() { |
163 return plugin_dispatcher_.get(); | 167 return plugin_dispatcher_.get(); |
164 } | 168 } |
165 | 169 |
166 void PluginProxyTestHarness::SetUpHarness() { | 170 void PluginProxyTestHarness::SetUpHarness() { |
167 plugin_globals_.reset(new PluginGlobals(PpapiGlobals::ForTest())); | 171 // These must be first since the dispatcher set-up uses them. |
172 CreatePluginGlobals(); | |
168 | 173 |
169 // These must be first since the dispatcher set-up uses them. | |
170 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); | |
171 resource_tracker().DidCreateInstance(pp_instance()); | 174 resource_tracker().DidCreateInstance(pp_instance()); |
172 | 175 |
173 plugin_dispatcher_.reset(new PluginDispatcher( | 176 plugin_dispatcher_.reset(new PluginDispatcher( |
174 &MockGetInterface, | 177 &MockGetInterface, |
175 PpapiPermissions(), | 178 PpapiPermissions(), |
176 false)); | 179 false)); |
177 plugin_dispatcher_->InitWithTestSink(&sink()); | 180 plugin_dispatcher_->InitWithTestSink(&sink()); |
178 // The plugin proxy delegate is needed for | 181 // The plugin proxy delegate is needed for |
179 // |PluginProxyDelegate::GetBrowserSender| which is used | 182 // |PluginProxyDelegate::GetBrowserSender| which is used |
180 // in |ResourceCreationProxy::GetConnection| to get the channel to the | 183 // in |ResourceCreationProxy::GetConnection| to get the channel to the |
181 // browser. In this case we just use the |plugin_dispatcher_| as the channel | 184 // browser. In this case we just use the |plugin_dispatcher_| as the channel |
182 // for test purposes. | 185 // for test purposes. |
183 plugin_delegate_mock_.set_browser_sender(plugin_dispatcher_.get()); | 186 plugin_delegate_mock_.set_browser_sender(plugin_dispatcher_.get()); |
184 PluginGlobals::Get()->set_plugin_proxy_delegate(&plugin_delegate_mock_); | 187 PluginGlobals::Get()->set_plugin_proxy_delegate(&plugin_delegate_mock_); |
185 plugin_dispatcher_->DidCreateInstance(pp_instance()); | 188 plugin_dispatcher_->DidCreateInstance(pp_instance()); |
186 } | 189 } |
187 | 190 |
188 void PluginProxyTestHarness::SetUpHarnessWithChannel( | 191 void PluginProxyTestHarness::SetUpHarnessWithChannel( |
189 const IPC::ChannelHandle& channel_handle, | 192 const IPC::ChannelHandle& channel_handle, |
190 base::MessageLoopProxy* ipc_message_loop, | 193 base::MessageLoopProxy* ipc_message_loop, |
191 base::WaitableEvent* shutdown_event, | 194 base::WaitableEvent* shutdown_event, |
192 bool is_client) { | 195 bool is_client) { |
193 plugin_globals_.reset(new PluginGlobals(PpapiGlobals::ForTest())); | 196 // These must be first since the dispatcher set-up uses them. |
197 CreatePluginGlobals(); | |
194 | 198 |
195 // These must be first since the dispatcher set-up uses them. | |
196 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); | |
197 resource_tracker().DidCreateInstance(pp_instance()); | 199 resource_tracker().DidCreateInstance(pp_instance()); |
198 plugin_delegate_mock_.Init(ipc_message_loop, shutdown_event); | 200 plugin_delegate_mock_.Init(ipc_message_loop, shutdown_event); |
199 | 201 |
200 plugin_dispatcher_.reset(new PluginDispatcher( | 202 plugin_dispatcher_.reset(new PluginDispatcher( |
201 &MockGetInterface, | 203 &MockGetInterface, |
202 PpapiPermissions(), | 204 PpapiPermissions(), |
203 false)); | 205 false)); |
204 plugin_dispatcher_->InitPluginWithChannel(&plugin_delegate_mock_, | 206 plugin_dispatcher_->InitPluginWithChannel(&plugin_delegate_mock_, |
205 base::kNullProcessId, | 207 base::kNullProcessId, |
206 channel_handle, | 208 channel_handle, |
207 is_client); | 209 is_client); |
208 plugin_delegate_mock_.set_browser_sender(plugin_dispatcher_.get()); | 210 plugin_delegate_mock_.set_browser_sender(plugin_dispatcher_.get()); |
209 PluginGlobals::Get()->set_plugin_proxy_delegate(&plugin_delegate_mock_); | 211 PluginGlobals::Get()->set_plugin_proxy_delegate(&plugin_delegate_mock_); |
210 plugin_dispatcher_->DidCreateInstance(pp_instance()); | 212 plugin_dispatcher_->DidCreateInstance(pp_instance()); |
211 } | 213 } |
212 | 214 |
213 void PluginProxyTestHarness::TearDownHarness() { | 215 void PluginProxyTestHarness::TearDownHarness() { |
214 plugin_dispatcher_->DidDestroyInstance(pp_instance()); | 216 plugin_dispatcher_->DidDestroyInstance(pp_instance()); |
215 plugin_dispatcher_.reset(); | 217 plugin_dispatcher_.reset(); |
216 | 218 |
217 resource_tracker().DidDeleteInstance(pp_instance()); | 219 resource_tracker().DidDeleteInstance(pp_instance()); |
218 plugin_globals_.reset(); | 220 plugin_globals_.reset(); |
219 } | 221 } |
220 | 222 |
223 void PluginProxyTestHarness::CreatePluginGlobals() { | |
224 if (per_thread_globals_) { | |
225 plugin_globals_.reset(new PluginGlobals(PpapiGlobals::ForPerThreadTest())); | |
226 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); | |
227 } else { | |
228 plugin_globals_.reset(new PluginGlobals()); | |
229 } | |
230 } | |
231 | |
221 base::MessageLoopProxy* | 232 base::MessageLoopProxy* |
222 PluginProxyTestHarness::PluginDelegateMock::GetIPCMessageLoop() { | 233 PluginProxyTestHarness::PluginDelegateMock::GetIPCMessageLoop() { |
223 return ipc_message_loop_; | 234 return ipc_message_loop_; |
224 } | 235 } |
225 | 236 |
226 base::WaitableEvent* | 237 base::WaitableEvent* |
227 PluginProxyTestHarness::PluginDelegateMock::GetShutdownEvent() { | 238 PluginProxyTestHarness::PluginDelegateMock::GetShutdownEvent() { |
228 return shutdown_event_; | 239 return shutdown_event_; |
229 } | 240 } |
230 | 241 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 void PluginProxyTestHarness::PluginDelegateMock::PreCacheFont( | 274 void PluginProxyTestHarness::PluginDelegateMock::PreCacheFont( |
264 const void* logfontw) { | 275 const void* logfontw) { |
265 } | 276 } |
266 | 277 |
267 void PluginProxyTestHarness::PluginDelegateMock::SetActiveURL( | 278 void PluginProxyTestHarness::PluginDelegateMock::SetActiveURL( |
268 const std::string& url) { | 279 const std::string& url) { |
269 } | 280 } |
270 | 281 |
271 // PluginProxyTest ------------------------------------------------------------- | 282 // PluginProxyTest ------------------------------------------------------------- |
272 | 283 |
273 PluginProxyTest::PluginProxyTest() { | 284 PluginProxyTest::PluginProxyTest() : PluginProxyTestHarness(false) { |
274 } | 285 } |
275 | 286 |
276 PluginProxyTest::~PluginProxyTest() { | 287 PluginProxyTest::~PluginProxyTest() { |
277 } | 288 } |
278 | 289 |
279 void PluginProxyTest::SetUp() { | 290 void PluginProxyTest::SetUp() { |
280 SetUpHarness(); | 291 SetUpHarness(); |
281 } | 292 } |
282 | 293 |
283 void PluginProxyTest::TearDown() { | 294 void PluginProxyTest::TearDown() { |
284 TearDownHarness(); | 295 TearDownHarness(); |
285 } | 296 } |
286 | 297 |
298 // PluginProxyMultiThreadTest -------------------------------------------------- | |
299 | |
300 PluginProxyMultiThreadTest::PluginProxyMultiThreadTest() { | |
301 } | |
302 | |
303 PluginProxyMultiThreadTest::~PluginProxyMultiThreadTest() { | |
304 } | |
305 | |
306 void PluginProxyMultiThreadTest::RunTest() { | |
307 main_thread_message_loop_proxy_ = | |
308 PpapiGlobals::Get()->GetMainThreadMessageLoop(); | |
309 ASSERT_EQ(main_thread_message_loop_proxy_.get(), | |
310 base::MessageLoopProxy::current()); | |
311 nested_main_thread_message_loop_.reset(new base::RunLoop()); | |
312 | |
313 secondary_thread_.reset(new base::DelegateSimpleThread( | |
314 this, "PluginProxyMultiThreadTest")); | |
315 | |
316 { | |
317 ProxyAutoLock auto_lock; | |
318 | |
319 // MessageLoopResource assumes that the proxy lock has been acquired. | |
320 secondary_thread_message_loop_ = new MessageLoopResource(pp_instance()); | |
321 | |
322 // TODO(yzshen): The comment of PPB_MessageLoop says that it would return | |
323 // PP_OK_COMPLETIONPENDING. Either fix the comment or the implementation. | |
dmichael (off chromium)
2013/01/15 22:43:52
I would lean towards PP_OK and just updating the d
yzshen1
2013/01/16 18:55:59
That sounds good. I will make that a separate CL.
| |
324 ASSERT_EQ(PP_OK, | |
325 secondary_thread_message_loop_->PostWork( | |
326 PP_MakeCompletionCallback( | |
327 &PluginProxyMultiThreadTest::InternalSetUpTestOnSecondaryThread, | |
328 this), | |
329 0)); | |
330 } | |
331 | |
332 SetUpTestOnMainThread(); | |
333 | |
334 secondary_thread_->Start(); | |
335 nested_main_thread_message_loop_->Run(); | |
336 secondary_thread_->Join(); | |
337 | |
338 { | |
339 ProxyAutoLock auto_lock; | |
340 | |
341 // The destruction requires a valid PpapiGlobals instance, so we should | |
342 // explicitly release it. | |
343 secondary_thread_message_loop_ = NULL; | |
344 } | |
345 | |
346 secondary_thread_.reset(NULL); | |
347 nested_main_thread_message_loop_.reset(NULL); | |
348 main_thread_message_loop_proxy_ = NULL; | |
349 } | |
350 | |
351 void PluginProxyMultiThreadTest::CheckOnValidThread(bool main_thread) { | |
352 ProxyAutoLock auto_lock; | |
353 if (main_thread) { | |
354 ASSERT_TRUE(MessageLoopResource::GetCurrent()->is_main_thread_loop()); | |
355 } else { | |
356 ASSERT_EQ(secondary_thread_message_loop_.get(), | |
357 MessageLoopResource::GetCurrent()); | |
358 } | |
359 } | |
360 | |
361 void PluginProxyMultiThreadTest::PostQuitForMainThread() { | |
362 main_thread_message_loop_proxy_->PostTask( | |
363 FROM_HERE, | |
364 base::Bind(&PluginProxyMultiThreadTest::QuitNestedLoop, | |
365 base::Unretained(this))); | |
366 } | |
367 | |
368 void PluginProxyMultiThreadTest::PostQuitForSecondaryThread() { | |
369 ProxyAutoLock auto_lock; | |
370 secondary_thread_message_loop_->PostQuit(PP_TRUE); | |
371 } | |
372 | |
373 void PluginProxyMultiThreadTest::Run() { | |
374 ProxyAutoLock auto_lock; | |
375 ASSERT_EQ(PP_OK, secondary_thread_message_loop_->AttachToCurrentThread()); | |
376 ASSERT_EQ(PP_OK, secondary_thread_message_loop_->Run()); | |
377 } | |
378 | |
379 void PluginProxyMultiThreadTest::QuitNestedLoop() { | |
380 nested_main_thread_message_loop_->Quit(); | |
381 } | |
382 | |
383 // static | |
384 void PluginProxyMultiThreadTest::InternalSetUpTestOnSecondaryThread( | |
385 void* user_data, | |
386 int32_t result) { | |
387 EXPECT_EQ(PP_OK, result); | |
388 PluginProxyMultiThreadTest* thiz = | |
389 static_cast<PluginProxyMultiThreadTest*>(user_data); | |
390 thiz->CheckOnValidThread(false); | |
391 thiz->SetUpTestOnSecondaryThread(); | |
392 } | |
393 | |
287 // HostProxyTestHarness -------------------------------------------------------- | 394 // HostProxyTestHarness -------------------------------------------------------- |
288 | 395 |
289 class HostProxyTestHarness::MockSyncMessageStatusReceiver | 396 class HostProxyTestHarness::MockSyncMessageStatusReceiver |
290 : public HostDispatcher::SyncMessageStatusReceiver { | 397 : public HostDispatcher::SyncMessageStatusReceiver { |
291 public: | 398 public: |
292 virtual void BeginBlockOnSyncMessage() OVERRIDE {} | 399 virtual void BeginBlockOnSyncMessage() OVERRIDE {} |
293 virtual void EndBlockOnSyncMessage() OVERRIDE {} | 400 virtual void EndBlockOnSyncMessage() OVERRIDE {} |
294 }; | 401 }; |
295 | 402 |
296 HostProxyTestHarness::HostProxyTestHarness() | 403 HostProxyTestHarness::HostProxyTestHarness(bool per_thread_globals) |
297 : status_receiver_(new MockSyncMessageStatusReceiver) { | 404 : per_thread_globals_(per_thread_globals), |
405 status_receiver_(new MockSyncMessageStatusReceiver) { | |
298 } | 406 } |
299 | 407 |
300 HostProxyTestHarness::~HostProxyTestHarness() { | 408 HostProxyTestHarness::~HostProxyTestHarness() { |
301 } | 409 } |
302 | 410 |
303 PpapiGlobals* HostProxyTestHarness::GetGlobals() { | 411 PpapiGlobals* HostProxyTestHarness::GetGlobals() { |
304 return host_globals_.get(); | 412 return host_globals_.get(); |
305 } | 413 } |
306 | 414 |
307 Dispatcher* HostProxyTestHarness::GetDispatcher() { | 415 Dispatcher* HostProxyTestHarness::GetDispatcher() { |
308 return host_dispatcher_.get(); | 416 return host_dispatcher_.get(); |
309 } | 417 } |
310 | 418 |
311 void HostProxyTestHarness::SetUpHarness() { | 419 void HostProxyTestHarness::SetUpHarness() { |
312 host_globals_.reset(new ppapi::TestGlobals(PpapiGlobals::ForTest())); | 420 // These must be first since the dispatcher set-up uses them. |
421 CreateHostGlobals(); | |
313 | 422 |
314 // These must be first since the dispatcher set-up uses them. | |
315 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); | |
316 host_dispatcher_.reset(new HostDispatcher( | 423 host_dispatcher_.reset(new HostDispatcher( |
317 pp_module(), | 424 pp_module(), |
318 &MockGetInterface, | 425 &MockGetInterface, |
319 status_receiver_.release(), | 426 status_receiver_.release(), |
320 PpapiPermissions::AllPermissions())); | 427 PpapiPermissions::AllPermissions())); |
321 host_dispatcher_->InitWithTestSink(&sink()); | 428 host_dispatcher_->InitWithTestSink(&sink()); |
322 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); | 429 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); |
323 } | 430 } |
324 | 431 |
325 void HostProxyTestHarness::SetUpHarnessWithChannel( | 432 void HostProxyTestHarness::SetUpHarnessWithChannel( |
326 const IPC::ChannelHandle& channel_handle, | 433 const IPC::ChannelHandle& channel_handle, |
327 base::MessageLoopProxy* ipc_message_loop, | 434 base::MessageLoopProxy* ipc_message_loop, |
328 base::WaitableEvent* shutdown_event, | 435 base::WaitableEvent* shutdown_event, |
329 bool is_client) { | 436 bool is_client) { |
330 host_globals_.reset(new ppapi::TestGlobals(PpapiGlobals::ForTest())); | 437 // These must be first since the dispatcher set-up uses them. |
438 CreateHostGlobals(); | |
331 | 439 |
332 // These must be first since the dispatcher set-up uses them. | |
333 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); | |
334 delegate_mock_.Init(ipc_message_loop, shutdown_event); | 440 delegate_mock_.Init(ipc_message_loop, shutdown_event); |
335 | 441 |
336 host_dispatcher_.reset(new HostDispatcher( | 442 host_dispatcher_.reset(new HostDispatcher( |
337 pp_module(), | 443 pp_module(), |
338 &MockGetInterface, | 444 &MockGetInterface, |
339 status_receiver_.release(), | 445 status_receiver_.release(), |
340 PpapiPermissions::AllPermissions())); | 446 PpapiPermissions::AllPermissions())); |
341 ppapi::Preferences preferences; | 447 ppapi::Preferences preferences; |
342 host_dispatcher_->InitHostWithChannel(&delegate_mock_, | 448 host_dispatcher_->InitHostWithChannel(&delegate_mock_, |
343 base::kNullProcessId, channel_handle, | 449 base::kNullProcessId, channel_handle, |
344 is_client, preferences); | 450 is_client, preferences); |
345 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); | 451 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); |
346 } | 452 } |
347 | 453 |
348 void HostProxyTestHarness::TearDownHarness() { | 454 void HostProxyTestHarness::TearDownHarness() { |
349 HostDispatcher::RemoveForInstance(pp_instance()); | 455 HostDispatcher::RemoveForInstance(pp_instance()); |
350 host_dispatcher_.reset(); | 456 host_dispatcher_.reset(); |
351 host_globals_.reset(); | 457 host_globals_.reset(); |
352 } | 458 } |
353 | 459 |
460 void HostProxyTestHarness::CreateHostGlobals() { | |
461 if (per_thread_globals_) { | |
462 host_globals_.reset(new TestGlobals(PpapiGlobals::ForPerThreadTest())); | |
463 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); | |
464 } else { | |
465 host_globals_.reset(new TestGlobals()); | |
466 } | |
467 } | |
468 | |
354 base::MessageLoopProxy* | 469 base::MessageLoopProxy* |
355 HostProxyTestHarness::DelegateMock::GetIPCMessageLoop() { | 470 HostProxyTestHarness::DelegateMock::GetIPCMessageLoop() { |
356 return ipc_message_loop_; | 471 return ipc_message_loop_; |
357 } | 472 } |
358 | 473 |
359 base::WaitableEvent* HostProxyTestHarness::DelegateMock::GetShutdownEvent() { | 474 base::WaitableEvent* HostProxyTestHarness::DelegateMock::GetShutdownEvent() { |
360 return shutdown_event_; | 475 return shutdown_event_; |
361 } | 476 } |
362 | 477 |
363 IPC::PlatformFileForTransit | 478 IPC::PlatformFileForTransit |
364 HostProxyTestHarness::DelegateMock::ShareHandleWithRemote( | 479 HostProxyTestHarness::DelegateMock::ShareHandleWithRemote( |
365 base::PlatformFile handle, | 480 base::PlatformFile handle, |
366 base::ProcessId /* remote_pid */, | 481 base::ProcessId /* remote_pid */, |
367 bool should_close_source) { | 482 bool should_close_source) { |
368 return IPC::GetFileHandleForProcess(handle, | 483 return IPC::GetFileHandleForProcess(handle, |
369 base::Process::Current().handle(), | 484 base::Process::Current().handle(), |
370 should_close_source); | 485 should_close_source); |
371 } | 486 } |
372 | 487 |
373 | 488 |
374 // HostProxyTest --------------------------------------------------------------- | 489 // HostProxyTest --------------------------------------------------------------- |
375 | 490 |
376 HostProxyTest::HostProxyTest() { | 491 HostProxyTest::HostProxyTest() : HostProxyTestHarness(false) { |
377 } | 492 } |
378 | 493 |
379 HostProxyTest::~HostProxyTest() { | 494 HostProxyTest::~HostProxyTest() { |
380 } | 495 } |
381 | 496 |
382 void HostProxyTest::SetUp() { | 497 void HostProxyTest::SetUp() { |
383 SetUpHarness(); | 498 SetUpHarness(); |
384 } | 499 } |
385 | 500 |
386 void HostProxyTest::TearDown() { | 501 void HostProxyTest::TearDown() { |
387 TearDownHarness(); | 502 TearDownHarness(); |
388 } | 503 } |
389 | 504 |
390 // TwoWayTest --------------------------------------------------------------- | 505 // TwoWayTest --------------------------------------------------------------- |
391 | 506 |
392 TwoWayTest::TwoWayTest(TwoWayTest::TwoWayTestMode test_mode) | 507 TwoWayTest::TwoWayTest(TwoWayTest::TwoWayTestMode test_mode) |
393 : test_mode_(test_mode), | 508 : test_mode_(test_mode), |
509 host_(true), | |
510 plugin_(true), | |
394 io_thread_("TwoWayTest_IOThread"), | 511 io_thread_("TwoWayTest_IOThread"), |
395 plugin_thread_("TwoWayTest_PluginThread"), | 512 plugin_thread_("TwoWayTest_PluginThread"), |
396 remote_harness_(NULL), | 513 remote_harness_(NULL), |
397 local_harness_(NULL), | 514 local_harness_(NULL), |
398 channel_created_(true, false), | 515 channel_created_(true, false), |
399 shutdown_event_(true, false) { | 516 shutdown_event_(true, false) { |
400 if (test_mode == TEST_PPP_INTERFACE) { | 517 if (test_mode == TEST_PPP_INTERFACE) { |
401 remote_harness_ = &plugin_; | 518 remote_harness_ = &plugin_; |
402 local_harness_ = &host_; | 519 local_harness_ = &host_; |
403 } else { | 520 } else { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
456 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE, | 573 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE, |
457 base::Bind(&RunTaskOnRemoteHarness, | 574 base::Bind(&RunTaskOnRemoteHarness, |
458 task, | 575 task, |
459 &task_complete)); | 576 &task_complete)); |
460 task_complete.Wait(); | 577 task_complete.Wait(); |
461 } | 578 } |
462 | 579 |
463 | 580 |
464 } // namespace proxy | 581 } // namespace proxy |
465 } // namespace ppapi | 582 } // namespace ppapi |
OLD | NEW |