summaryrefslogtreecommitdiffstats
path: root/cc/output/gl_renderer_pixeltest.cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-26 13:13:21 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-26 13:13:21 +0000
commit44e9a2fe0aa46ac1b8f2d7a861aa211bba252096 (patch)
treeda5994ca0ed4058d3aa259ea7851331000d29907 /cc/output/gl_renderer_pixeltest.cc
parenta23f62e6e57a92d3f75b5ff600d351f01b6b7d4b (diff)
downloadchromium_src-44e9a2fe0aa46ac1b8f2d7a861aa211bba252096.zip
chromium_src-44e9a2fe0aa46ac1b8f2d7a861aa211bba252096.tar.gz
chromium_src-44e9a2fe0aa46ac1b8f2d7a861aa211bba252096.tar.bz2
cc: Async readback.
Provide a path to get a readback of a layer's subtree via an asynchronous mechanism. This path is used for all the cc pixel tests, to show that it works. Also by some unit tests: LayerTreeHostTestAsyncReadback.GLRenderer_RunSingleThread LayerTreeHostTestAsyncReadback.GLRenderer_RunMultiThread LayerTreeHostTestAsyncReadback.SoftwareRenderer_RunSingleThread LayerTreeHostTestAsyncReadback.SoftwareRenderer_RunMultiThread LayerTreeHostTestAsyncReadbackLayerDestroyed.RunSingleThread LayerTreeHostTestAsyncReadbackLayerDestroyed.RunMultiThread BUG=179896 Review URL: https://chromiumcodereview.appspot.com/14060015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196713 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/output/gl_renderer_pixeltest.cc')
-rw-r--r--cc/output/gl_renderer_pixeltest.cc56
1 files changed, 22 insertions, 34 deletions
diff --git a/cc/output/gl_renderer_pixeltest.cc b/cc/output/gl_renderer_pixeltest.cc
index 8da1b24..965b5cc 100644
--- a/cc/output/gl_renderer_pixeltest.cc
+++ b/cc/output/gl_renderer_pixeltest.cc
@@ -92,14 +92,13 @@ TEST_F(GLRendererPixelTest, SimpleGreenRect) {
RenderPassList pass_list;
pass_list.push_back(pass.Pass());
- renderer_->DrawFrame(&pass_list);
-
- EXPECT_TRUE(PixelsMatchReference(
+ EXPECT_TRUE(RunPixelTest(
+ &pass_list,
base::FilePath(FILE_PATH_LITERAL("green.png")),
ExactPixelComparator(true)));
}
-TEST_F(GLRendererPixelTest, fastPassColorFilterAlpha) {
+TEST_F(GLRendererPixelTest, FastPassColorFilterAlpha) {
gfx::Rect viewport_rect(device_viewport_size_);
RenderPass::Id root_pass_id(1, 1);
@@ -168,7 +167,8 @@ TEST_F(GLRendererPixelTest, fastPassColorFilterAlpha) {
skia::RefPtr<SkImageFilter> filter =
skia::AdoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), NULL));
- scoped_ptr<RenderPassDrawQuad> render_pass_quad = RenderPassDrawQuad::Create();
+ scoped_ptr<RenderPassDrawQuad> render_pass_quad =
+ RenderPassDrawQuad::Create();
render_pass_quad->SetNew(pass_shared_state.get(),
pass_rect,
child_pass_id,
@@ -186,16 +186,13 @@ TEST_F(GLRendererPixelTest, fastPassColorFilterAlpha) {
pass_list.push_back(child_pass.Pass());
pass_list.push_back(root_pass.Pass());
- renderer_->SetEnlargePassTextureAmountForTesting(gfx::Vector2d(50, 75));
- renderer_->DecideRenderPassAllocationsForFrame(pass_list);
- renderer_->DrawFrame(&pass_list);
-
- EXPECT_TRUE(PixelsMatchReference(
+ EXPECT_TRUE(RunPixelTest(
+ &pass_list,
base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha.png")),
ExactPixelComparator(false)));
}
-TEST_F(GLRendererPixelTest, fastPassColorFilterAlphaTranslation) {
+TEST_F(GLRendererPixelTest, FastPassColorFilterAlphaTranslation) {
gfx::Rect viewport_rect(device_viewport_size_);
RenderPass::Id root_pass_id(1, 1);
@@ -286,11 +283,8 @@ TEST_F(GLRendererPixelTest, fastPassColorFilterAlphaTranslation) {
pass_list.push_back(child_pass.Pass());
pass_list.push_back(root_pass.Pass());
- renderer_->SetEnlargePassTextureAmountForTesting(gfx::Vector2d(50, 75));
- renderer_->DecideRenderPassAllocationsForFrame(pass_list);
- renderer_->DrawFrame(&pass_list);
-
- EXPECT_TRUE(PixelsMatchReference(
+ EXPECT_TRUE(RunPixelTest(
+ &pass_list,
base::FilePath(FILE_PATH_LITERAL("blue_yellow_alpha_translate.png")),
ExactPixelComparator(false)));
}
@@ -342,17 +336,16 @@ TEST_F(GLRendererPixelTest, RenderPassChangesSize) {
pass_list.push_back(root_pass.Pass());
renderer_->SetEnlargePassTextureAmountForTesting(gfx::Vector2d(50, 75));
- renderer_->DecideRenderPassAllocationsForFrame(pass_list);
- renderer_->DrawFrame(&pass_list);
- EXPECT_TRUE(PixelsMatchReference(
+ EXPECT_TRUE(RunPixelTest(
+ &pass_list,
base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")),
ExactPixelComparator(true)));
}
class GLRendererPixelTestWithBackgroundFilter : public GLRendererPixelTest {
protected:
- void DrawFrame() {
+ void SetUpRenderPassList() {
gfx::Rect device_viewport_rect(device_viewport_size_);
RenderPass::Id root_id(1, 1);
@@ -452,14 +445,11 @@ class GLRendererPixelTestWithBackgroundFilter : public GLRendererPixelTest {
root_pass->quad_list.push_back(background_quad.PassAs<DrawQuad>());
root_pass->shared_quad_state_list.push_back(shared_state.Pass());
- RenderPassList pass_list;
- pass_list.push_back(filter_pass.Pass());
- pass_list.push_back(root_pass.Pass());
-
- renderer_->DecideRenderPassAllocationsForFrame(pass_list);
- renderer_->DrawFrame(&pass_list);
+ pass_list_.push_back(filter_pass.Pass());
+ pass_list_.push_back(root_pass.Pass());
}
+ RenderPassList pass_list_;
WebKit::WebFilterOperations background_filters_;
gfx::Transform filter_pass_to_target_transform_;
gfx::Rect filter_pass_content_rect_;
@@ -472,8 +462,9 @@ TEST_F(GLRendererPixelTestWithBackgroundFilter, InvertFilter) {
filter_pass_content_rect_ = gfx::Rect(device_viewport_size_);
filter_pass_content_rect_.Inset(12, 14, 16, 18);
- DrawFrame();
- EXPECT_TRUE(PixelsMatchReference(
+ SetUpRenderPassList();
+ EXPECT_TRUE(RunPixelTest(
+ &pass_list_,
base::FilePath(FILE_PATH_LITERAL("background_filter.png")),
ExactPixelComparator(true)));
}
@@ -482,9 +473,7 @@ TEST_F(GLRendererPixelTest, AntiAliasing) {
gfx::Rect rect(0, 0, 200, 200);
RenderPass::Id id(1, 1);
- gfx::Transform transform_to_root;
- scoped_ptr<RenderPass> pass =
- CreateTestRenderPass(id, rect, transform_to_root);
+ scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect);
gfx::Transform red_content_to_target_transform;
red_content_to_target_transform.Rotate(10);
@@ -518,9 +507,8 @@ TEST_F(GLRendererPixelTest, AntiAliasing) {
RenderPassList pass_list;
pass_list.push_back(pass.Pass());
- renderer_->DrawFrame(&pass_list);
-
- EXPECT_TRUE(PixelsMatchReference(
+ EXPECT_TRUE(RunPixelTest(
+ &pass_list,
base::FilePath(FILE_PATH_LITERAL("anti_aliasing.png")),
ExactPixelComparator(true)));
}