| OLD | NEW |
| 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/location.h" | |
| 11 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 12 #include "base/single_thread_task_runner.h" | |
| 13 #include "base/thread_task_runner_handle.h" | |
| 14 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
| 15 #include "content/public/browser/plugin_service_filter.h" | 12 #include "content/public/browser/plugin_service_filter.h" |
| 16 #include "content/public/browser/resource_context.h" | 13 #include "content/public/browser/resource_context.h" |
| 17 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 18 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
| 19 #include "content/public/test/content_browser_test.h" | 16 #include "content/public/test/content_browser_test.h" |
| 20 #include "content/public/test/test_browser_thread.h" | 17 #include "content/public/test/test_browser_thread.h" |
| 21 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
| 22 #include "content/shell/browser/shell.h" | 19 #include "content/shell/browser/shell.h" |
| 23 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 ASSERT_TRUE(info.mime_types.size()); | 254 ASSERT_TRUE(info.mime_types.size()); |
| 258 ASSERT_EQ(kNPAPITestPluginMimeType, info.mime_types[0].mime_type); | 255 ASSERT_EQ(kNPAPITestPluginMimeType, info.mime_types[0].mime_type); |
| 259 set_plugin_info_called_ = true; | 256 set_plugin_info_called_ = true; |
| 260 } | 257 } |
| 261 void OnFoundPluginProcessHost(PluginProcessHost* host) override { | 258 void OnFoundPluginProcessHost(PluginProcessHost* host) override { |
| 262 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 259 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 263 set_on_found_plugin_process_host_called(); | 260 set_on_found_plugin_process_host_called(); |
| 264 set_host(host); | 261 set_host(host); |
| 265 // This gets called right before we request the plugin<=>renderer channel, | 262 // This gets called right before we request the plugin<=>renderer channel, |
| 266 // so we have to post a task to cancel it. | 263 // so we have to post a task to cancel it. |
| 267 base::ThreadTaskRunnerHandle::Get()->PostTask( | 264 base::MessageLoop::current()->PostTask( |
| 268 FROM_HERE, base::Bind(&PluginProcessHost::CancelPendingRequest, | 265 FROM_HERE, |
| 269 base::Unretained(host), this)); | 266 base::Bind(&PluginProcessHost::CancelPendingRequest, |
| 270 base::ThreadTaskRunnerHandle::Get()->PostTask( | 267 base::Unretained(host), |
| 268 this)); |
| 269 base::MessageLoop::current()->PostTask( |
| 271 FROM_HERE, base::Bind(&QuitUIMessageLoopFromIOThread)); | 270 FROM_HERE, base::Bind(&QuitUIMessageLoopFromIOThread)); |
| 272 } | 271 } |
| 273 | 272 |
| 274 bool set_plugin_info_called() const { | 273 bool set_plugin_info_called() const { |
| 275 return set_plugin_info_called_; | 274 return set_plugin_info_called_; |
| 276 } | 275 } |
| 277 | 276 |
| 278 bool on_found_plugin_process_host_called() const { | 277 bool on_found_plugin_process_host_called() const { |
| 279 return on_found_plugin_process_host_called_; | 278 return on_found_plugin_process_host_called_; |
| 280 } | 279 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 BrowserThread::IO, FROM_HERE, | 360 BrowserThread::IO, FROM_HERE, |
| 362 base::Bind(&OpenChannel, &mock_client)); | 361 base::Bind(&OpenChannel, &mock_client)); |
| 363 RunMessageLoop(); | 362 RunMessageLoop(); |
| 364 EXPECT_TRUE(mock_client.get_resource_context_called()); | 363 EXPECT_TRUE(mock_client.get_resource_context_called()); |
| 365 EXPECT_TRUE(mock_client.set_plugin_info_called()); | 364 EXPECT_TRUE(mock_client.set_plugin_info_called()); |
| 366 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called()); | 365 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called()); |
| 367 EXPECT_TRUE(mock_client.on_sent_plugin_channel_request_called()); | 366 EXPECT_TRUE(mock_client.on_sent_plugin_channel_request_called()); |
| 368 } | 367 } |
| 369 | 368 |
| 370 } // namespace content | 369 } // namespace content |
| OLD | NEW |