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

Side by Side Diff: content/browser/plugin_service_impl_browsertest.cc

Issue 10662005: Use IPC::Sender and IPC::Listener in content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | « content/browser/plugin_process_host.h ('k') | content/browser/ppapi_plugin_process_host.h » ('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 "content/browser/plugin_service_impl.h" 5 #include "content/browser/plugin_service_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 16 matching lines...) Expand all
27 void OpenChannel(PluginProcessHost::Client* client) { 27 void OpenChannel(PluginProcessHost::Client* client) {
28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
29 // Start opening the channel 29 // Start opening the channel
30 PluginServiceImpl::GetInstance()->OpenChannelToNpapiPlugin( 30 PluginServiceImpl::GetInstance()->OpenChannelToNpapiPlugin(
31 0, 0, GURL(), GURL(), kNPAPITestPluginMimeType, client); 31 0, 0, GURL(), GURL(), kNPAPITestPluginMimeType, client);
32 } 32 }
33 33
34 // Mock up of the Client and the Listener classes that would supply the 34 // Mock up of the Client and the Listener classes that would supply the
35 // communication channel with the plugin. 35 // communication channel with the plugin.
36 class MockPluginProcessHostClient : public PluginProcessHost::Client, 36 class MockPluginProcessHostClient : public PluginProcessHost::Client,
37 public IPC::Channel::Listener { 37 public IPC::Listener {
38 public: 38 public:
39 MockPluginProcessHostClient(content::ResourceContext* context) 39 MockPluginProcessHostClient(content::ResourceContext* context)
40 : context_(context), 40 : context_(context),
41 channel_(NULL), 41 channel_(NULL),
42 set_plugin_info_called_(false) { 42 set_plugin_info_called_(false) {
43 } 43 }
44 44
45 virtual ~MockPluginProcessHostClient() { 45 virtual ~MockPluginProcessHostClient() {
46 if (channel_) 46 if (channel_)
47 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, channel_); 47 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, channel_);
(...skipping 19 matching lines...) Expand all
67 virtual void SetPluginInfo(const webkit::WebPluginInfo& info) OVERRIDE { 67 virtual void SetPluginInfo(const webkit::WebPluginInfo& info) OVERRIDE {
68 ASSERT_TRUE(info.mime_types.size()); 68 ASSERT_TRUE(info.mime_types.size());
69 ASSERT_EQ(kNPAPITestPluginMimeType, info.mime_types[0].mime_type); 69 ASSERT_EQ(kNPAPITestPluginMimeType, info.mime_types[0].mime_type);
70 set_plugin_info_called_ = true; 70 set_plugin_info_called_ = true;
71 } 71 }
72 72
73 virtual void OnError() OVERRIDE { 73 virtual void OnError() OVERRIDE {
74 Fail(); 74 Fail();
75 } 75 }
76 76
77 // IPC::Channel::Listener implementation. 77 // IPC::Listener implementation.
78 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { 78 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
79 Fail(); 79 Fail();
80 return false; 80 return false;
81 } 81 }
82 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE { 82 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE {
83 QuitMessageLoop(); 83 QuitMessageLoop();
84 } 84 }
85 virtual void OnChannelError() OVERRIDE { 85 virtual void OnChannelError() OVERRIDE {
86 Fail(); 86 Fail();
87 } 87 }
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 BrowserThread::IO, FROM_HERE, 326 BrowserThread::IO, FROM_HERE,
327 base::Bind(&OpenChannel, &mock_client)); 327 base::Bind(&OpenChannel, &mock_client));
328 ui_test_utils::RunMessageLoop(); 328 ui_test_utils::RunMessageLoop();
329 EXPECT_TRUE(mock_client.get_resource_context_called()); 329 EXPECT_TRUE(mock_client.get_resource_context_called());
330 EXPECT_TRUE(mock_client.set_plugin_info_called()); 330 EXPECT_TRUE(mock_client.set_plugin_info_called());
331 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called()); 331 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called());
332 EXPECT_TRUE(mock_client.on_sent_plugin_channel_request_called()); 332 EXPECT_TRUE(mock_client.on_sent_plugin_channel_request_called());
333 } 333 }
334 334
335 } // namespace 335 } // namespace
OLDNEW
« no previous file with comments | « content/browser/plugin_process_host.h ('k') | content/browser/ppapi_plugin_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698