OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/layout_test/layout_test_content_renderer_client
.h" | 5 #include "content/shell/renderer/layout_test/layout_test_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 "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "content/shell/test_runner/web_frame_test_proxy.h" | 27 #include "content/shell/test_runner/web_frame_test_proxy.h" |
28 #include "content/shell/test_runner/web_test_interfaces.h" | 28 #include "content/shell/test_runner/web_test_interfaces.h" |
29 #include "content/shell/test_runner/web_test_runner.h" | 29 #include "content/shell/test_runner/web_test_runner.h" |
30 #include "content/shell/test_runner/web_view_test_proxy.h" | 30 #include "content/shell/test_runner/web_view_test_proxy.h" |
31 #include "content/test/mock_webclipboard_impl.h" | 31 #include "content/test/mock_webclipboard_impl.h" |
32 #include "gin/modules/module_registry.h" | 32 #include "gin/modules/module_registry.h" |
33 #include "media/base/audio_latency.h" | 33 #include "media/base/audio_latency.h" |
34 #include "media/media_features.h" | 34 #include "media/media_features.h" |
35 #include "third_party/WebKit/public/platform/WebAudioLatencyHint.h" | 35 #include "third_party/WebKit/public/platform/WebAudioLatencyHint.h" |
36 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 36 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
| 37 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h" |
| 38 #include "third_party/WebKit/public/platform/modules/webmidi/WebMIDIAccessor.h" |
37 #include "third_party/WebKit/public/web/WebFrameWidget.h" | 39 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
38 #include "third_party/WebKit/public/web/WebKit.h" | 40 #include "third_party/WebKit/public/web/WebKit.h" |
39 #include "third_party/WebKit/public/web/WebPluginParams.h" | 41 #include "third_party/WebKit/public/web/WebPluginParams.h" |
40 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 42 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
41 #include "third_party/WebKit/public/web/WebTestingSupport.h" | 43 #include "third_party/WebKit/public/web/WebTestingSupport.h" |
42 #include "third_party/WebKit/public/web/WebView.h" | 44 #include "third_party/WebKit/public/web/WebView.h" |
43 #include "ui/gfx/icc_profile.h" | 45 #include "ui/gfx/icc_profile.h" |
44 #include "v8/include/v8.h" | 46 #include "v8/include/v8.h" |
45 | 47 |
46 using blink::WebAudioDevice; | 48 using blink::WebAudioDevice; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 158 |
157 BlinkTestRunner* test_runner = BlinkTestRunner::Get(render_view); | 159 BlinkTestRunner* test_runner = BlinkTestRunner::Get(render_view); |
158 test_runner->Reset(false /* for_new_test */); | 160 test_runner->Reset(false /* for_new_test */); |
159 | 161 |
160 LayoutTestRenderThreadObserver::GetInstance() | 162 LayoutTestRenderThreadObserver::GetInstance() |
161 ->test_interfaces() | 163 ->test_interfaces() |
162 ->TestRunner() | 164 ->TestRunner() |
163 ->InitializeWebViewWithMocks(render_view->GetWebView()); | 165 ->InitializeWebViewWithMocks(render_view->GetWebView()); |
164 } | 166 } |
165 | 167 |
166 WebMediaStreamCenter* | 168 std::unique_ptr<WebMediaStreamCenter> |
167 LayoutTestContentRendererClient::OverrideCreateWebMediaStreamCenter( | 169 LayoutTestContentRendererClient::OverrideCreateWebMediaStreamCenter( |
168 WebMediaStreamCenterClient* client) { | 170 WebMediaStreamCenterClient* client) { |
169 #if BUILDFLAG(ENABLE_WEBRTC) | 171 #if BUILDFLAG(ENABLE_WEBRTC) |
170 test_runner::WebTestInterfaces* interfaces = | 172 test_runner::WebTestInterfaces* interfaces = |
171 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); | 173 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); |
172 return interfaces->CreateMediaStreamCenter(client); | 174 return interfaces->CreateMediaStreamCenter(client); |
173 #else | 175 #else |
174 return NULL; | 176 return nullptr; |
175 #endif | 177 #endif |
176 } | 178 } |
177 | 179 |
178 WebRTCPeerConnectionHandler* | 180 std::unique_ptr<WebRTCPeerConnectionHandler> |
179 LayoutTestContentRendererClient::OverrideCreateWebRTCPeerConnectionHandler( | 181 LayoutTestContentRendererClient::OverrideCreateWebRTCPeerConnectionHandler( |
180 WebRTCPeerConnectionHandlerClient* client) { | 182 WebRTCPeerConnectionHandlerClient* client) { |
181 #if BUILDFLAG(ENABLE_WEBRTC) | 183 #if BUILDFLAG(ENABLE_WEBRTC) |
182 test_runner::WebTestInterfaces* interfaces = | 184 test_runner::WebTestInterfaces* interfaces = |
183 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); | 185 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); |
184 return interfaces->CreateWebRTCPeerConnectionHandler(client); | 186 return interfaces->CreateWebRTCPeerConnectionHandler(client); |
185 #else | 187 #else |
186 return NULL; | 188 return nullptr; |
187 #endif | 189 #endif |
188 } | 190 } |
189 | 191 |
190 WebMIDIAccessor* | 192 std::unique_ptr<WebMIDIAccessor> |
191 LayoutTestContentRendererClient::OverrideCreateMIDIAccessor( | 193 LayoutTestContentRendererClient::OverrideCreateMIDIAccessor( |
192 WebMIDIAccessorClient* client) { | 194 WebMIDIAccessorClient* client) { |
193 test_runner::WebTestInterfaces* interfaces = | 195 test_runner::WebTestInterfaces* interfaces = |
194 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); | 196 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); |
195 return interfaces->CreateMIDIAccessor(client); | 197 return interfaces->CreateMIDIAccessor(client); |
196 } | 198 } |
197 | 199 |
198 WebAudioDevice* LayoutTestContentRendererClient::OverrideCreateAudioDevice( | 200 std::unique_ptr<WebAudioDevice> |
| 201 LayoutTestContentRendererClient::OverrideCreateAudioDevice( |
199 const blink::WebAudioLatencyHint& latency_hint) { | 202 const blink::WebAudioLatencyHint& latency_hint) { |
200 const double hw_buffer_size = 128; | 203 const double hw_buffer_size = 128; |
201 const double hw_sample_rate = 44100; | 204 const double hw_sample_rate = 44100; |
202 double buffer_size = 0; | 205 double buffer_size = 0; |
203 switch (latency_hint.Category()) { | 206 switch (latency_hint.Category()) { |
204 case blink::WebAudioLatencyHint::kCategoryInteractive: | 207 case blink::WebAudioLatencyHint::kCategoryInteractive: |
205 buffer_size = | 208 buffer_size = |
206 media::AudioLatency::GetInteractiveBufferSize(hw_buffer_size); | 209 media::AudioLatency::GetInteractiveBufferSize(hw_buffer_size); |
207 break; | 210 break; |
208 case blink::WebAudioLatencyHint::kCategoryBalanced: | 211 case blink::WebAudioLatencyHint::kCategoryBalanced: |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 switches::kStableReleaseMode)) { | 283 switches::kStableReleaseMode)) { |
281 blink::WebRuntimeFeatures::EnableTestOnlyFeatures(true); | 284 blink::WebRuntimeFeatures::EnableTestOnlyFeatures(true); |
282 } | 285 } |
283 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 286 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
284 switches::kEnableFontAntialiasing)) { | 287 switches::kEnableFontAntialiasing)) { |
285 blink::SetFontAntialiasingEnabledForTest(true); | 288 blink::SetFontAntialiasingEnabledForTest(true); |
286 } | 289 } |
287 } | 290 } |
288 | 291 |
289 } // namespace content | 292 } // namespace content |
OLD | NEW |