| 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 13 matching lines...) Expand all Loading... |
| 24 #include "content/shell/renderer/layout_test/layout_test_render_thread_observer.
h" | 24 #include "content/shell/renderer/layout_test/layout_test_render_thread_observer.
h" |
| 25 #include "content/shell/renderer/layout_test/test_media_stream_renderer_factory.
h" | 25 #include "content/shell/renderer/layout_test/test_media_stream_renderer_factory.
h" |
| 26 #include "content/shell/renderer/shell_render_view_observer.h" | 26 #include "content/shell/renderer/shell_render_view_observer.h" |
| 27 #include "content/shell/test_runner/mock_credential_manager_client.h" | 27 #include "content/shell/test_runner/mock_credential_manager_client.h" |
| 28 #include "content/shell/test_runner/web_frame_test_proxy.h" | 28 #include "content/shell/test_runner/web_frame_test_proxy.h" |
| 29 #include "content/shell/test_runner/web_test_interfaces.h" | 29 #include "content/shell/test_runner/web_test_interfaces.h" |
| 30 #include "content/shell/test_runner/web_test_runner.h" | 30 #include "content/shell/test_runner/web_test_runner.h" |
| 31 #include "content/shell/test_runner/web_view_test_proxy.h" | 31 #include "content/shell/test_runner/web_view_test_proxy.h" |
| 32 #include "content/test/mock_webclipboard_impl.h" | 32 #include "content/test/mock_webclipboard_impl.h" |
| 33 #include "gin/modules/module_registry.h" | 33 #include "gin/modules/module_registry.h" |
| 34 #include "media/base/audio_latency.h" |
| 34 #include "media/media_features.h" | 35 #include "media/media_features.h" |
| 36 #include "third_party/WebKit/public/platform/WebAudioLatencyHint.h" |
| 35 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 37 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
| 36 #include "third_party/WebKit/public/web/WebFrameWidget.h" | 38 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
| 37 #include "third_party/WebKit/public/web/WebKit.h" | 39 #include "third_party/WebKit/public/web/WebKit.h" |
| 38 #include "third_party/WebKit/public/web/WebPluginParams.h" | 40 #include "third_party/WebKit/public/web/WebPluginParams.h" |
| 39 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 41 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 40 #include "third_party/WebKit/public/web/WebTestingSupport.h" | 42 #include "third_party/WebKit/public/web/WebTestingSupport.h" |
| 41 #include "third_party/WebKit/public/web/WebView.h" | 43 #include "third_party/WebKit/public/web/WebView.h" |
| 42 #include "ui/gfx/icc_profile.h" | 44 #include "ui/gfx/icc_profile.h" |
| 43 #include "v8/include/v8.h" | 45 #include "v8/include/v8.h" |
| 44 | 46 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 189 } |
| 188 | 190 |
| 189 WebMIDIAccessor* | 191 WebMIDIAccessor* |
| 190 LayoutTestContentRendererClient::OverrideCreateMIDIAccessor( | 192 LayoutTestContentRendererClient::OverrideCreateMIDIAccessor( |
| 191 WebMIDIAccessorClient* client) { | 193 WebMIDIAccessorClient* client) { |
| 192 test_runner::WebTestInterfaces* interfaces = | 194 test_runner::WebTestInterfaces* interfaces = |
| 193 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); | 195 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); |
| 194 return interfaces->CreateMIDIAccessor(client); | 196 return interfaces->CreateMIDIAccessor(client); |
| 195 } | 197 } |
| 196 | 198 |
| 197 WebAudioDevice* LayoutTestContentRendererClient::OverrideCreateAudioDevice() { | 199 WebAudioDevice* LayoutTestContentRendererClient::OverrideCreateAudioDevice( |
| 200 const blink::WebAudioLatencyHint& latency_hint) { |
| 201 const double hw_buffer_size = 128; |
| 202 const double hw_sample_rate = 44100; |
| 203 double buffer_size = 0; |
| 204 switch (latency_hint.category()) { |
| 205 case blink::WebAudioLatencyHint::kCategoryInteractive: |
| 206 buffer_size = |
| 207 media::AudioLatency::GetInteractiveBufferSize(hw_buffer_size); |
| 208 break; |
| 209 case blink::WebAudioLatencyHint::kCategoryBalanced: |
| 210 buffer_size = |
| 211 media::AudioLatency::GetRtcBufferSize(hw_sample_rate, hw_buffer_size); |
| 212 break; |
| 213 case blink::WebAudioLatencyHint::kCategoryPlayback: |
| 214 buffer_size = |
| 215 media::AudioLatency::GetHighLatencyBufferSize(hw_sample_rate, 0); |
| 216 break; |
| 217 case blink::WebAudioLatencyHint::kCategoryExact: |
| 218 buffer_size = media::AudioLatency::GetExactBufferSize( |
| 219 latency_hint.seconds() * hw_sample_rate, hw_buffer_size, |
| 220 media::AudioLatency::GetHighLatencyBufferSize(hw_sample_rate, 0)); |
| 221 break; |
| 222 default: |
| 223 NOTREACHED(); |
| 224 break; |
| 225 } |
| 198 test_runner::WebTestInterfaces* interfaces = | 226 test_runner::WebTestInterfaces* interfaces = |
| 199 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); | 227 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); |
| 200 return interfaces->CreateAudioDevice(44100, 128); | 228 return interfaces->CreateAudioDevice(hw_sample_rate, buffer_size); |
| 201 } | 229 } |
| 202 | 230 |
| 203 WebClipboard* LayoutTestContentRendererClient::OverrideWebClipboard() { | 231 WebClipboard* LayoutTestContentRendererClient::OverrideWebClipboard() { |
| 204 if (!clipboard_) | 232 if (!clipboard_) |
| 205 clipboard_.reset(new MockWebClipboardImpl); | 233 clipboard_.reset(new MockWebClipboardImpl); |
| 206 return clipboard_.get(); | 234 return clipboard_.get(); |
| 207 } | 235 } |
| 208 | 236 |
| 209 WebThemeEngine* LayoutTestContentRendererClient::OverrideThemeEngine() { | 237 WebThemeEngine* LayoutTestContentRendererClient::OverrideThemeEngine() { |
| 210 return LayoutTestRenderThreadObserver::GetInstance() | 238 return LayoutTestRenderThreadObserver::GetInstance() |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 switches::kStableReleaseMode)) { | 306 switches::kStableReleaseMode)) { |
| 279 blink::WebRuntimeFeatures::enableTestOnlyFeatures(true); | 307 blink::WebRuntimeFeatures::enableTestOnlyFeatures(true); |
| 280 } | 308 } |
| 281 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 309 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 282 switches::kEnableFontAntialiasing)) { | 310 switches::kEnableFontAntialiasing)) { |
| 283 blink::setFontAntialiasingEnabledForTest(true); | 311 blink::setFontAntialiasingEnabledForTest(true); |
| 284 } | 312 } |
| 285 } | 313 } |
| 286 | 314 |
| 287 } // namespace content | 315 } // namespace content |
| OLD | NEW |