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 class LayerTreeHostReadbackPixelTest
: public LayerTreePixelTest
{
24 LayerTreeHostReadbackPixelTest()
25 : insert_copy_request_after_frame_count_(0) {}
27 virtual scoped_ptr
<CopyOutputRequest
> CreateCopyOutputRequest() OVERRIDE
{
28 scoped_ptr
<CopyOutputRequest
> request
;
32 case SOFTWARE_WITH_BITMAP
:
33 request
= CopyOutputRequest::CreateBitmapRequest(
34 base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsBitmap
,
35 base::Unretained(this)));
37 case SOFTWARE_WITH_DEFAULT
:
38 request
= CopyOutputRequest::CreateRequest(
39 base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsBitmap
,
40 base::Unretained(this)));
43 request
= CopyOutputRequest::CreateRequest(
44 base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsTexture
,
45 base::Unretained(this)));
49 if (!copy_subrect_
.IsEmpty())
50 request
->set_area(copy_subrect_
);
51 return request
.Pass();
54 virtual void BeginTest() OVERRIDE
{
55 if (insert_copy_request_after_frame_count_
== 0) {
57 readback_target_
? readback_target_
: layer_tree_host()->root_layer();
58 target
->RequestCopyOfOutput(CreateCopyOutputRequest().Pass());
60 PostSetNeedsCommitToMainThread();
63 virtual void DidCommitAndDrawFrame() OVERRIDE
{
64 if (insert_copy_request_after_frame_count_
==
65 layer_tree_host()->source_frame_number()) {
67 readback_target_
? readback_target_
: layer_tree_host()->root_layer();
68 target
->RequestCopyOfOutput(CreateCopyOutputRequest().Pass());
72 void ReadbackResultAsBitmap(scoped_ptr
<CopyOutputResult
> result
) {
73 EXPECT_TRUE(proxy()->IsMainThread());
74 EXPECT_TRUE(result
->HasBitmap());
75 result_bitmap_
= result
->TakeBitmap().Pass();
79 void ReadbackResultAsTexture(scoped_ptr
<CopyOutputResult
> result
) {
80 EXPECT_TRUE(proxy()->IsMainThread());
81 EXPECT_TRUE(result
->HasTexture());
83 TextureMailbox texture_mailbox
;
84 scoped_ptr
<SingleReleaseCallback
> release_callback
;
85 result
->TakeTexture(&texture_mailbox
, &release_callback
);
86 EXPECT_TRUE(texture_mailbox
.IsValid());
87 EXPECT_TRUE(texture_mailbox
.IsTexture());
89 scoped_ptr
<SkBitmap
> bitmap
=
90 CopyTextureMailboxToBitmap(result
->size(), texture_mailbox
);
91 release_callback
->Run(0, false);
93 ReadbackResultAsBitmap(CopyOutputResult::CreateBitmapResult(bitmap
.Pass()));
96 gfx::Rect copy_subrect_
;
97 int insert_copy_request_after_frame_count_
;
100 void IgnoreReadbackResult(scoped_ptr
<CopyOutputResult
> result
) {}
102 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackRootLayer_Software
) {
103 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
104 gfx::Rect(200, 200), SK_ColorWHITE
);
106 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
107 gfx::Rect(200, 200), SK_ColorGREEN
);
108 background
->AddChild(green
);
110 RunPixelTest(SOFTWARE_WITH_DEFAULT
,
112 base::FilePath(FILE_PATH_LITERAL(
116 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackRootLayer_Software_Bitmap
) {
117 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
118 gfx::Rect(200, 200), SK_ColorWHITE
);
120 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
121 gfx::Rect(200, 200), SK_ColorGREEN
);
122 background
->AddChild(green
);
124 RunPixelTest(SOFTWARE_WITH_BITMAP
,
126 base::FilePath(FILE_PATH_LITERAL(
130 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackRootLayer_GL_Bitmap
) {
131 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
132 gfx::Rect(200, 200), SK_ColorWHITE
);
134 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
135 gfx::Rect(200, 200), SK_ColorGREEN
);
136 background
->AddChild(green
);
138 RunPixelTest(GL_WITH_BITMAP
,
140 base::FilePath(FILE_PATH_LITERAL(
144 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackRootLayer_GL
) {
145 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
146 gfx::Rect(200, 200), SK_ColorWHITE
);
148 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
149 gfx::Rect(200, 200), SK_ColorGREEN
);
150 background
->AddChild(green
);
152 RunPixelTest(GL_WITH_DEFAULT
,
154 base::FilePath(FILE_PATH_LITERAL(
158 TEST_F(LayerTreeHostReadbackPixelTest
,
159 ReadbackRootLayerWithChild_Software
) {
160 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
161 gfx::Rect(200, 200), SK_ColorWHITE
);
163 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
164 gfx::Rect(200, 200), SK_ColorGREEN
);
165 background
->AddChild(green
);
167 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
168 gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
169 green
->AddChild(blue
);
171 RunPixelTest(SOFTWARE_WITH_DEFAULT
,
173 base::FilePath(FILE_PATH_LITERAL(
174 "green_with_blue_corner.png")));
177 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackRootLayerWithChild_GL_Bitmap
) {
178 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
179 gfx::Rect(200, 200), SK_ColorWHITE
);
181 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
182 gfx::Rect(200, 200), SK_ColorGREEN
);
183 background
->AddChild(green
);
185 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
186 gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
187 green
->AddChild(blue
);
189 RunPixelTest(GL_WITH_BITMAP
,
191 base::FilePath(FILE_PATH_LITERAL(
192 "green_with_blue_corner.png")));
195 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackRootLayerWithChild_GL
) {
196 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
197 gfx::Rect(200, 200), SK_ColorWHITE
);
199 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
200 gfx::Rect(200, 200), SK_ColorGREEN
);
201 background
->AddChild(green
);
203 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
204 gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
205 green
->AddChild(blue
);
207 RunPixelTest(GL_WITH_DEFAULT
,
209 base::FilePath(FILE_PATH_LITERAL(
210 "green_with_blue_corner.png")));
213 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackNonRootLayer_Software
) {
214 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
215 gfx::Rect(200, 200), SK_ColorWHITE
);
217 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
218 gfx::Rect(200, 200), SK_ColorGREEN
);
219 background
->AddChild(green
);
221 RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT
,
224 base::FilePath(FILE_PATH_LITERAL(
228 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackNonRootLayer_GL_Bitmap
) {
229 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
230 gfx::Rect(200, 200), SK_ColorWHITE
);
232 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
233 gfx::Rect(200, 200), SK_ColorGREEN
);
234 background
->AddChild(green
);
236 RunPixelTestWithReadbackTarget(GL_WITH_BITMAP
,
239 base::FilePath(FILE_PATH_LITERAL(
243 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackNonRootLayer_GL
) {
244 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
245 gfx::Rect(200, 200), SK_ColorWHITE
);
247 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
248 gfx::Rect(200, 200), SK_ColorGREEN
);
249 background
->AddChild(green
);
251 RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT
,
254 base::FilePath(FILE_PATH_LITERAL(
258 TEST_F(LayerTreeHostReadbackPixelTest
,
259 ReadbackSmallNonRootLayer_Software
) {
260 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
261 gfx::Rect(200, 200), SK_ColorWHITE
);
263 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
264 gfx::Rect(100, 100, 100, 100), SK_ColorGREEN
);
265 background
->AddChild(green
);
267 RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT
,
270 base::FilePath(FILE_PATH_LITERAL(
271 "green_small.png")));
274 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackSmallNonRootLayer_GL_Bitmap
) {
275 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
276 gfx::Rect(200, 200), SK_ColorWHITE
);
278 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
279 gfx::Rect(100, 100, 100, 100), SK_ColorGREEN
);
280 background
->AddChild(green
);
282 RunPixelTestWithReadbackTarget(GL_WITH_BITMAP
,
285 base::FilePath(FILE_PATH_LITERAL(
286 "green_small.png")));
289 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackSmallNonRootLayer_GL
) {
290 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
291 gfx::Rect(200, 200), SK_ColorWHITE
);
293 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
294 gfx::Rect(100, 100, 100, 100), SK_ColorGREEN
);
295 background
->AddChild(green
);
297 RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT
,
300 base::FilePath(FILE_PATH_LITERAL(
301 "green_small.png")));
304 TEST_F(LayerTreeHostReadbackPixelTest
,
305 ReadbackSmallNonRootLayerWithChild_Software
) {
306 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
307 gfx::Rect(200, 200), SK_ColorWHITE
);
309 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
310 gfx::Rect(100, 100, 100, 100), SK_ColorGREEN
);
311 background
->AddChild(green
);
313 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
314 gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
315 green
->AddChild(blue
);
317 RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT
,
320 base::FilePath(FILE_PATH_LITERAL(
321 "green_small_with_blue_corner.png")));
324 TEST_F(LayerTreeHostReadbackPixelTest
,
325 ReadbackSmallNonRootLayerWithChild_GL_Bitmap
) {
326 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
327 gfx::Rect(200, 200), SK_ColorWHITE
);
329 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
330 gfx::Rect(100, 100, 100, 100), SK_ColorGREEN
);
331 background
->AddChild(green
);
333 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
334 gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
335 green
->AddChild(blue
);
337 RunPixelTestWithReadbackTarget(GL_WITH_BITMAP
,
340 base::FilePath(FILE_PATH_LITERAL(
341 "green_small_with_blue_corner.png")));
344 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackSmallNonRootLayerWithChild_GL
) {
345 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
346 gfx::Rect(200, 200), SK_ColorWHITE
);
348 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
349 gfx::Rect(100, 100, 100, 100), SK_ColorGREEN
);
350 background
->AddChild(green
);
352 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
353 gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
354 green
->AddChild(blue
);
356 RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT
,
359 base::FilePath(FILE_PATH_LITERAL(
360 "green_small_with_blue_corner.png")));
363 TEST_F(LayerTreeHostReadbackPixelTest
,
364 ReadbackSubtreeSurroundsTargetLayer_Software
) {
365 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
366 gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
368 scoped_refptr
<SolidColorLayer
> target
= CreateSolidColorLayer(
369 gfx::Rect(100, 100, 100, 100), SK_ColorRED
);
370 background
->AddChild(target
);
372 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
373 gfx::Rect(-100, -100, 300, 300), SK_ColorGREEN
);
374 target
->AddChild(green
);
376 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
377 gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
378 target
->AddChild(blue
);
380 copy_subrect_
= gfx::Rect(0, 0, 100, 100);
381 RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT
,
384 base::FilePath(FILE_PATH_LITERAL(
385 "green_small_with_blue_corner.png")));
388 TEST_F(LayerTreeHostReadbackPixelTest
,
389 ReadbackSubtreeSurroundsLayer_GL_Bitmap
) {
390 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
391 gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
393 scoped_refptr
<SolidColorLayer
> target
= CreateSolidColorLayer(
394 gfx::Rect(100, 100, 100, 100), SK_ColorRED
);
395 background
->AddChild(target
);
397 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
398 gfx::Rect(-100, -100, 300, 300), SK_ColorGREEN
);
399 target
->AddChild(green
);
401 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
402 gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
403 target
->AddChild(blue
);
405 copy_subrect_
= gfx::Rect(0, 0, 100, 100);
406 RunPixelTestWithReadbackTarget(GL_WITH_BITMAP
,
409 base::FilePath(FILE_PATH_LITERAL(
410 "green_small_with_blue_corner.png")));
413 TEST_F(LayerTreeHostReadbackPixelTest
,
414 ReadbackSubtreeSurroundsTargetLayer_GL
) {
415 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
416 gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
418 scoped_refptr
<SolidColorLayer
> target
= CreateSolidColorLayer(
419 gfx::Rect(100, 100, 100, 100), SK_ColorRED
);
420 background
->AddChild(target
);
422 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
423 gfx::Rect(-100, -100, 300, 300), SK_ColorGREEN
);
424 target
->AddChild(green
);
426 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
427 gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
428 target
->AddChild(blue
);
430 copy_subrect_
= gfx::Rect(0, 0, 100, 100);
431 RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT
,
434 base::FilePath(FILE_PATH_LITERAL(
435 "green_small_with_blue_corner.png")));
438 TEST_F(LayerTreeHostReadbackPixelTest
,
439 ReadbackSubtreeExtendsBeyondTargetLayer_Software
) {
440 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
441 gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
443 scoped_refptr
<SolidColorLayer
> target
= CreateSolidColorLayer(
444 gfx::Rect(50, 50, 150, 150), SK_ColorRED
);
445 background
->AddChild(target
);
447 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
448 gfx::Rect(50, 50, 200, 200), SK_ColorGREEN
);
449 target
->AddChild(green
);
451 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
452 gfx::Rect(100, 100, 50, 50), SK_ColorBLUE
);
453 target
->AddChild(blue
);
455 copy_subrect_
= gfx::Rect(50, 50, 100, 100);
456 RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT
,
459 base::FilePath(FILE_PATH_LITERAL(
460 "green_small_with_blue_corner.png")));
463 TEST_F(LayerTreeHostReadbackPixelTest
,
464 ReadbackSubtreeExtendsBeyondTargetLayer_GL_Bitmap
) {
465 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
466 gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
468 scoped_refptr
<SolidColorLayer
> target
= CreateSolidColorLayer(
469 gfx::Rect(50, 50, 150, 150), SK_ColorRED
);
470 background
->AddChild(target
);
472 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
473 gfx::Rect(50, 50, 200, 200), SK_ColorGREEN
);
474 target
->AddChild(green
);
476 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
477 gfx::Rect(100, 100, 50, 50), SK_ColorBLUE
);
478 target
->AddChild(blue
);
480 copy_subrect_
= gfx::Rect(50, 50, 100, 100);
481 RunPixelTestWithReadbackTarget(GL_WITH_BITMAP
,
484 base::FilePath(FILE_PATH_LITERAL(
485 "green_small_with_blue_corner.png")));
488 TEST_F(LayerTreeHostReadbackPixelTest
,
489 ReadbackSubtreeExtendsBeyondTargetLayer_GL
) {
490 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
491 gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
493 scoped_refptr
<SolidColorLayer
> target
= CreateSolidColorLayer(
494 gfx::Rect(50, 50, 150, 150), SK_ColorRED
);
495 background
->AddChild(target
);
497 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
498 gfx::Rect(50, 50, 200, 200), SK_ColorGREEN
);
499 target
->AddChild(green
);
501 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
502 gfx::Rect(100, 100, 50, 50), SK_ColorBLUE
);
503 target
->AddChild(blue
);
505 copy_subrect_
= gfx::Rect(50, 50, 100, 100);
506 RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT
,
509 base::FilePath(FILE_PATH_LITERAL(
510 "green_small_with_blue_corner.png")));
513 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackHiddenSubtree_Software
) {
514 scoped_refptr
<SolidColorLayer
> background
=
515 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorBLACK
);
517 scoped_refptr
<SolidColorLayer
> hidden_target
=
518 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
519 hidden_target
->SetHideLayerAndSubtree(true);
520 background
->AddChild(hidden_target
);
522 scoped_refptr
<SolidColorLayer
> blue
=
523 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
524 hidden_target
->AddChild(blue
);
526 RunPixelTestWithReadbackTarget(
527 SOFTWARE_WITH_DEFAULT
,
530 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")));
533 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackHiddenSubtree_GL_Bitmap
) {
534 scoped_refptr
<SolidColorLayer
> background
=
535 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorBLACK
);
537 scoped_refptr
<SolidColorLayer
> hidden_target
=
538 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
539 hidden_target
->SetHideLayerAndSubtree(true);
540 background
->AddChild(hidden_target
);
542 scoped_refptr
<SolidColorLayer
> blue
=
543 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
544 hidden_target
->AddChild(blue
);
546 RunPixelTestWithReadbackTarget(
550 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")));
553 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackHiddenSubtree_GL
) {
554 scoped_refptr
<SolidColorLayer
> background
=
555 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorBLACK
);
557 scoped_refptr
<SolidColorLayer
> hidden_target
=
558 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
559 hidden_target
->SetHideLayerAndSubtree(true);
560 background
->AddChild(hidden_target
);
562 scoped_refptr
<SolidColorLayer
> blue
=
563 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
564 hidden_target
->AddChild(blue
);
566 RunPixelTestWithReadbackTarget(
570 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png")));
573 TEST_F(LayerTreeHostReadbackPixelTest
,
574 HiddenSubtreeNotVisibleWhenDrawnForReadback_Software
) {
575 scoped_refptr
<SolidColorLayer
> background
=
576 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorBLACK
);
578 scoped_refptr
<SolidColorLayer
> hidden_target
=
579 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
580 hidden_target
->SetHideLayerAndSubtree(true);
581 background
->AddChild(hidden_target
);
583 scoped_refptr
<SolidColorLayer
> blue
=
584 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
585 hidden_target
->AddChild(blue
);
587 hidden_target
->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
588 base::Bind(&IgnoreReadbackResult
)));
589 RunPixelTest(SOFTWARE_WITH_DEFAULT
,
591 base::FilePath(FILE_PATH_LITERAL("black.png")));
594 TEST_F(LayerTreeHostReadbackPixelTest
,
595 HiddenSubtreeNotVisibleWhenDrawnForReadback_GL_Bitmap
) {
596 scoped_refptr
<SolidColorLayer
> background
=
597 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorBLACK
);
599 scoped_refptr
<SolidColorLayer
> hidden_target
=
600 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
601 hidden_target
->SetHideLayerAndSubtree(true);
602 background
->AddChild(hidden_target
);
604 scoped_refptr
<SolidColorLayer
> blue
=
605 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
606 hidden_target
->AddChild(blue
);
608 hidden_target
->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
609 base::Bind(&IgnoreReadbackResult
)));
610 RunPixelTest(GL_WITH_BITMAP
,
612 base::FilePath(FILE_PATH_LITERAL("black.png")));
615 TEST_F(LayerTreeHostReadbackPixelTest
,
616 HiddenSubtreeNotVisibleWhenDrawnForReadback_GL
) {
617 scoped_refptr
<SolidColorLayer
> background
=
618 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorBLACK
);
620 scoped_refptr
<SolidColorLayer
> hidden_target
=
621 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN
);
622 hidden_target
->SetHideLayerAndSubtree(true);
623 background
->AddChild(hidden_target
);
625 scoped_refptr
<SolidColorLayer
> blue
=
626 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
627 hidden_target
->AddChild(blue
);
629 hidden_target
->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
630 base::Bind(&IgnoreReadbackResult
)));
631 RunPixelTest(GL_WITH_DEFAULT
,
633 base::FilePath(FILE_PATH_LITERAL("black.png")));
636 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackSubrect_Software
) {
637 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
638 gfx::Rect(200, 200), SK_ColorWHITE
);
640 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
641 gfx::Rect(200, 200), SK_ColorGREEN
);
642 background
->AddChild(green
);
644 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
645 gfx::Rect(100, 100, 50, 50), SK_ColorBLUE
);
646 green
->AddChild(blue
);
648 // Grab the middle of the root layer.
649 copy_subrect_
= gfx::Rect(50, 50, 100, 100);
651 RunPixelTest(SOFTWARE_WITH_DEFAULT
,
653 base::FilePath(FILE_PATH_LITERAL(
654 "green_small_with_blue_corner.png")));
657 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackSubrect_GL_Bitmap
) {
658 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
659 gfx::Rect(200, 200), SK_ColorWHITE
);
661 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
662 gfx::Rect(200, 200), SK_ColorGREEN
);
663 background
->AddChild(green
);
665 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
666 gfx::Rect(100, 100, 50, 50), SK_ColorBLUE
);
667 green
->AddChild(blue
);
669 // Grab the middle of the root layer.
670 copy_subrect_
= gfx::Rect(50, 50, 100, 100);
672 RunPixelTest(GL_WITH_BITMAP
,
674 base::FilePath(FILE_PATH_LITERAL(
675 "green_small_with_blue_corner.png")));
678 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackSubrect_GL
) {
679 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
680 gfx::Rect(200, 200), SK_ColorWHITE
);
682 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
683 gfx::Rect(200, 200), SK_ColorGREEN
);
684 background
->AddChild(green
);
686 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
687 gfx::Rect(100, 100, 50, 50), SK_ColorBLUE
);
688 green
->AddChild(blue
);
690 // Grab the middle of the root layer.
691 copy_subrect_
= gfx::Rect(50, 50, 100, 100);
693 RunPixelTest(GL_WITH_DEFAULT
,
695 base::FilePath(FILE_PATH_LITERAL(
696 "green_small_with_blue_corner.png")));
699 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackNonRootLayerSubrect_Software
) {
700 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
701 gfx::Rect(200, 200), SK_ColorWHITE
);
703 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
704 gfx::Rect(25, 25, 150, 150), SK_ColorGREEN
);
705 background
->AddChild(green
);
707 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
708 gfx::Rect(75, 75, 50, 50), SK_ColorBLUE
);
709 green
->AddChild(blue
);
711 // Grab the middle of the green layer.
712 copy_subrect_
= gfx::Rect(25, 25, 100, 100);
714 RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT
,
717 base::FilePath(FILE_PATH_LITERAL(
718 "green_small_with_blue_corner.png")));
721 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackNonRootLayerSubrect_GL_Bitmap
) {
722 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
723 gfx::Rect(200, 200), SK_ColorWHITE
);
725 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
726 gfx::Rect(25, 25, 150, 150), SK_ColorGREEN
);
727 background
->AddChild(green
);
729 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
730 gfx::Rect(75, 75, 50, 50), SK_ColorBLUE
);
731 green
->AddChild(blue
);
733 // Grab the middle of the green layer.
734 copy_subrect_
= gfx::Rect(25, 25, 100, 100);
736 RunPixelTestWithReadbackTarget(GL_WITH_BITMAP
,
739 base::FilePath(FILE_PATH_LITERAL(
740 "green_small_with_blue_corner.png")));
743 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackNonRootLayerSubrect_GL
) {
744 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
745 gfx::Rect(200, 200), SK_ColorWHITE
);
747 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
748 gfx::Rect(25, 25, 150, 150), SK_ColorGREEN
);
749 background
->AddChild(green
);
751 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
752 gfx::Rect(75, 75, 50, 50), SK_ColorBLUE
);
753 green
->AddChild(blue
);
755 // Grab the middle of the green layer.
756 copy_subrect_
= gfx::Rect(25, 25, 100, 100);
758 RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT
,
761 base::FilePath(FILE_PATH_LITERAL(
762 "green_small_with_blue_corner.png")));
765 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackWhenNoDamage_Software
) {
766 scoped_refptr
<SolidColorLayer
> background
=
767 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
769 scoped_refptr
<SolidColorLayer
> parent
=
770 CreateSolidColorLayer(gfx::Rect(0, 0, 150, 150), SK_ColorRED
);
771 background
->AddChild(parent
);
773 scoped_refptr
<SolidColorLayer
> target
=
774 CreateSolidColorLayer(gfx::Rect(0, 0, 100, 100), SK_ColorGREEN
);
775 parent
->AddChild(target
);
777 scoped_refptr
<SolidColorLayer
> blue
=
778 CreateSolidColorLayer(gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
779 target
->AddChild(blue
);
781 insert_copy_request_after_frame_count_
= 1;
782 RunPixelTestWithReadbackTarget(
783 SOFTWARE_WITH_DEFAULT
,
786 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
789 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackWhenNoDamage_GL_Bitmap
) {
790 scoped_refptr
<SolidColorLayer
> background
=
791 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
793 scoped_refptr
<SolidColorLayer
> parent
=
794 CreateSolidColorLayer(gfx::Rect(0, 0, 150, 150), SK_ColorRED
);
795 background
->AddChild(parent
);
797 scoped_refptr
<SolidColorLayer
> target
=
798 CreateSolidColorLayer(gfx::Rect(0, 0, 100, 100), SK_ColorGREEN
);
799 parent
->AddChild(target
);
801 scoped_refptr
<SolidColorLayer
> blue
=
802 CreateSolidColorLayer(gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
803 target
->AddChild(blue
);
805 insert_copy_request_after_frame_count_
= 1;
806 RunPixelTestWithReadbackTarget(
810 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
813 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackWhenNoDamage_GL
) {
814 scoped_refptr
<SolidColorLayer
> background
=
815 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
817 scoped_refptr
<SolidColorLayer
> parent
=
818 CreateSolidColorLayer(gfx::Rect(0, 0, 150, 150), SK_ColorRED
);
819 background
->AddChild(parent
);
821 scoped_refptr
<SolidColorLayer
> target
=
822 CreateSolidColorLayer(gfx::Rect(0, 0, 100, 100), SK_ColorGREEN
);
823 parent
->AddChild(target
);
825 scoped_refptr
<SolidColorLayer
> blue
=
826 CreateSolidColorLayer(gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
827 target
->AddChild(blue
);
829 insert_copy_request_after_frame_count_
= 1;
830 RunPixelTestWithReadbackTarget(
834 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
837 TEST_F(LayerTreeHostReadbackPixelTest
,
838 ReadbackOutsideViewportWhenNoDamage_Software
) {
839 scoped_refptr
<SolidColorLayer
> background
=
840 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
842 scoped_refptr
<SolidColorLayer
> parent
=
843 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorRED
);
844 EXPECT_FALSE(parent
->masks_to_bounds());
845 background
->AddChild(parent
);
847 scoped_refptr
<SolidColorLayer
> target
=
848 CreateSolidColorLayer(gfx::Rect(250, 250, 100, 100), SK_ColorGREEN
);
849 parent
->AddChild(target
);
851 scoped_refptr
<SolidColorLayer
> blue
=
852 CreateSolidColorLayer(gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
853 target
->AddChild(blue
);
855 insert_copy_request_after_frame_count_
= 1;
856 RunPixelTestWithReadbackTarget(
857 SOFTWARE_WITH_DEFAULT
,
860 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
863 TEST_F(LayerTreeHostReadbackPixelTest
,
864 ReadbackOutsideViewportWhenNoDamage_GL_Bitmap
) {
865 scoped_refptr
<SolidColorLayer
> background
=
866 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
868 scoped_refptr
<SolidColorLayer
> parent
=
869 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorRED
);
870 EXPECT_FALSE(parent
->masks_to_bounds());
871 background
->AddChild(parent
);
873 scoped_refptr
<SolidColorLayer
> target
=
874 CreateSolidColorLayer(gfx::Rect(250, 250, 100, 100), SK_ColorGREEN
);
875 parent
->AddChild(target
);
877 scoped_refptr
<SolidColorLayer
> blue
=
878 CreateSolidColorLayer(gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
879 target
->AddChild(blue
);
881 insert_copy_request_after_frame_count_
= 1;
882 RunPixelTestWithReadbackTarget(
886 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
889 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackOutsideViewportWhenNoDamage_GL
) {
890 scoped_refptr
<SolidColorLayer
> background
=
891 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorWHITE
);
893 scoped_refptr
<SolidColorLayer
> parent
=
894 CreateSolidColorLayer(gfx::Rect(0, 0, 200, 200), SK_ColorRED
);
895 EXPECT_FALSE(parent
->masks_to_bounds());
896 background
->AddChild(parent
);
898 scoped_refptr
<SolidColorLayer
> target
=
899 CreateSolidColorLayer(gfx::Rect(250, 250, 100, 100), SK_ColorGREEN
);
900 parent
->AddChild(target
);
902 scoped_refptr
<SolidColorLayer
> blue
=
903 CreateSolidColorLayer(gfx::Rect(50, 50, 50, 50), SK_ColorBLUE
);
904 target
->AddChild(blue
);
906 insert_copy_request_after_frame_count_
= 1;
907 RunPixelTestWithReadbackTarget(
911 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png")));
914 class LayerTreeHostReadbackDeviceScalePixelTest
915 : public LayerTreeHostReadbackPixelTest
{
917 LayerTreeHostReadbackDeviceScalePixelTest()
918 : device_scale_factor_(1.f
),
919 white_client_(SK_ColorWHITE
),
920 green_client_(SK_ColorGREEN
),
921 blue_client_(SK_ColorBLUE
) {}
923 virtual void InitializeSettings(LayerTreeSettings
* settings
) OVERRIDE
{
924 // Cause the device scale factor to be inherited by contents scales.
925 settings
->layer_transforms_should_scale_layer_contents
= true;
928 virtual void SetupTree() OVERRIDE
{
929 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_
);
930 LayerTreePixelTest::SetupTree();
933 virtual void DrawLayersOnThread(LayerTreeHostImpl
* host_impl
) OVERRIDE
{
934 LayerImpl
* root_impl
= host_impl
->active_tree()->root_layer();
936 FakePictureLayerImpl
* background_impl
=
937 static_cast<FakePictureLayerImpl
*>(root_impl
->children()[0]);
938 EXPECT_EQ(device_scale_factor_
,
939 background_impl
->HighResTiling()->contents_scale());
941 FakePictureLayerImpl
* green_impl
=
942 static_cast<FakePictureLayerImpl
*>(background_impl
->children()[0]);
943 EXPECT_EQ(device_scale_factor_
,
944 green_impl
->HighResTiling()->contents_scale());
946 FakePictureLayerImpl
* blue_impl
=
947 static_cast<FakePictureLayerImpl
*>(green_impl
->children()[0]);
948 EXPECT_EQ(device_scale_factor_
,
949 blue_impl
->HighResTiling()->contents_scale());
952 float device_scale_factor_
;
953 SolidColorContentLayerClient white_client_
;
954 SolidColorContentLayerClient green_client_
;
955 SolidColorContentLayerClient blue_client_
;
958 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest
,
959 ReadbackSubrect_Software
) {
960 scoped_refptr
<FakePictureLayer
> background
=
961 FakePictureLayer::Create(&white_client_
);
962 background
->SetBounds(gfx::Size(100, 100));
963 background
->SetIsDrawable(true);
965 scoped_refptr
<FakePictureLayer
> green
=
966 FakePictureLayer::Create(&green_client_
);
967 green
->SetBounds(gfx::Size(100, 100));
968 green
->SetIsDrawable(true);
969 background
->AddChild(green
);
971 scoped_refptr
<FakePictureLayer
> blue
=
972 FakePictureLayer::Create(&blue_client_
);
973 blue
->SetPosition(gfx::Point(50, 50));
974 blue
->SetBounds(gfx::Size(25, 25));
975 blue
->SetIsDrawable(true);
976 green
->AddChild(blue
);
978 // Grab the middle of the root layer.
979 copy_subrect_
= gfx::Rect(25, 25, 50, 50);
980 device_scale_factor_
= 2.f
;
981 RunPixelTest(SOFTWARE_WITH_DEFAULT
,
983 base::FilePath(FILE_PATH_LITERAL(
984 "green_small_with_blue_corner.png")));
987 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest
,
988 ReadbackSubrect_GL
) {
989 scoped_refptr
<FakePictureLayer
> background
=
990 FakePictureLayer::Create(&white_client_
);
991 background
->SetBounds(gfx::Size(100, 100));
992 background
->SetIsDrawable(true);
994 scoped_refptr
<FakePictureLayer
> green
=
995 FakePictureLayer::Create(&green_client_
);
996 green
->SetBounds(gfx::Size(100, 100));
997 green
->SetIsDrawable(true);
998 background
->AddChild(green
);
1000 scoped_refptr
<FakePictureLayer
> blue
=
1001 FakePictureLayer::Create(&blue_client_
);
1002 blue
->SetPosition(gfx::Point(50, 50));
1003 blue
->SetBounds(gfx::Size(25, 25));
1004 blue
->SetIsDrawable(true);
1005 green
->AddChild(blue
);
1007 // Grab the middle of the root layer.
1008 copy_subrect_
= gfx::Rect(25, 25, 50, 50);
1009 device_scale_factor_
= 2.f
;
1010 RunPixelTest(GL_WITH_DEFAULT
,
1012 base::FilePath(FILE_PATH_LITERAL(
1013 "green_small_with_blue_corner.png")));
1016 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest
,
1017 ReadbackNonRootLayerSubrect_Software
) {
1018 scoped_refptr
<FakePictureLayer
> background
=
1019 FakePictureLayer::Create(&white_client_
);
1020 background
->SetBounds(gfx::Size(100, 100));
1021 background
->SetIsDrawable(true);
1023 scoped_refptr
<FakePictureLayer
> green
=
1024 FakePictureLayer::Create(&green_client_
);
1025 green
->SetPosition(gfx::Point(10, 20));
1026 green
->SetBounds(gfx::Size(90, 80));
1027 green
->SetIsDrawable(true);
1028 background
->AddChild(green
);
1030 scoped_refptr
<FakePictureLayer
> blue
=
1031 FakePictureLayer::Create(&blue_client_
);
1032 blue
->SetPosition(gfx::Point(50, 50));
1033 blue
->SetBounds(gfx::Size(25, 25));
1034 blue
->SetIsDrawable(true);
1035 green
->AddChild(blue
);
1037 // Grab the green layer's content with blue in the bottom right.
1038 copy_subrect_
= gfx::Rect(25, 25, 50, 50);
1039 device_scale_factor_
= 2.f
;
1040 RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT
,
1043 base::FilePath(FILE_PATH_LITERAL(
1044 "green_small_with_blue_corner.png")));
1047 TEST_F(LayerTreeHostReadbackDeviceScalePixelTest
,
1048 ReadbackNonRootLayerSubrect_GL
) {
1049 scoped_refptr
<FakePictureLayer
> background
=
1050 FakePictureLayer::Create(&white_client_
);
1051 background
->SetBounds(gfx::Size(100, 100));
1052 background
->SetIsDrawable(true);
1054 scoped_refptr
<FakePictureLayer
> green
=
1055 FakePictureLayer::Create(&green_client_
);
1056 green
->SetPosition(gfx::Point(10, 20));
1057 green
->SetBounds(gfx::Size(90, 80));
1058 green
->SetIsDrawable(true);
1059 background
->AddChild(green
);
1061 scoped_refptr
<FakePictureLayer
> blue
=
1062 FakePictureLayer::Create(&blue_client_
);
1063 blue
->SetPosition(gfx::Point(50, 50));
1064 blue
->SetBounds(gfx::Size(25, 25));
1065 blue
->SetIsDrawable(true);
1066 green
->AddChild(blue
);
1068 // Grab the green layer's content with blue in the bottom right.
1069 copy_subrect_
= gfx::Rect(25, 25, 50, 50);
1070 device_scale_factor_
= 2.f
;
1071 RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT
,
1074 base::FilePath(FILE_PATH_LITERAL(
1075 "green_small_with_blue_corner.png")));
1078 TEST_F(LayerTreeHostReadbackPixelTest
, ReadbackNonRootLayerOutsideViewport
) {
1079 scoped_refptr
<SolidColorLayer
> background
= CreateSolidColorLayer(
1080 gfx::Rect(200, 200), SK_ColorWHITE
);
1082 scoped_refptr
<SolidColorLayer
> green
= CreateSolidColorLayer(
1083 gfx::Rect(200, 200), SK_ColorGREEN
);
1084 // Only the top left quarter of the layer is inside the viewport, so the
1085 // blue layer is entirely outside.
1086 green
->SetPosition(gfx::Point(100, 100));
1087 background
->AddChild(green
);
1089 scoped_refptr
<SolidColorLayer
> blue
= CreateSolidColorLayer(
1090 gfx::Rect(150, 150, 50, 50), SK_ColorBLUE
);
1091 green
->AddChild(blue
);
1093 RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT
,
1096 base::FilePath(FILE_PATH_LITERAL(
1097 "green_with_blue_corner.png")));
1103 #endif // OS_ANDROID