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/shell/renderer/shell_content_renderer_client.h" | 5 #include "content/shell/renderer/shell_content_renderer_client.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
10 #include "content/public/common/content_constants.h" | 10 #include "content/public/common/content_constants.h" |
11 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
12 #include "content/public/renderer/render_view.h" | 12 #include "content/public/renderer/render_view.h" |
13 #include "content/public/test/layouttest_support.h" | 13 #include "content/public/test/layouttest_support.h" |
14 #include "content/shell/common/shell_switches.h" | 14 #include "content/shell/common/shell_switches.h" |
15 #include "content/shell/renderer/shell_render_process_observer.h" | 15 #include "content/shell/renderer/shell_render_process_observer.h" |
16 #include "content/shell/renderer/webkit_test_runner.h" | 16 #include "content/shell/renderer/webkit_test_runner.h" |
17 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 17 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
18 #include "third_party/WebKit/public/web/WebPluginParams.h" | 18 #include "third_party/WebKit/public/web/WebPluginParams.h" |
19 #include "third_party/WebKit/public/web/WebView.h" | 19 #include "third_party/WebKit/public/web/WebView.h" |
20 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestInterfaces.h" | 20 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestInterfaces.h" |
21 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestProxy.h" | 21 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestProxy.h" |
22 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestRunner.h" | 22 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
TestRunner.h" |
23 #include "v8/include/v8.h" | 23 #include "v8/include/v8.h" |
24 #include "webkit/mocks/mock_webhyphenator.h" | 24 #include "webkit/mocks/mock_webhyphenator.h" |
25 #include "webkit/support/mock_webclipboard_impl.h" | 25 #include "webkit/support/mock_webclipboard_impl.h" |
26 #include "webkit/support/test_shell_webmimeregistry_impl.h" | |
27 | 26 |
28 using WebKit::WebClipboard; | 27 using WebKit::WebClipboard; |
29 using WebKit::WebFrame; | 28 using WebKit::WebFrame; |
30 using WebKit::WebHyphenator; | 29 using WebKit::WebHyphenator; |
31 using WebKit::WebMediaStreamCenter; | 30 using WebKit::WebMediaStreamCenter; |
32 using WebKit::WebMediaStreamCenterClient; | 31 using WebKit::WebMediaStreamCenterClient; |
33 using WebKit::WebMimeRegistry; | |
34 using WebKit::WebPlugin; | 32 using WebKit::WebPlugin; |
35 using WebKit::WebPluginParams; | 33 using WebKit::WebPluginParams; |
36 using WebKit::WebRTCPeerConnectionHandler; | 34 using WebKit::WebRTCPeerConnectionHandler; |
37 using WebKit::WebRTCPeerConnectionHandlerClient; | 35 using WebKit::WebRTCPeerConnectionHandlerClient; |
38 using WebKit::WebThemeEngine; | 36 using WebKit::WebThemeEngine; |
39 using WebTestRunner::WebTestDelegate; | 37 using WebTestRunner::WebTestDelegate; |
40 using WebTestRunner::WebTestInterfaces; | 38 using WebTestRunner::WebTestInterfaces; |
41 using WebTestRunner::WebTestProxyBase; | 39 using WebTestRunner::WebTestProxyBase; |
42 | 40 |
43 namespace content { | 41 namespace content { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 141 } |
144 | 142 |
145 WebClipboard* ShellContentRendererClient::OverrideWebClipboard() { | 143 WebClipboard* ShellContentRendererClient::OverrideWebClipboard() { |
146 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 144 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
147 return NULL; | 145 return NULL; |
148 if (!clipboard_) | 146 if (!clipboard_) |
149 clipboard_.reset(new MockWebClipboardImpl); | 147 clipboard_.reset(new MockWebClipboardImpl); |
150 return clipboard_.get(); | 148 return clipboard_.get(); |
151 } | 149 } |
152 | 150 |
153 WebMimeRegistry* ShellContentRendererClient::OverrideWebMimeRegistry() { | |
154 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | |
155 return NULL; | |
156 if (!mime_registry_) | |
157 mime_registry_.reset(new TestShellWebMimeRegistryImpl); | |
158 return mime_registry_.get(); | |
159 } | |
160 | |
161 WebHyphenator* ShellContentRendererClient::OverrideWebHyphenator() { | 151 WebHyphenator* ShellContentRendererClient::OverrideWebHyphenator() { |
162 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 152 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
163 return NULL; | 153 return NULL; |
164 if (!hyphenator_) | 154 if (!hyphenator_) |
165 hyphenator_.reset(new webkit_glue::MockWebHyphenator); | 155 hyphenator_.reset(new webkit_glue::MockWebHyphenator); |
166 return hyphenator_.get(); | 156 return hyphenator_.get(); |
167 | 157 |
168 } | 158 } |
169 | 159 |
170 WebThemeEngine* ShellContentRendererClient::OverrideThemeEngine() { | 160 WebThemeEngine* ShellContentRendererClient::OverrideThemeEngine() { |
(...skipping 20 matching lines...) Expand all Loading... |
191 if (CommandLine::ForCurrentProcess()->HasSwitch( | 181 if (CommandLine::ForCurrentProcess()->HasSwitch( |
192 switches::kEnableBrowserPluginForAllViewTypes)) { | 182 switches::kEnableBrowserPluginForAllViewTypes)) { |
193 // Allow BrowserPlugin if forced by command line flag. This is generally | 183 // Allow BrowserPlugin if forced by command line flag. This is generally |
194 // true for tests. | 184 // true for tests. |
195 return true; | 185 return true; |
196 } | 186 } |
197 return ContentRendererClient::AllowBrowserPlugin(container); | 187 return ContentRendererClient::AllowBrowserPlugin(container); |
198 } | 188 } |
199 | 189 |
200 } // namespace content | 190 } // namespace content |
OLD | NEW |