Index: cc/trees/layer_tree_host_pixeltest_readback.cc |
diff --git a/cc/trees/layer_tree_host_pixeltest_readback.cc b/cc/trees/layer_tree_host_pixeltest_readback.cc |
index 0924119783118e8e76647f7e75a8c7ee2d490368..25b51b827a2f744192ee9e52c0224b2a5ad257c2 100644 |
--- a/cc/trees/layer_tree_host_pixeltest_readback.cc |
+++ b/cc/trees/layer_tree_host_pixeltest_readback.cc |
@@ -15,22 +15,26 @@ namespace { |
class LayerTreeHostReadbackPixelTest : public LayerTreePixelTest { |
protected: |
- LayerTreeHostReadbackPixelTest() : force_readback_as_bitmap_(false) {} |
- |
virtual scoped_ptr<CopyOutputRequest> CreateCopyOutputRequest() OVERRIDE { |
scoped_ptr<CopyOutputRequest> request; |
- if (force_readback_as_bitmap_) { |
- request = CopyOutputRequest::CreateBitmapRequest( |
- base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsBitmap, |
- base::Unretained(this))); |
- } else if (!use_gl_) { |
- request = CopyOutputRequest::CreateRequest( |
- base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsBitmap, |
- base::Unretained(this))); |
- } else { |
- request = CopyOutputRequest::CreateRequest( |
- base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsTexture, |
- base::Unretained(this))); |
+ |
+ switch (test_type_) { |
+ case GL_WITH_BITMAP: |
+ case SOFTWARE_WITH_BITMAP: |
+ request = CopyOutputRequest::CreateBitmapRequest( |
+ base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsBitmap, |
+ base::Unretained(this))); |
+ break; |
+ case SOFTWARE_WITH_DEFAULT: |
+ request = CopyOutputRequest::CreateRequest( |
+ base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsBitmap, |
+ base::Unretained(this))); |
+ break; |
+ case GL_WITH_DEFAULT: |
+ request = CopyOutputRequest::CreateRequest( |
+ base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsTexture, |
+ base::Unretained(this))); |
+ break; |
} |
if (!copy_subrect_.IsEmpty()) |
@@ -58,14 +62,10 @@ class LayerTreeHostReadbackPixelTest : public LayerTreePixelTest { |
texture_mailbox->RunReleaseCallback(0, false); |
} |
- bool force_readback_as_bitmap_; |
gfx::Rect copy_subrect_; |
}; |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayer_Software) { |
- use_gl_ = false; |
- force_readback_as_bitmap_ = false; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -73,15 +73,13 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayer_Software) { |
gfx::Rect(200, 200), SK_ColorGREEN); |
background->AddChild(green); |
- RunPixelTest(background, |
+ RunPixelTest(SOFTWARE_WITH_DEFAULT, |
+ background, |
base::FilePath(FILE_PATH_LITERAL( |
"green.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayer_Software_Bitmap) { |
- use_gl_ = false; |
- force_readback_as_bitmap_ = true; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -89,15 +87,13 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayer_Software_Bitmap) { |
gfx::Rect(200, 200), SK_ColorGREEN); |
background->AddChild(green); |
- RunPixelTest(background, |
+ RunPixelTest(SOFTWARE_WITH_BITMAP, |
+ background, |
base::FilePath(FILE_PATH_LITERAL( |
"green.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayer_GL_Bitmap) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = true; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -105,15 +101,13 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayer_GL_Bitmap) { |
gfx::Rect(200, 200), SK_ColorGREEN); |
background->AddChild(green); |
- RunPixelTest(background, |
+ RunPixelTest(GL_WITH_BITMAP, |
+ background, |
base::FilePath(FILE_PATH_LITERAL( |
"green.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayer_GL) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = false; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -121,16 +115,14 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayer_GL) { |
gfx::Rect(200, 200), SK_ColorGREEN); |
background->AddChild(green); |
- RunPixelTest(background, |
+ RunPixelTest(GL_WITH_DEFAULT, |
+ background, |
base::FilePath(FILE_PATH_LITERAL( |
"green.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, |
ReadbackRootLayerWithChild_Software) { |
- use_gl_ = false; |
- force_readback_as_bitmap_ = false; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -142,15 +134,13 @@ TEST_F(LayerTreeHostReadbackPixelTest, |
gfx::Rect(150, 150, 50, 50), SK_ColorBLUE); |
green->AddChild(blue); |
- RunPixelTest(background, |
+ RunPixelTest(SOFTWARE_WITH_DEFAULT, |
+ background, |
base::FilePath(FILE_PATH_LITERAL( |
"green_with_blue_corner.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayerWithChild_GL_Bitmap) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = true; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -162,15 +152,13 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayerWithChild_GL_Bitmap) { |
gfx::Rect(150, 150, 50, 50), SK_ColorBLUE); |
green->AddChild(blue); |
- RunPixelTest(background, |
+ RunPixelTest(GL_WITH_BITMAP, |
+ background, |
base::FilePath(FILE_PATH_LITERAL( |
"green_with_blue_corner.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayerWithChild_GL) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = false; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -182,15 +170,13 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayerWithChild_GL) { |
gfx::Rect(150, 150, 50, 50), SK_ColorBLUE); |
green->AddChild(blue); |
- RunPixelTest(background, |
+ RunPixelTest(GL_WITH_DEFAULT, |
+ background, |
base::FilePath(FILE_PATH_LITERAL( |
"green_with_blue_corner.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayer_Software) { |
- use_gl_ = false; |
- force_readback_as_bitmap_ = false; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -198,16 +184,14 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayer_Software) { |
gfx::Rect(200, 200), SK_ColorGREEN); |
background->AddChild(green); |
- RunPixelTestWithReadbackTarget(background, |
+ RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT, |
+ background, |
green.get(), |
base::FilePath(FILE_PATH_LITERAL( |
"green.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayer_GL_Bitmap) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = true; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -215,16 +199,14 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayer_GL_Bitmap) { |
gfx::Rect(200, 200), SK_ColorGREEN); |
background->AddChild(green); |
- RunPixelTestWithReadbackTarget(background, |
+ RunPixelTestWithReadbackTarget(GL_WITH_BITMAP, |
+ background, |
green.get(), |
base::FilePath(FILE_PATH_LITERAL( |
"green.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayer_GL) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = false; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -232,7 +214,8 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayer_GL) { |
gfx::Rect(200, 200), SK_ColorGREEN); |
background->AddChild(green); |
- RunPixelTestWithReadbackTarget(background, |
+ RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT, |
+ background, |
green.get(), |
base::FilePath(FILE_PATH_LITERAL( |
"green.png"))); |
@@ -240,9 +223,6 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayer_GL) { |
TEST_F(LayerTreeHostReadbackPixelTest, |
ReadbackSmallNonRootLayer_Software) { |
- use_gl_ = false; |
- force_readback_as_bitmap_ = false; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -250,16 +230,14 @@ TEST_F(LayerTreeHostReadbackPixelTest, |
gfx::Rect(100, 100, 100, 100), SK_ColorGREEN); |
background->AddChild(green); |
- RunPixelTestWithReadbackTarget(background, |
+ RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT, |
+ background, |
green.get(), |
base::FilePath(FILE_PATH_LITERAL( |
"green_small.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSmallNonRootLayer_GL_Bitmap) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = true; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -267,16 +245,14 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSmallNonRootLayer_GL_Bitmap) { |
gfx::Rect(100, 100, 100, 100), SK_ColorGREEN); |
background->AddChild(green); |
- RunPixelTestWithReadbackTarget(background, |
+ RunPixelTestWithReadbackTarget(GL_WITH_BITMAP, |
+ background, |
green.get(), |
base::FilePath(FILE_PATH_LITERAL( |
"green_small.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSmallNonRootLayer_GL) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = false; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -284,7 +260,8 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSmallNonRootLayer_GL) { |
gfx::Rect(100, 100, 100, 100), SK_ColorGREEN); |
background->AddChild(green); |
- RunPixelTestWithReadbackTarget(background, |
+ RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT, |
+ background, |
green.get(), |
base::FilePath(FILE_PATH_LITERAL( |
"green_small.png"))); |
@@ -292,9 +269,6 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSmallNonRootLayer_GL) { |
TEST_F(LayerTreeHostReadbackPixelTest, |
ReadbackSmallNonRootLayerWithChild_Software) { |
- use_gl_ = false; |
- force_readback_as_bitmap_ = false; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -306,7 +280,8 @@ TEST_F(LayerTreeHostReadbackPixelTest, |
gfx::Rect(50, 50, 50, 50), SK_ColorBLUE); |
green->AddChild(blue); |
- RunPixelTestWithReadbackTarget(background, |
+ RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT, |
+ background, |
green.get(), |
base::FilePath(FILE_PATH_LITERAL( |
"green_small_with_blue_corner.png"))); |
@@ -314,9 +289,6 @@ TEST_F(LayerTreeHostReadbackPixelTest, |
TEST_F(LayerTreeHostReadbackPixelTest, |
ReadbackSmallNonRootLayerWithChild_GL_Bitmap) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = true; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -328,16 +300,14 @@ TEST_F(LayerTreeHostReadbackPixelTest, |
gfx::Rect(50, 50, 50, 50), SK_ColorBLUE); |
green->AddChild(blue); |
- RunPixelTestWithReadbackTarget(background, |
+ RunPixelTestWithReadbackTarget(GL_WITH_BITMAP, |
+ background, |
green.get(), |
base::FilePath(FILE_PATH_LITERAL( |
"green_small_with_blue_corner.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSmallNonRootLayerWithChild_GL) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = false; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -349,16 +319,14 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSmallNonRootLayerWithChild_GL) { |
gfx::Rect(50, 50, 50, 50), SK_ColorBLUE); |
green->AddChild(blue); |
- RunPixelTestWithReadbackTarget(background, |
+ RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT, |
+ background, |
green.get(), |
base::FilePath(FILE_PATH_LITERAL( |
"green_small_with_blue_corner.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSubrect_Software) { |
- use_gl_ = false; |
- force_readback_as_bitmap_ = false; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -373,15 +341,13 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSubrect_Software) { |
// Grab the middle of the viewport. |
copy_subrect_ = gfx::Rect(50, 50, 100, 100); |
- RunPixelTest(background, |
+ RunPixelTest(SOFTWARE_WITH_DEFAULT, |
+ background, |
base::FilePath(FILE_PATH_LITERAL( |
"green_small_with_blue_corner.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSubrect_GL_Bitmap) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = true; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -396,15 +362,13 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSubrect_GL_Bitmap) { |
// Grab the middle of the viewport. |
copy_subrect_ = gfx::Rect(50, 50, 100, 100); |
- RunPixelTest(background, |
+ RunPixelTest(GL_WITH_BITMAP, |
+ background, |
base::FilePath(FILE_PATH_LITERAL( |
"green_small_with_blue_corner.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSubrect_GL) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = false; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -419,15 +383,13 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackSubrect_GL) { |
// Grab the middle of the viewport. |
copy_subrect_ = gfx::Rect(50, 50, 100, 100); |
- RunPixelTest(background, |
+ RunPixelTest(GL_WITH_DEFAULT, |
+ background, |
base::FilePath(FILE_PATH_LITERAL( |
"green_small_with_blue_corner.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayerSubrect_Software) { |
- use_gl_ = false; |
- force_readback_as_bitmap_ = false; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -442,16 +404,14 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayerSubrect_Software) { |
// Grab the middle of the viewport. |
copy_subrect_ = gfx::Rect(25, 25, 100, 100); |
- RunPixelTestWithReadbackTarget(background, |
+ RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT, |
+ background, |
green.get(), |
base::FilePath(FILE_PATH_LITERAL( |
"green_small_with_blue_corner.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayerSubrect_GL_Bitmap) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = true; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -466,16 +426,14 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayerSubrect_GL_Bitmap) { |
// Grab the middle of the viewport. |
copy_subrect_ = gfx::Rect(25, 25, 100, 100); |
- RunPixelTestWithReadbackTarget(background, |
+ RunPixelTestWithReadbackTarget(GL_WITH_BITMAP, |
+ background, |
green.get(), |
base::FilePath(FILE_PATH_LITERAL( |
"green_small_with_blue_corner.png"))); |
} |
TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayerSubrect_GL) { |
- use_gl_ = true; |
- force_readback_as_bitmap_ = true; |
- |
scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
gfx::Rect(200, 200), SK_ColorWHITE); |
@@ -490,7 +448,8 @@ TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayerSubrect_GL) { |
// Grab the middle of the viewport. |
copy_subrect_ = gfx::Rect(25, 25, 100, 100); |
- RunPixelTestWithReadbackTarget(background, |
+ RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT, |
+ background, |
green.get(), |
base::FilePath(FILE_PATH_LITERAL( |
"green_small_with_blue_corner.png"))); |