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