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