| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 std::unique_ptr<MediaStreamRendererFactory> | 247 std::unique_ptr<MediaStreamRendererFactory> |
| 248 LayoutTestContentRendererClient::CreateMediaStreamRendererFactory() { | 248 LayoutTestContentRendererClient::CreateMediaStreamRendererFactory() { |
| 249 #if BUILDFLAG(ENABLE_WEBRTC) | 249 #if BUILDFLAG(ENABLE_WEBRTC) |
| 250 return std::unique_ptr<MediaStreamRendererFactory>( | 250 return std::unique_ptr<MediaStreamRendererFactory>( |
| 251 new TestMediaStreamRendererFactory()); | 251 new TestMediaStreamRendererFactory()); |
| 252 #else | 252 #else |
| 253 return nullptr; | 253 return nullptr; |
| 254 #endif | 254 #endif |
| 255 } | 255 } |
| 256 | 256 |
| 257 std::unique_ptr<gfx::ICCProfile> | |
| 258 LayoutTestContentRendererClient::GetImageDecodeColorProfile() { | |
| 259 // TODO(ccameron): Make all platforms use the same color profile for layout | |
| 260 // tests. | |
| 261 #if defined(OS_WIN) | |
| 262 return base::WrapUnique(new gfx::ICCProfile( | |
| 263 GetTestingICCProfile("sRGB"))); | |
| 264 #elif defined(OS_MACOSX) | |
| 265 return base::WrapUnique(new gfx::ICCProfile( | |
| 266 GetTestingICCProfile("genericRGB"))); | |
| 267 #else | |
| 268 return base::WrapUnique(new gfx::ICCProfile()); | |
| 269 #endif | |
| 270 } | |
| 271 | |
| 272 void LayoutTestContentRendererClient::DidInitializeWorkerContextOnWorkerThread( | 257 void LayoutTestContentRendererClient::DidInitializeWorkerContextOnWorkerThread( |
| 273 v8::Local<v8::Context> context) { | 258 v8::Local<v8::Context> context) { |
| 274 blink::WebTestingSupport::InjectInternalsObject(context); | 259 blink::WebTestingSupport::InjectInternalsObject(context); |
| 275 } | 260 } |
| 276 | 261 |
| 277 void LayoutTestContentRendererClient:: | 262 void LayoutTestContentRendererClient:: |
| 278 SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() { | 263 SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() { |
| 279 // We always expose GC to layout tests. | 264 // We always expose GC to layout tests. |
| 280 std::string flags("--expose-gc"); | 265 std::string flags("--expose-gc"); |
| 281 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); | 266 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); |
| 282 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 267 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 283 switches::kStableReleaseMode)) { | 268 switches::kStableReleaseMode)) { |
| 284 blink::WebRuntimeFeatures::EnableTestOnlyFeatures(true); | 269 blink::WebRuntimeFeatures::EnableTestOnlyFeatures(true); |
| 285 } | 270 } |
| 286 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 271 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 287 switches::kEnableFontAntialiasing)) { | 272 switches::kEnableFontAntialiasing)) { |
| 288 blink::SetFontAntialiasingEnabledForTest(true); | 273 blink::SetFontAntialiasingEnabledForTest(true); |
| 289 } | 274 } |
| 290 } | 275 } |
| 291 | 276 |
| 292 } // namespace content | 277 } // namespace content |
| OLD | NEW |