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

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

Issue 8483003: Callback API Change: Reimplement Bind(); support IgnoreResult, full currying, and use less types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address initial comments. Created 9 years, 1 month 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
OLDNEW
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 "content/browser/plugin_service.h" 5 #include "content/browser/plugin_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 PluginService::GetInstance()->OpenChannelToNpapiPlugin( 241 PluginService::GetInstance()->OpenChannelToNpapiPlugin(
242 0, 0, GURL(), GURL(), kNPAPITestPluginMimeType, client); 242 0, 0, GURL(), GURL(), kNPAPITestPluginMimeType, client);
243 } 243 }
244 244
245 IN_PROC_BROWSER_TEST_F( 245 IN_PROC_BROWSER_TEST_F(
246 PluginServiceTest, CancelBeforeSentOpenChannelToPluginProcessHost) { 246 PluginServiceTest, CancelBeforeSentOpenChannelToPluginProcessHost) {
247 ::testing::StrictMock<MockCanceledBeforeSentPluginProcessHostClient> 247 ::testing::StrictMock<MockCanceledBeforeSentPluginProcessHostClient>
248 mock_client(browser()->profile()->GetResourceContext()); 248 mock_client(browser()->profile()->GetResourceContext());
249 BrowserThread::PostTask( 249 BrowserThread::PostTask(
250 BrowserThread::IO, FROM_HERE, 250 BrowserThread::IO, FROM_HERE,
251 base::Bind(OpenChannel, &mock_client)); 251 base::Bind(&OpenChannel, &mock_client));
252 ui_test_utils::RunMessageLoop(); 252 ui_test_utils::RunMessageLoop();
253 EXPECT_TRUE(mock_client.get_resource_context_called()); 253 EXPECT_TRUE(mock_client.get_resource_context_called());
254 EXPECT_TRUE(mock_client.set_plugin_info_called()); 254 EXPECT_TRUE(mock_client.set_plugin_info_called());
255 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called()); 255 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called());
256 } 256 }
257 257
258 class MockCanceledAfterSentPluginProcessHostClient 258 class MockCanceledAfterSentPluginProcessHostClient
259 : public MockCanceledBeforeSentPluginProcessHostClient { 259 : public MockCanceledBeforeSentPluginProcessHostClient {
260 public: 260 public:
261 MockCanceledAfterSentPluginProcessHostClient( 261 MockCanceledAfterSentPluginProcessHostClient(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 DISALLOW_COPY_AND_ASSIGN(MockCanceledAfterSentPluginProcessHostClient); 293 DISALLOW_COPY_AND_ASSIGN(MockCanceledAfterSentPluginProcessHostClient);
294 }; 294 };
295 295
296 // Should not attempt to open a channel, since it should be canceled early on. 296 // Should not attempt to open a channel, since it should be canceled early on.
297 IN_PROC_BROWSER_TEST_F( 297 IN_PROC_BROWSER_TEST_F(
298 PluginServiceTest, CancelAfterSentOpenChannelToPluginProcessHost) { 298 PluginServiceTest, CancelAfterSentOpenChannelToPluginProcessHost) {
299 ::testing::StrictMock<MockCanceledAfterSentPluginProcessHostClient> 299 ::testing::StrictMock<MockCanceledAfterSentPluginProcessHostClient>
300 mock_client(browser()->profile()->GetResourceContext()); 300 mock_client(browser()->profile()->GetResourceContext());
301 BrowserThread::PostTask( 301 BrowserThread::PostTask(
302 BrowserThread::IO, FROM_HERE, 302 BrowserThread::IO, FROM_HERE,
303 base::Bind(OpenChannel, &mock_client)); 303 base::Bind(&OpenChannel, &mock_client));
304 ui_test_utils::RunMessageLoop(); 304 ui_test_utils::RunMessageLoop();
305 EXPECT_TRUE(mock_client.get_resource_context_called()); 305 EXPECT_TRUE(mock_client.get_resource_context_called());
306 EXPECT_TRUE(mock_client.set_plugin_info_called()); 306 EXPECT_TRUE(mock_client.set_plugin_info_called());
307 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called()); 307 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called());
308 EXPECT_TRUE(mock_client.on_sent_plugin_channel_request_called()); 308 EXPECT_TRUE(mock_client.on_sent_plugin_channel_request_called());
309 } 309 }
310 310
311 } // namespace 311 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698