| Index: content/browser/devtools/protocol/devtools_protocol_browsertest.cc
|
| diff --git a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
|
| index af97bb3c75e00d064005508201d3274fb4279ac7..5173237a7d787c9818869c7d8e57ca444a6adfdc 100644
|
| --- a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
|
| +++ b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
|
| @@ -785,6 +785,39 @@ IN_PROC_BROWSER_TEST_F(CaptureScreenshotTest,
|
| PlaceAndCaptureBox(kFrameSize, gfx::Size(10, 10000), 1.0);
|
| }
|
|
|
| +// Verifies that setDefaultBackgroundColor and captureScreenshot support a
|
| +// transparent background.
|
| +IN_PROC_BROWSER_TEST_F(CaptureScreenshotTest, TransparentScreenshots) {
|
| + if (base::SysInfo::IsLowEndDevice())
|
| + return;
|
| +
|
| + shell()->LoadURL(
|
| + GURL("data:text/html,<body style='background:transparent'></body>"));
|
| + WaitForLoadStop(shell()->web_contents());
|
| + Attach();
|
| +
|
| + // Override background to transparent.
|
| + std::unique_ptr<base::DictionaryValue> color(new base::DictionaryValue());
|
| + color->SetInteger("r", 0);
|
| + color->SetInteger("g", 0);
|
| + color->SetInteger("b", 0);
|
| + color->SetDouble("a", 0);
|
| + std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue());
|
| + params->Set("color", std::move(color));
|
| + SendCommand("Emulation.setDefaultBackgroundColorOverride", std::move(params));
|
| +
|
| + SkBitmap expected_bitmap;
|
| + // We compare against the actual physical backing size rather than the
|
| + // view size, because the view size is stored adjusted for DPI and only in
|
| + // integer precision.
|
| + gfx::Size view_size = static_cast<RenderWidgetHostViewBase*>(
|
| + shell()->web_contents()->GetRenderWidgetHostView())
|
| + ->GetPhysicalBackingSize();
|
| + expected_bitmap.allocN32Pixels(view_size.width(), view_size.height());
|
| + expected_bitmap.eraseColor(SK_ColorTRANSPARENT);
|
| + CaptureScreenshotAndCompareTo(expected_bitmap, ENCODING_PNG, true);
|
| +}
|
| +
|
| #if defined(OS_ANDROID)
|
| // Disabled, see http://crbug.com/469947.
|
| IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, DISABLED_SynthesizePinchGesture) {
|
|
|