| OLD | NEW |
| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 BrowserThread::PostTaskAndReply( | 161 BrowserThread::PostTaskAndReply( |
| 162 BrowserThread::FILE, FROM_HERE, | 162 BrowserThread::FILE, FROM_HERE, |
| 163 base::Bind(&DoNothing), | 163 base::Bind(&DoNothing), |
| 164 base::Bind(&QuitUIMessageLoopFromIOThread)); | 164 base::Bind(&QuitUIMessageLoopFromIOThread)); |
| 165 } | 165 } |
| 166 | 166 |
| 167 // Should not attempt to open a channel, since it should be canceled early on. | 167 // Should not attempt to open a channel, since it should be canceled early on. |
| 168 IN_PROC_BROWSER_TEST_F(PluginServiceTest, CancelOpenChannelToPluginService) { | 168 IN_PROC_BROWSER_TEST_F(PluginServiceTest, CancelOpenChannelToPluginService) { |
| 169 ::testing::StrictMock<MockCanceledPluginServiceClient> mock_client( | 169 ::testing::StrictMock<MockCanceledPluginServiceClient> mock_client( |
| 170 browser()->profile()->GetResourceContext()); | 170 browser()->profile()->GetResourceContext()); |
| 171 BrowserThread::PostTask( | 171 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 172 BrowserThread::IO, FROM_HERE, | 172 base::Bind(OpenChannelAndThenCancel, &mock_client)); |
| 173 NewRunnableFunction(OpenChannelAndThenCancel, &mock_client)); | |
| 174 ui_test_utils::RunMessageLoop(); | 173 ui_test_utils::RunMessageLoop(); |
| 175 EXPECT_TRUE(mock_client.get_resource_context_called()); | 174 EXPECT_TRUE(mock_client.get_resource_context_called()); |
| 176 } | 175 } |
| 177 | 176 |
| 178 class MockCanceledBeforeSentPluginProcessHostClient | 177 class MockCanceledBeforeSentPluginProcessHostClient |
| 179 : public MockCanceledPluginServiceClient { | 178 : public MockCanceledPluginServiceClient { |
| 180 public: | 179 public: |
| 181 MockCanceledBeforeSentPluginProcessHostClient( | 180 MockCanceledBeforeSentPluginProcessHostClient( |
| 182 const content::ResourceContext& context) | 181 const content::ResourceContext& context) |
| 183 : MockCanceledPluginServiceClient(context), | 182 : MockCanceledPluginServiceClient(context), |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 BrowserThread::IO, FROM_HERE, | 301 BrowserThread::IO, FROM_HERE, |
| 303 base::Bind(OpenChannel, &mock_client)); | 302 base::Bind(OpenChannel, &mock_client)); |
| 304 ui_test_utils::RunMessageLoop(); | 303 ui_test_utils::RunMessageLoop(); |
| 305 EXPECT_TRUE(mock_client.get_resource_context_called()); | 304 EXPECT_TRUE(mock_client.get_resource_context_called()); |
| 306 EXPECT_TRUE(mock_client.set_plugin_info_called()); | 305 EXPECT_TRUE(mock_client.set_plugin_info_called()); |
| 307 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called()); | 306 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called()); |
| 308 EXPECT_TRUE(mock_client.on_sent_plugin_channel_request_called()); | 307 EXPECT_TRUE(mock_client.on_sent_plugin_channel_request_called()); |
| 309 } | 308 } |
| 310 | 309 |
| 311 } // namespace | 310 } // namespace |
| OLD | NEW |