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

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

Issue 10014013: Add a hang monitor for Pepper plugins (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppapi_proxy_test.h ('k') | no next file » | 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h"
8 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
9 #include "base/observer_list.h" 10 #include "base/observer_list.h"
10 #include "ipc/ipc_sync_channel.h" 11 #include "ipc/ipc_sync_channel.h"
11 #include "ppapi/c/pp_errors.h" 12 #include "ppapi/c/pp_errors.h"
12 #include "ppapi/c/private/ppb_proxy_private.h" 13 #include "ppapi/c/private/ppb_proxy_private.h"
13 #include "ppapi/proxy/ppapi_messages.h" 14 #include "ppapi/proxy/ppapi_messages.h"
14 15
15 namespace ppapi { 16 namespace ppapi {
16 namespace proxy { 17 namespace proxy {
17 18
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 void PluginProxyTest::SetUp() { 234 void PluginProxyTest::SetUp() {
234 SetUpHarness(); 235 SetUpHarness();
235 } 236 }
236 237
237 void PluginProxyTest::TearDown() { 238 void PluginProxyTest::TearDown() {
238 TearDownHarness(); 239 TearDownHarness();
239 } 240 }
240 241
241 // HostProxyTestHarness -------------------------------------------------------- 242 // HostProxyTestHarness --------------------------------------------------------
242 243
244 class HostProxyTestHarness::MockSyncMessageStatusReceiver
245 : public HostDispatcher::SyncMessageStatusReceiver {
246 public:
247 virtual void BeginBlockOnSyncMessage() OVERRIDE {}
248 virtual void EndBlockOnSyncMessage() OVERRIDE {}
249 };
250
243 HostProxyTestHarness::HostProxyTestHarness() 251 HostProxyTestHarness::HostProxyTestHarness()
244 : host_globals_(PpapiGlobals::ForTest()) { 252 : host_globals_(PpapiGlobals::ForTest()),
253 status_receiver_(new MockSyncMessageStatusReceiver) {
245 } 254 }
246 255
247 HostProxyTestHarness::~HostProxyTestHarness() { 256 HostProxyTestHarness::~HostProxyTestHarness() {
248 } 257 }
249 258
250 Dispatcher* HostProxyTestHarness::GetDispatcher() { 259 Dispatcher* HostProxyTestHarness::GetDispatcher() {
251 return host_dispatcher_.get(); 260 return host_dispatcher_.get();
252 } 261 }
253 262
254 void HostProxyTestHarness::SetUpHarness() { 263 void HostProxyTestHarness::SetUpHarness() {
255 // These must be first since the dispatcher set-up uses them. 264 // These must be first since the dispatcher set-up uses them.
256 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); 265 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals());
257 host_dispatcher_.reset(new HostDispatcher( 266 host_dispatcher_.reset(new HostDispatcher(
258 base::Process::Current().handle(), 267 base::Process::Current().handle(),
259 pp_module(), 268 pp_module(),
260 &MockGetInterface)); 269 &MockGetInterface,
270 status_receiver_.get()));
261 host_dispatcher_->InitWithTestSink(&sink()); 271 host_dispatcher_->InitWithTestSink(&sink());
262 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); 272 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get());
263 } 273 }
264 274
265 void HostProxyTestHarness::SetUpHarnessWithChannel( 275 void HostProxyTestHarness::SetUpHarnessWithChannel(
266 const IPC::ChannelHandle& channel_handle, 276 const IPC::ChannelHandle& channel_handle,
267 base::MessageLoopProxy* ipc_message_loop, 277 base::MessageLoopProxy* ipc_message_loop,
268 base::WaitableEvent* shutdown_event, 278 base::WaitableEvent* shutdown_event,
269 bool is_client) { 279 bool is_client) {
270 // These must be first since the dispatcher set-up uses them. 280 // These must be first since the dispatcher set-up uses them.
271 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals()); 281 PpapiGlobals::SetPpapiGlobalsOnThreadForTest(GetGlobals());
272 delegate_mock_.Init(ipc_message_loop, shutdown_event); 282 delegate_mock_.Init(ipc_message_loop, shutdown_event);
273 283
274 host_dispatcher_.reset(new HostDispatcher( 284 host_dispatcher_.reset(new HostDispatcher(
275 base::Process::Current().handle(), 285 base::Process::Current().handle(),
276 pp_module(), 286 pp_module(),
277 &MockGetInterface)); 287 &MockGetInterface,
288 status_receiver_.get()));
278 ppapi::Preferences preferences; 289 ppapi::Preferences preferences;
279 host_dispatcher_->InitHostWithChannel(&delegate_mock_, channel_handle, 290 host_dispatcher_->InitHostWithChannel(&delegate_mock_, channel_handle,
280 is_client, preferences); 291 is_client, preferences);
281 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get()); 292 HostDispatcher::SetForInstance(pp_instance(), host_dispatcher_.get());
282 } 293 }
283 294
284 void HostProxyTestHarness::TearDownHarness() { 295 void HostProxyTestHarness::TearDownHarness() {
285 HostDispatcher::RemoveForInstance(pp_instance()); 296 HostDispatcher::RemoveForInstance(pp_instance());
286 host_dispatcher_.reset(); 297 host_dispatcher_.reset();
287 } 298 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 remote_harness_torn_down.Wait(); 380 remote_harness_torn_down.Wait();
370 381
371 local_harness_->TearDownHarness(); 382 local_harness_->TearDownHarness();
372 383
373 io_thread_.Stop(); 384 io_thread_.Stop();
374 } 385 }
375 386
376 387
377 } // namespace proxy 388 } // namespace proxy
378 } // namespace ppapi 389 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppapi_proxy_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698