1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "build/build_config.h"
6 #include "cc/layers/solid_color_layer.h"
7 #include "cc/layers/texture_layer.h"
8 #include "cc/output/copy_output_request.h"
9 #include "cc/output/copy_output_result.h"
10 #include "cc/test/fake_picture_layer.h"
11 #include "cc/test/fake_picture_layer_impl.h"
12 #include "cc/test/layer_tree_pixel_test.h"
13 #include "cc/test/paths.h"
14 #include "cc/test/solid_color_content_layer_client.h"
15 #include "cc/trees/layer_tree_impl.h"
17 #if !defined(OS_ANDROID)
22 // Can't templatize a class on its own members, so ReadbackType and
23 // ReadbackTestConfig are declared here, before LayerTreeHostReadbackPixelTest.
30 struct ReadbackTestConfig
{
31 ReadbackTestConfig(LayerTreePixelTest::PixelTestType pixel_test_type_
,
32 ReadbackType readback_type_
)
33 : pixel_test_type(pixel_test_type_
), readback_type(readback_type_
) {}
34 LayerTreePixelTest::PixelTestType pixel_test_type
;
35 ReadbackType readback_type
;
38 class LayerTreeHostReadbackPixelTest
39 : public LayerTreePixelTest
,
40 public testing::WithParamInterface
<ReadbackTestConfig
> {
42 LayerTreeHostReadbackPixelTest()
43 : readback_type_(READBACK_INVALID
),
44 insert_copy_request_after_frame_count_(0) {}
46 void RunReadbackTest(PixelTestType test_type
,
47 ReadbackType readback_type
,
48 scoped_refptr
<Layer
> content_root
,
49 base::FilePath file_name
) {
50 readback_type_
= readback_type
;
51 RunPixelTest(test_type
, content_root
, file_name
);
54 void RunReadbackTestWithReadbackTarget(PixelTestType type
,
55 ReadbackType readback_type
,
56 scoped_refptr
<Layer
> content_root
,
58 base::FilePath file_name
) {
59 readback_type_
= readback_type
;
60 RunPixelTestWithReadbackTarget(type
, content_root
, target
, file_name
);
63 scoped_ptr
<CopyOutputRequest
> CreateCopyOutputRequest() override
{
64 scoped_ptr
<CopyOutputRequest
> request
;
66 if (readback_type_
== READBACK_BITMAP
) {
67 request
= CopyOutputRequest::CreateBitmapRequest(
68 base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsBitmap
,
69 base::Unretained(this)));
71 DCHECK_EQ(readback_type_
, READBACK_DEFAULT
);
72 if (test_type_
== PIXEL_TEST_SOFTWARE
) {
73 request
= CopyOutputRequest::CreateRequest(
74 base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsBitmap
,
75 base::Unretained(this)));
77 DCHECK_EQ(test_type_
, PIXEL_TEST_GL
);
78 request
= CopyOutputRequest::CreateRequest(
79 base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsTexture
,
80 base::Unretained(this)));
84 if (!copy_subrect_
.IsEmpty())
85 request
->set_area(copy_subrect_
);
86 return request
.Pass();
89 void BeginTest() override
{
90 if (insert_copy_request_after_frame_count_
== 0) {
92 readback_target_
? readback_target_
: layer_tree_host()->root_layer();
93 target
->RequestCopyOfOutput(CreateCopyOutputRequest().Pass());
95 PostSetNeedsCommitToMainThread();
98 void DidCommitAndDrawFrame() override
{
99 if (insert_copy_request_after_frame_count_
==
100 layer_tree_host()->source_frame_number()) {
101 Layer
* const target
=
102 readback_target_
? readback_target_
: layer_tree_host()->root_layer();
103 target
->RequestCopyOfOutput(CreateCopyOutputRequest().Pass());
107 void ReadbackResultAsBitmap(scoped_ptr
<CopyOutputResult
> result
) {
108 EXPECT_TRUE(proxy()->IsMainThread());
109 EXPECT_TRUE(result
->HasBitmap());
110 result_bitmap_
= result
->TakeBitmap().Pass();
114 void ReadbackResultAsTexture(scoped_ptr
<CopyOutputResult
> result
) {
115 EXPECT_TRUE(proxy()->IsMainThread());
116 EXPECT_TRUE(result
->HasTexture());
118 TextureMailbox texture_mailbox
;
119 scoped_ptr
<SingleReleaseCallback
> release_callback
;
120 result
->TakeTexture(&texture_mailbox
, &release_callback
);
121 EXPECT_TRUE(texture_mailbox
.IsValid());
122 EXPECT_TRUE(texture_mailbox
.IsTexture());
124 scoped_ptr
<SkBitmap
> bitmap
=
125 CopyTextureMailboxToBitmap(result
->size(), texture_mailbox
);
126 release_callback
->Run(0, false);
128 ReadbackResultAsBitmap(CopyOutputResult::CreateBitmapResult(bitmap
.Pass()));
131 ReadbackType readback_type_
;
132 gfx::Rect copy_subrect_
;
133 int insert_copy_request_after_frame_count_
;
136 void IgnoreReadbackResult(scoped_ptr
<CopyOutputResult
> result
) {
139 TEST_P(LayerTreeHostReadbackPixelTest
, ReadbackRootLayer
) {
140 scoped_refptr
<SolidColorLayer
> background
=
141 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorWHITE
);
143 scoped_refptr
<SolidColorLayer
> green
=
144 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
145 background
->AddChild(green
);
147 RunReadbackTest(GetParam().pixel_test_type
, GetParam().readback_type
,
148 background
, base::FilePath(FILE_PATH_LITERAL("green.png")));
151 TEST_P(LayerTreeHostReadbackPixelTest
, ReadbackRootLayerWithChild
) {
152 scoped_refptr
<SolidColorLayer
> background
=
153 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorWHITE
);
155 scoped_refptr
<SolidColorLayer
> green
=
156 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
157 background
->AddChild(green
);
159 scoped_refptr
<SolidColorLayer
> blue
=
160 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
161 green
->AddChild(blue
);
164 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
165 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")));
168 TEST_P(LayerTreeHostReadbackPixelTest
, ReadbackNonRootLayer
) {
169 scoped_refptr
<SolidColorLayer
> background
=
170 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorWHITE
);
172 scoped_refptr
<SolidColorLayer
> green
=
173 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
174 background
->AddChild(green
);
176 RunReadbackTestWithReadbackTarget(
177 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
178 green
.get(), base::FilePath(FILE_PATH_LITERAL("green.png")));
181 TEST_P(LayerTreeHostReadbackPixelTest
, ReadbackSmallNonRootLayer
) {
182 scoped_refptr
<SolidColorLayer
> background
=
183 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorWHITE
);
185 scoped_refptr
<SolidColorLayer
> green
=
186 CreateSolidColorLayer(gfx::Rect(100, 100, 100, 100), SK_ColorGREEN
);
187 background
->AddChild(green
);
189 RunReadbackTestWithReadbackTarget(
190 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
191 green
.get(), base::FilePath(FILE_PATH_LITERAL("green_small.png")));
194 TEST_P(LayerTreeHostReadbackPixelTest
, ReadbackSmallNonRootLayerWithChild
) {
195 scoped_refptr
<SolidColorLayer
> background
=
196 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorWHITE
);
198 scoped_refptr
<SolidColorLayer
> green
=
199 CreateSolidColorLayer(gfx::Rect(100, 100, 100, 100), SK_ColorGREEN
);
200 background
->AddChild(green
);
202 scoped_refptr
<SolidColorLayer
> blue
=
203 CreateSolidColorLayer(gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
204 green
->AddChild(blue
);
206 RunReadbackTestWithReadbackTarget(
207 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
209 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
212 TEST_P(LayerTreeHostReadbackPixelTest
, ReadbackSubtreeSurroundsTargetLayer
) {
213 scoped_refptr
<SolidColorLayer
> background
=
214 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
216 scoped_refptr
<SolidColorLayer
> target
=
217 CreateSolidColorLayer(gfx::Rect(100, 100, 100, 100), SK_ColorRED
);
218 background
->AddChild(target
);
220 scoped_refptr
<SolidColorLayer
> green
=
221 CreateSolidColorLayer(gfx::Rect(-100, -100, 300, 300), SK_ColorGREEN
);
222 target
->AddChild(green
);
224 scoped_refptr
<SolidColorLayer
> blue
=
225 CreateSolidColorLayer(gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
226 target
->AddChild(blue
);
228 copy_subrect_
= gfx::Rect(0, 0, 100, 100);
229 RunReadbackTestWithReadbackTarget(
230 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
232 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
235 TEST_P(LayerTreeHostReadbackPixelTest
,
236 ReadbackSubtreeExtendsBeyondTargetLayer
) {
237 scoped_refptr
<SolidColorLayer
> background
=
238 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
240 scoped_refptr
<SolidColorLayer
> target
=
241 CreateSolidColorLayer(gfx::Rect(50, 50, 150, 150), SK_ColorRED
);
242 background
->AddChild(target
);
244 scoped_refptr
<SolidColorLayer
> green
=
245 CreateSolidColorLayer(gfx::Rect(50, 50, 200, 200), SK_ColorGREEN
);
246 target
->AddChild(green
);
248 scoped_refptr
<SolidColorLayer
> blue
=
249 CreateSolidColorLayer(gfx::Rect(100, 100, 50, 50), SK_ColorBLUE
);
250 target
->AddChild(blue
);
252 copy_subrect_
= gfx::Rect(50, 50, 100, 100);
253 RunReadbackTestWithReadbackTarget(
254 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
256 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
259 TEST_P(LayerTreeHostReadbackPixelTest
, ReadbackHiddenSubtree
) {
260 scoped_refptr
<SolidColorLayer
> background
=
261 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorBLACK
);
263 scoped_refptr
<SolidColorLayer
> hidden_target
=
264 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
265 hidden_target
->SetHideLayerAndSubtree(true);
266 background
->AddChild(hidden_target
);
268 scoped_refptr
<SolidColorLayer
> blue
=
269 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
270 hidden_target
->AddChild(blue
);
272 RunReadbackTestWithReadbackTarget(
273 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
275 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")));
278 TEST_P(LayerTreeHostReadbackPixelTest
,
279 HiddenSubtreeNotVisibleWhenDrawnForReadback
) {
280 scoped_refptr
<SolidColorLayer
> background
=
281 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorBLACK
);
283 scoped_refptr
<SolidColorLayer
> hidden_target
=
284 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
285 hidden_target
->SetHideLayerAndSubtree(true);
286 background
->AddChild(hidden_target
);
288 scoped_refptr
<SolidColorLayer
> blue
=
289 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
290 hidden_target
->AddChild(blue
);
292 hidden_target
->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
293 base::Bind(&IgnoreReadbackResult
)));
294 RunReadbackTest(GetParam().pixel_test_type
, GetParam().readback_type
,
295 background
, base::FilePath(FILE_PATH_LITERAL("black.png")));
298 TEST_P(LayerTreeHostReadbackPixelTest
, ReadbackSubrect
) {
299 scoped_refptr
<SolidColorLayer
> background
=
300 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorWHITE
);
302 scoped_refptr
<SolidColorLayer
> green
=
303 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
304 background
->AddChild(green
);
306 scoped_refptr
<SolidColorLayer
> blue
=
307 CreateSolidColorLayer(gfx::Rect(100, 100, 50, 50), SK_ColorBLUE
);
308 green
->AddChild(blue
);
310 // Grab the middle of the root layer.
311 copy_subrect_
= gfx::Rect(50, 50, 100, 100);
314 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
315 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
318 TEST_P(LayerTreeHostReadbackPixelTest
, ReadbackNonRootLayerSubrect
) {
319 scoped_refptr
<SolidColorLayer
> background
=
320 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorWHITE
);
322 scoped_refptr
<SolidColorLayer
> green
=
323 CreateSolidColorLayer(gfx::Rect(25, 25, 150, 150), SK_ColorGREEN
);
324 background
->AddChild(green
);
326 scoped_refptr
<SolidColorLayer
> blue
=
327 CreateSolidColorLayer(gfx::Rect(75, 75, 50, 50), SK_ColorBLUE
);
328 green
->AddChild(blue
);
330 // Grab the middle of the green layer.
331 copy_subrect_
= gfx::Rect(25, 25, 100, 100);
333 RunReadbackTestWithReadbackTarget(
334 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
336 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
339 TEST_P(LayerTreeHostReadbackPixelTest
, ReadbackWhenNoDamage
) {
340 scoped_refptr
<SolidColorLayer
> background
=
341 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
343 scoped_refptr
<SolidColorLayer
> parent
=
344 CreateSolidColorLayer(gfx::Rect(0, 0, 150, 150), SK_ColorRED
);
345 background
->AddChild(parent
);
347 scoped_refptr
<SolidColorLayer
> target
=
348 CreateSolidColorLayer(gfx::Rect(0, 0, 100, 100), SK_ColorGREEN
);
349 parent
->AddChild(target
);
351 scoped_refptr
<SolidColorLayer
> blue
=
352 CreateSolidColorLayer(gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
353 target
->AddChild(blue
);
355 insert_copy_request_after_frame_count_
= 1;
356 RunReadbackTestWithReadbackTarget(
357 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
359 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
362 TEST_P(LayerTreeHostReadbackPixelTest
, ReadbackOutsideViewportWhenNoDamage
) {
363 scoped_refptr
<SolidColorLayer
> background
=
364 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
366 scoped_refptr
<SolidColorLayer
> parent
=
367 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorRED
);
368 EXPECT_FALSE(parent
->masks_to_bounds());
369 background
->AddChild(parent
);
371 scoped_refptr
<SolidColorLayer
> target
=
372 CreateSolidColorLayer(gfx::Rect(250, 250, 100, 100), SK_ColorGREEN
);
373 parent
->AddChild(target
);
375 scoped_refptr
<SolidColorLayer
> blue
=
376 CreateSolidColorLayer(gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
377 target
->AddChild(blue
);
379 insert_copy_request_after_frame_count_
= 1;
380 RunReadbackTestWithReadbackTarget(
381 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
383 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
386 TEST_P(LayerTreeHostReadbackPixelTest
, ReadbackNonRootLayerOutsideViewport
) {
387 scoped_refptr
<SolidColorLayer
> background
=
388 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorWHITE
);
390 scoped_refptr
<SolidColorLayer
> green
=
391 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
392 // Only the top left quarter of the layer is inside the viewport, so the
393 // blue layer is entirely outside.
394 green
->SetPosition(gfx::Point(100, 100));
395 background
->AddChild(green
);
397 scoped_refptr
<SolidColorLayer
> blue
=
398 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
399 green
->AddChild(blue
);
401 RunReadbackTestWithReadbackTarget(
402 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
404 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")));
407 TEST_P(LayerTreeHostReadbackPixelTest
, ReadbackNonRootOrFirstLayer
) {
408 // This test has 3 render passes with the copy request on the render pass in
409 // the middle. This test caught an issue where copy requests on non-root
410 // non-first render passes were being treated differently from the first
412 scoped_refptr
<SolidColorLayer
> background
=
413 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
415 scoped_refptr
<SolidColorLayer
> blue
=
416 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
417 blue
->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
418 base::Bind(&IgnoreReadbackResult
)));
419 background
->AddChild(blue
);
421 RunReadbackTestWithReadbackTarget(
422 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
424 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")));
427 TEST_P(LayerTreeHostReadbackPixelTest
, MultipleReadbacksOnLayer
) {
428 // This test has 2 copy requests on the background layer. One is added in the
429 // test body, another is added in RunReadbackTestWithReadbackTarget. For every
430 // copy request after the first, state must be restored via a call to
431 // UseRenderPass (see http://crbug.com/99393). This test ensures that the
432 // renderer correctly handles cases where UseRenderPass is called multiple
433 // times for a single layer.
434 scoped_refptr
<SolidColorLayer
> background
=
435 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
437 background
->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
438 base::Bind(&IgnoreReadbackResult
)));
440 RunReadbackTestWithReadbackTarget(
441 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
442 background
.get(), base::FilePath(FILE_PATH_LITERAL("green.png")));
445 INSTANTIATE_TEST_CASE_P(
446 LayerTreeHostReadbackPixelTests
,
447 LayerTreeHostReadbackPixelTest
,
449 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_SOFTWARE
,
451 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL
,
453 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL
,
456 class LayerTreeHostReadbackDeviceScalePixelTest
457 : public LayerTreeHostReadbackPixelTest
{
459 LayerTreeHostReadbackDeviceScalePixelTest()
460 : device_scale_factor_(1.f
),
461 white_client_(SK_ColorWHITE
),
462 green_client_(SK_ColorGREEN
),
463 blue_client_(SK_ColorBLUE
) {}
465 void InitializeSettings(LayerTreeSettings
* settings
) override
{
466 // Cause the device scale factor to be inherited by contents scales.
467 settings
->layer_transforms_should_scale_layer_contents
= true;
470 void SetupTree() override
{
471 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_
);
472 LayerTreePixelTest::SetupTree();
475 void DrawLayersOnThread(LayerTreeHostImpl
* host_impl
) override
{
476 EXPECT_EQ(device_scale_factor_
,
477 host_impl
->active_tree()->device_scale_factor());
480 float device_scale_factor_
;
481 SolidColorContentLayerClient white_client_
;
482 SolidColorContentLayerClient green_client_
;
483 SolidColorContentLayerClient blue_client_
;
486 TEST_P(LayerTreeHostReadbackDeviceScalePixelTest
, ReadbackSubrect
) {
487 scoped_refptr
<FakePictureLayer
> background
=
488 FakePictureLayer::Create(layer_settings(), &white_client_
);
489 background
->SetBounds(gfx::Size(100, 100));
490 background
->SetIsDrawable(true);
492 scoped_refptr
<FakePictureLayer
> green
=
493 FakePictureLayer::Create(layer_settings(), &green_client_
);
494 green
->SetBounds(gfx::Size(100, 100));
495 green
->SetIsDrawable(true);
496 background
->AddChild(green
);
498 scoped_refptr
<FakePictureLayer
> blue
=
499 FakePictureLayer::Create(layer_settings(), &blue_client_
);
500 blue
->SetPosition(gfx::Point(50, 50));
501 blue
->SetBounds(gfx::Size(25, 25));
502 blue
->SetIsDrawable(true);
503 green
->AddChild(blue
);
505 // Grab the middle of the root layer.
506 copy_subrect_
= gfx::Rect(25, 25, 50, 50);
507 device_scale_factor_
= 2.f
;
509 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
510 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
513 TEST_P(LayerTreeHostReadbackDeviceScalePixelTest
, ReadbackNonRootLayerSubrect
) {
514 scoped_refptr
<FakePictureLayer
> background
=
515 FakePictureLayer::Create(layer_settings(), &white_client_
);
516 background
->SetBounds(gfx::Size(100, 100));
517 background
->SetIsDrawable(true);
519 scoped_refptr
<FakePictureLayer
> green
=
520 FakePictureLayer::Create(layer_settings(), &green_client_
);
521 green
->SetPosition(gfx::Point(10, 20));
522 green
->SetBounds(gfx::Size(90, 80));
523 green
->SetIsDrawable(true);
524 background
->AddChild(green
);
526 scoped_refptr
<FakePictureLayer
> blue
=
527 FakePictureLayer::Create(layer_settings(), &blue_client_
);
528 blue
->SetPosition(gfx::Point(50, 50));
529 blue
->SetBounds(gfx::Size(25, 25));
530 blue
->SetIsDrawable(true);
531 green
->AddChild(blue
);
533 // Grab the green layer's content with blue in the bottom right.
534 copy_subrect_
= gfx::Rect(25, 25, 50, 50);
535 device_scale_factor_
= 2.f
;
536 RunReadbackTestWithReadbackTarget(
537 GetParam().pixel_test_type
, GetParam().readback_type
, background
,
539 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
542 INSTANTIATE_TEST_CASE_P(
543 LayerTreeHostReadbackDeviceScalePixelTests
,
544 LayerTreeHostReadbackDeviceScalePixelTest
,
546 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_SOFTWARE
,
548 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL
,
550 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL
,