Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 #include "cc/layers/solid_color_layer.h" | 6 #include "cc/layers/solid_color_layer.h" |
| 7 #include "cc/layers/texture_layer.h" | 7 #include "cc/layers/texture_layer.h" |
| 8 #include "cc/output/copy_output_request.h" | 8 #include "cc/output/copy_output_request.h" |
| 9 #include "cc/output/copy_output_result.h" | 9 #include "cc/output/copy_output_result.h" |
| 10 #include "cc/test/fake_picture_layer.h" | 10 #include "cc/test/fake_picture_layer.h" |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1137 green->AddChild(blue); | 1137 green->AddChild(blue); |
| 1138 | 1138 |
| 1139 RunReadbackTestWithReadbackTarget( | 1139 RunReadbackTestWithReadbackTarget( |
| 1140 PIXEL_TEST_GL, | 1140 PIXEL_TEST_GL, |
| 1141 READBACK_DEFAULT, | 1141 READBACK_DEFAULT, |
| 1142 background, | 1142 background, |
| 1143 green.get(), | 1143 green.get(), |
| 1144 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png"))); | 1144 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png"))); |
| 1145 } | 1145 } |
| 1146 | 1146 |
| 1147 class LayerTreeHostReadbackNonFirstNonRootRenderPassPixelTest | 1147 class LayerTreeHostReadbackNonFirstNonRootRenderPassPixelTest |
|
danakj
2015/02/09 18:01:17
Maybe we can rename this a bit more generally sinc
ericrk
2015/02/09 19:46:14
Updated the tests to use parameters. Now all of th
| |
| 1148 : public LayerTreeHostReadbackPixelTest, | 1148 : public LayerTreeHostReadbackPixelTest, |
| 1149 public testing::WithParamInterface<bool> {}; | 1149 public testing::WithParamInterface<bool> {}; |
| 1150 | 1150 |
| 1151 TEST_P(LayerTreeHostReadbackNonFirstNonRootRenderPassPixelTest, | 1151 TEST_P(LayerTreeHostReadbackNonFirstNonRootRenderPassPixelTest, |
| 1152 ReadbackNonRootOrFirstLayer) { | 1152 ReadbackNonRootOrFirstLayer) { |
| 1153 // This test has 3 render passes with the copy request on the render pass in | 1153 // This test has 3 render passes with the copy request on the render pass in |
| 1154 // the middle. Doing a copy request can be destructive of state, so for render | 1154 // the middle. This test caught an issue where copy requests on non-root |
| 1155 // passes after the first drawn the code path is different. This verifies the | 1155 // non-first render passes were being treated differently from the first |
| 1156 // non-first and non-root path. See http://crbug.com/99393 for more info. | 1156 // render pass. |
| 1157 scoped_refptr<SolidColorLayer> background = | 1157 scoped_refptr<SolidColorLayer> background = |
| 1158 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN); | 1158 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN); |
| 1159 | 1159 |
| 1160 scoped_refptr<SolidColorLayer> blue = | 1160 scoped_refptr<SolidColorLayer> blue = |
| 1161 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE); | 1161 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE); |
| 1162 blue->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( | 1162 blue->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( |
| 1163 base::Bind(&IgnoreReadbackResult))); | 1163 base::Bind(&IgnoreReadbackResult))); |
| 1164 background->AddChild(blue); | 1164 background->AddChild(blue); |
| 1165 | 1165 |
| 1166 RunReadbackTestWithReadbackTarget( | 1166 RunReadbackTestWithReadbackTarget( |
| 1167 GetParam() ? PIXEL_TEST_GL : PIXEL_TEST_SOFTWARE, | 1167 GetParam() ? PIXEL_TEST_GL : PIXEL_TEST_SOFTWARE, |
| 1168 READBACK_DEFAULT, | 1168 READBACK_DEFAULT, |
| 1169 background, | 1169 background, |
| 1170 background.get(), | 1170 background.get(), |
| 1171 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png"))); | 1171 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png"))); |
| 1172 } | 1172 } |
| 1173 | 1173 |
| 1174 TEST_P(LayerTreeHostReadbackNonFirstNonRootRenderPassPixelTest, | |
| 1175 MultipleReadbackNonRootOrFirstLayer) { | |
|
danakj
2015/02/09 18:01:17
The test has multiple requests on blue which becom
ericrk
2015/02/09 19:46:14
Done.
| |
| 1176 // This test has 3 render passes with multiple copy requests on the second | |
| 1177 // render pass. For every copy request after the first, state must be | |
| 1178 // restored via a call to UseRenderPass (see http://crbug.com/99393). This | |
| 1179 // test ensures that the renderer correctly handles cases where | |
| 1180 // UseRenderPass is called multiple times for a single layer. | |
| 1181 scoped_refptr<SolidColorLayer> background = | |
| 1182 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN); | |
| 1183 | |
| 1184 scoped_refptr<SolidColorLayer> blue = | |
| 1185 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE); | |
| 1186 blue->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( | |
| 1187 base::Bind(&IgnoreReadbackResult))); | |
| 1188 blue->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( | |
|
danakj
2015/02/09 18:01:17
I think we can simplify this test a bit, by just p
ericrk
2015/02/09 19:46:14
Done.
| |
| 1189 base::Bind(&IgnoreReadbackResult))); | |
| 1190 background->AddChild(blue); | |
| 1191 | |
| 1192 RunReadbackTestWithReadbackTarget( | |
| 1193 GetParam() ? PIXEL_TEST_GL : PIXEL_TEST_SOFTWARE, READBACK_DEFAULT, | |
|
danakj
2015/02/09 18:01:17
Hm, it occured to me if only one version of this t
ericrk
2015/02/09 19:46:14
Good call - done.
| |
| 1194 background, background.get(), | |
| 1195 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png"))); | |
| 1196 } | |
| 1197 | |
| 1174 INSTANTIATE_TEST_CASE_P( | 1198 INSTANTIATE_TEST_CASE_P( |
| 1175 LayerTreeHostReadbackNonFirstNonRootRenderPassPixelTests, | 1199 LayerTreeHostReadbackNonFirstNonRootRenderPassPixelTests, |
| 1176 LayerTreeHostReadbackNonFirstNonRootRenderPassPixelTest, | 1200 LayerTreeHostReadbackNonFirstNonRootRenderPassPixelTest, |
| 1177 testing::Bool()); | 1201 testing::Bool()); |
| 1178 | 1202 |
| 1179 } // namespace | 1203 } // namespace |
| 1180 } // namespace cc | 1204 } // namespace cc |
| 1181 | 1205 |
| 1182 #endif // OS_ANDROID | 1206 #endif // OS_ANDROID |
| OLD | NEW |