Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1873)

Side by Side Diff: ppapi/proxy/ppapi_proxy_test.cc

Issue 589213003: PPAPI: Never re-enter JavaScript for PostMessage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make MessageChannel observer clean up more reliably, guarantee HungPluginFilter stays alive long en… Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ppapi/proxy/ppapi_proxy_test.h ('k') | ppapi/tests/test_message_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/message_loop/message_loop_proxy.h" 11 #include "base/message_loop/message_loop_proxy.h"
12 #include "base/observer_list.h" 12 #include "base/observer_list.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "ipc/ipc_sync_channel.h" 14 #include "ipc/ipc_sync_channel.h"
15 #include "ipc/message_filter.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"
18 #include "ppapi/proxy/ppb_message_loop_proxy.h" 19 #include "ppapi/proxy/ppb_message_loop_proxy.h"
19 #include "ppapi/shared_impl/proxy_lock.h" 20 #include "ppapi/shared_impl/proxy_lock.h"
20 21
21 namespace ppapi { 22 namespace ppapi {
22 namespace proxy { 23 namespace proxy {
23 24
24 namespace { 25 namespace {
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 int32_t result) { 401 int32_t result) {
401 EXPECT_EQ(PP_OK, result); 402 EXPECT_EQ(PP_OK, result);
402 PluginProxyMultiThreadTest* thiz = 403 PluginProxyMultiThreadTest* thiz =
403 static_cast<PluginProxyMultiThreadTest*>(user_data); 404 static_cast<PluginProxyMultiThreadTest*>(user_data);
404 thiz->CheckOnThread(SECONDARY_THREAD); 405 thiz->CheckOnThread(SECONDARY_THREAD);
405 thiz->SetUpTestOnSecondaryThread(); 406 thiz->SetUpTestOnSecondaryThread();
406 } 407 }
407 408
408 // HostProxyTestHarness -------------------------------------------------------- 409 // HostProxyTestHarness --------------------------------------------------------
409 410
410 class HostProxyTestHarness::MockSyncMessageStatusReceiver
411 : public HostDispatcher::SyncMessageStatusReceiver {
412 public:
413 virtual void BeginBlockOnSyncMessage() OVERRIDE {}
414 virtual void EndBlockOnSyncMessage() OVERRIDE {}
415 };
416
417 HostProxyTestHarness::HostProxyTestHarness(GlobalsConfiguration globals_config) 411 HostProxyTestHarness::HostProxyTestHarness(GlobalsConfiguration globals_config)
418 : globals_config_(globals_config), 412 : globals_config_(globals_config) {
419 status_receiver_(new MockSyncMessageStatusReceiver) {
420 } 413 }
421 414
422 HostProxyTestHarness::~HostProxyTestHarness() { 415 HostProxyTestHarness::~HostProxyTestHarness() {
423 } 416 }
424 417
425 PpapiGlobals* HostProxyTestHarness::GetGlobals() { 418 PpapiGlobals* HostProxyTestHarness::GetGlobals() {
426 return host_globals_.get(); 419 return host_globals_.get();
427 } 420 }
428 421
429 Dispatcher* HostProxyTestHarness::GetDispatcher() { 422 Dispatcher* HostProxyTestHarness::GetDispatcher() {
430 return host_dispatcher_.get(); 423 return host_dispatcher_.get();
431 } 424 }
432 425
433 void HostProxyTestHarness::SetUpHarness() { 426 void HostProxyTestHarness::SetUpHarness() {
434 // These must be first since the dispatcher set-up uses them. 427 // These must be first since the dispatcher set-up uses them.
435 CreateHostGlobals(); 428 CreateHostGlobals();
436 429
437 host_dispatcher_.reset(new HostDispatcher( 430 host_dispatcher_.reset(new HostDispatcher(
438 pp_module(), 431 pp_module(),
439 &MockGetInterface, 432 &MockGetInterface,
440 status_receiver_.release(),
441 PpapiPermissions::AllPermissions())); 433 PpapiPermissions::AllPermissions()));
442 host_dispatcher_->InitWithTestSink(&sink()); 434 host_dispatcher_->InitWithTestSink(&sink());
443 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); 435 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get());
444 } 436 }
445 437
446 void HostProxyTestHarness::SetUpHarnessWithChannel( 438 void HostProxyTestHarness::SetUpHarnessWithChannel(
447 const IPC::ChannelHandle& channel_handle, 439 const IPC::ChannelHandle& channel_handle,
448 base::MessageLoopProxy* ipc_message_loop, 440 base::MessageLoopProxy* ipc_message_loop,
449 base::WaitableEvent* shutdown_event, 441 base::WaitableEvent* shutdown_event,
450 bool is_client) { 442 bool is_client) {
451 // These must be first since the dispatcher set-up uses them. 443 // These must be first since the dispatcher set-up uses them.
452 CreateHostGlobals(); 444 CreateHostGlobals();
453 445
454 delegate_mock_.Init(ipc_message_loop, shutdown_event); 446 delegate_mock_.Init(ipc_message_loop, shutdown_event);
455 447
456 host_dispatcher_.reset(new HostDispatcher( 448 host_dispatcher_.reset(new HostDispatcher(
457 pp_module(), 449 pp_module(),
458 &MockGetInterface, 450 &MockGetInterface,
459 status_receiver_.release(),
460 PpapiPermissions::AllPermissions())); 451 PpapiPermissions::AllPermissions()));
461 ppapi::Preferences preferences; 452 ppapi::Preferences preferences;
462 host_dispatcher_->InitHostWithChannel(&delegate_mock_, 453 host_dispatcher_->InitHostWithChannel(&delegate_mock_,
463 base::kNullProcessId, channel_handle, 454 base::kNullProcessId, channel_handle,
464 is_client, preferences); 455 is_client, preferences);
465 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); 456 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get());
466 } 457 }
467 458
468 void HostProxyTestHarness::TearDownHarness() { 459 void HostProxyTestHarness::TearDownHarness() {
469 HostDispatcher::RemoveForInstance(pp_instance()); 460 HostDispatcher::RemoveForInstance(pp_instance());
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE, 581 plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE,
591 base::Bind(&RunTaskOnRemoteHarness, 582 base::Bind(&RunTaskOnRemoteHarness,
592 task, 583 task,
593 &task_complete)); 584 &task_complete));
594 task_complete.Wait(); 585 task_complete.Wait();
595 } 586 }
596 587
597 588
598 } // namespace proxy 589 } // namespace proxy
599 } // namespace ppapi 590 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppapi_proxy_test.h ('k') | ppapi/tests/test_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698