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/shell_content_renderer_client.h" | 5 #include "content/shell/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/shell_render_process_observer.h" | 14 #include "content/shell/shell_render_process_observer.h" |
15 #include "content/shell/shell_switches.h" | 15 #include "content/shell/shell_switches.h" |
16 #include "content/shell/webkit_test_runner.h" | 16 #include "content/shell/webkit_test_runner.h" |
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCente
r.h" | 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCente
r.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/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 "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web
UserMediaClientMock.h" |
23 #include "v8/include/v8.h" | 24 #include "v8/include/v8.h" |
24 #include "webkit/mocks/mock_webhyphenator.h" | 25 #include "webkit/mocks/mock_webhyphenator.h" |
| 26 #include "webkit/support/test_media_stream_client.h" |
25 #include "webkit/tools/test_shell/mock_webclipboard_impl.h" | 27 #include "webkit/tools/test_shell/mock_webclipboard_impl.h" |
26 #include "webkit/tools/test_shell/test_shell_webmimeregistry_impl.h" | 28 #include "webkit/tools/test_shell/test_shell_webmimeregistry_impl.h" |
27 | 29 |
28 using WebKit::WebClipboard; | 30 using WebKit::WebClipboard; |
29 using WebKit::WebFrame; | 31 using WebKit::WebFrame; |
30 using WebKit::WebHyphenator; | 32 using WebKit::WebHyphenator; |
31 using WebKit::WebMediaStreamCenter; | 33 using WebKit::WebMediaStreamCenter; |
32 using WebKit::WebMediaStreamCenterClient; | 34 using WebKit::WebMediaStreamCenterClient; |
33 using WebKit::WebMimeRegistry; | 35 using WebKit::WebMimeRegistry; |
34 using WebKit::WebPlugin; | 36 using WebKit::WebPlugin; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 return NULL; | 110 return NULL; |
109 #if defined(ENABLE_WEBRTC) | 111 #if defined(ENABLE_WEBRTC) |
110 WebTestInterfaces* interfaces = | 112 WebTestInterfaces* interfaces = |
111 ShellRenderProcessObserver::GetInstance()->test_interfaces(); | 113 ShellRenderProcessObserver::GetInstance()->test_interfaces(); |
112 return interfaces->createMediaStreamCenter(client); | 114 return interfaces->createMediaStreamCenter(client); |
113 #else | 115 #else |
114 return NULL; | 116 return NULL; |
115 #endif | 117 #endif |
116 } | 118 } |
117 | 119 |
| 120 WebKit::WebUserMediaClient* |
| 121 ShellContentRendererClient::OverrideUserMediaClient() { |
| 122 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 123 return NULL; |
| 124 #if defined(ENABLE_WEBRTC) |
| 125 if (!user_media_client_) { |
| 126 user_media_client_.reset(new WebTestRunner::WebUserMediaClientMock( |
| 127 ShellRenderProcessObserver::GetInstance()->test_delegate())); |
| 128 } |
| 129 return user_media_client_.get(); |
| 130 #else |
| 131 return NULL; |
| 132 #endif |
| 133 } |
| 134 |
| 135 webkit_media::MediaStreamClient* |
| 136 ShellContentRendererClient::OverrideMediaStreamClient() { |
| 137 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 138 return NULL; |
| 139 #if defined(ENABLE_WEBRTC) |
| 140 if (!media_stream_client_) |
| 141 media_stream_client_.reset(new webkit_support::TestMediaStreamClient()); |
| 142 return media_stream_client_.get(); |
| 143 #else |
| 144 return NULL; |
| 145 #endif |
| 146 } |
| 147 |
118 WebRTCPeerConnectionHandler* | 148 WebRTCPeerConnectionHandler* |
119 ShellContentRendererClient::OverrideCreateWebRTCPeerConnectionHandler( | 149 ShellContentRendererClient::OverrideCreateWebRTCPeerConnectionHandler( |
120 WebRTCPeerConnectionHandlerClient* client) { | 150 WebRTCPeerConnectionHandlerClient* client) { |
121 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 151 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
122 return NULL; | 152 return NULL; |
123 #if defined(ENABLE_WEBRTC) | 153 #if defined(ENABLE_WEBRTC) |
124 WebTestInterfaces* interfaces = | 154 WebTestInterfaces* interfaces = |
125 ShellRenderProcessObserver::GetInstance()->test_interfaces(); | 155 ShellRenderProcessObserver::GetInstance()->test_interfaces(); |
126 return interfaces->createWebRTCPeerConnectionHandler(client); | 156 return interfaces->createWebRTCPeerConnectionHandler(client); |
127 #else | 157 #else |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 if (CommandLine::ForCurrentProcess()->HasSwitch( | 208 if (CommandLine::ForCurrentProcess()->HasSwitch( |
179 switches::kEnableBrowserPluginForAllViewTypes)) { | 209 switches::kEnableBrowserPluginForAllViewTypes)) { |
180 // Allow BrowserPlugin if forced by command line flag. This is generally | 210 // Allow BrowserPlugin if forced by command line flag. This is generally |
181 // true for tests. | 211 // true for tests. |
182 return true; | 212 return true; |
183 } | 213 } |
184 return ContentRendererClient::AllowBrowserPlugin(container); | 214 return ContentRendererClient::AllowBrowserPlugin(container); |
185 } | 215 } |
186 | 216 |
187 } // namespace content | 217 } // namespace content |
OLD | NEW |