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/path_service.h" | 10 #include "base/path_service.h" |
11 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
12 #include "content/public/browser/resource_context.h" | 12 #include "content/public/browser/resource_context.h" |
| 13 #include "content/public/browser/storage_partition.h" |
13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
14 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
15 #include "content/public/test/test_browser_thread.h" | 16 #include "content/public/test/test_browser_thread.h" |
16 #include "content/public/test/test_utils.h" | 17 #include "content/public/test/test_utils.h" |
17 #include "content/shell/shell.h" | 18 #include "content/shell/shell.h" |
18 #include "content/test/content_browser_test.h" | 19 #include "content/test/content_browser_test.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
20 #include "webkit/plugins/npapi/plugin_list.h" | 21 #include "webkit/plugins/npapi/plugin_list.h" |
21 | 22 |
22 namespace content { | 23 namespace content { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 IPC::Channel* channel_; | 109 IPC::Channel* channel_; |
109 bool set_plugin_info_called_; | 110 bool set_plugin_info_called_; |
110 DISALLOW_COPY_AND_ASSIGN(MockPluginProcessHostClient); | 111 DISALLOW_COPY_AND_ASSIGN(MockPluginProcessHostClient); |
111 }; | 112 }; |
112 | 113 |
113 class PluginServiceTest : public ContentBrowserTest { | 114 class PluginServiceTest : public ContentBrowserTest { |
114 public: | 115 public: |
115 PluginServiceTest() {} | 116 PluginServiceTest() {} |
116 | 117 |
117 ResourceContext* GetResourceContext() { | 118 ResourceContext* GetResourceContext() { |
118 return shell()->web_contents()->GetBrowserContext()->GetResourceContext(); | 119 return BrowserContext::GetDefaultStoragePartition( |
| 120 shell()->web_contents()->GetBrowserContext())->GetResourceContext(); |
119 } | 121 } |
120 | 122 |
121 virtual void SetUpCommandLine(CommandLine* command_line) { | 123 virtual void SetUpCommandLine(CommandLine* command_line) { |
122 #ifdef OS_MACOSX | 124 #ifdef OS_MACOSX |
123 FilePath browser_directory; | 125 FilePath browser_directory; |
124 PathService::Get(base::DIR_MODULE, &browser_directory); | 126 PathService::Get(base::DIR_MODULE, &browser_directory); |
125 command_line->AppendSwitchPath(switches::kExtraPluginDir, | 127 command_line->AppendSwitchPath(switches::kExtraPluginDir, |
126 browser_directory.AppendASCII("plugins")); | 128 browser_directory.AppendASCII("plugins")); |
127 #endif | 129 #endif |
128 // TODO(jam): since these plugin tests are running under Chrome, we need to | 130 // TODO(jam): since these plugin tests are running under Chrome, we need to |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 BrowserThread::IO, FROM_HERE, | 330 BrowserThread::IO, FROM_HERE, |
329 base::Bind(&OpenChannel, &mock_client)); | 331 base::Bind(&OpenChannel, &mock_client)); |
330 RunMessageLoop(); | 332 RunMessageLoop(); |
331 EXPECT_TRUE(mock_client.get_resource_context_called()); | 333 EXPECT_TRUE(mock_client.get_resource_context_called()); |
332 EXPECT_TRUE(mock_client.set_plugin_info_called()); | 334 EXPECT_TRUE(mock_client.set_plugin_info_called()); |
333 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called()); | 335 EXPECT_TRUE(mock_client.on_found_plugin_process_host_called()); |
334 EXPECT_TRUE(mock_client.on_sent_plugin_channel_request_called()); | 336 EXPECT_TRUE(mock_client.on_sent_plugin_channel_request_called()); |
335 } | 337 } |
336 | 338 |
337 } // namespace content | 339 } // namespace content |
OLD | NEW |