Commit 6d7221b2 authored by danakj@chromium.org's avatar danakj@chromium.org

cc: Switch some pixel tests to use impl-side painting.

These tests use ContentLayer, so change them to use PictureLayer
instead and stop explicitly disabling impl-side painting.

R=enne
BUG=401492

Review URL: https://codereview.chromium.org/443353003

Cr-Commit-Position: refs/heads/master@{#288244}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288244 0039d316-1c4b-4281-b951-d872f2087c98
parent 796d2bd1
...@@ -3,11 +3,12 @@ ...@@ -3,11 +3,12 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "build/build_config.h" #include "build/build_config.h"
#include "cc/layers/content_layer.h"
#include "cc/layers/solid_color_layer.h" #include "cc/layers/solid_color_layer.h"
#include "cc/layers/texture_layer.h" #include "cc/layers/texture_layer.h"
#include "cc/output/copy_output_request.h" #include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h" #include "cc/output/copy_output_result.h"
#include "cc/test/fake_picture_layer.h"
#include "cc/test/fake_picture_layer_impl.h"
#include "cc/test/layer_tree_pixel_test.h" #include "cc/test/layer_tree_pixel_test.h"
#include "cc/test/paths.h" #include "cc/test/paths.h"
#include "cc/test/solid_color_content_layer_client.h" #include "cc/test/solid_color_content_layer_client.h"
...@@ -932,17 +933,20 @@ class LayerTreeHostReadbackDeviceScalePixelTest ...@@ -932,17 +933,20 @@ class LayerTreeHostReadbackDeviceScalePixelTest
virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
LayerImpl* root_impl = host_impl->active_tree()->root_layer(); LayerImpl* root_impl = host_impl->active_tree()->root_layer();
LayerImpl* background_impl = root_impl->children()[0]; FakePictureLayerImpl* background_impl =
EXPECT_EQ(device_scale_factor_, background_impl->contents_scale_x()); static_cast<FakePictureLayerImpl*>(root_impl->children()[0]);
EXPECT_EQ(device_scale_factor_, background_impl->contents_scale_y()); EXPECT_EQ(device_scale_factor_,
background_impl->HighResTiling()->contents_scale());
LayerImpl* green_impl = background_impl->children()[0]; FakePictureLayerImpl* green_impl =
EXPECT_EQ(device_scale_factor_, green_impl->contents_scale_x()); static_cast<FakePictureLayerImpl*>(background_impl->children()[0]);
EXPECT_EQ(device_scale_factor_, green_impl->contents_scale_y()); EXPECT_EQ(device_scale_factor_,
green_impl->HighResTiling()->contents_scale());
LayerImpl* blue_impl = green_impl->children()[0]; FakePictureLayerImpl* blue_impl =
EXPECT_EQ(device_scale_factor_, blue_impl->contents_scale_x()); static_cast<FakePictureLayerImpl*>(green_impl->children()[0]);
EXPECT_EQ(device_scale_factor_, blue_impl->contents_scale_y()); EXPECT_EQ(device_scale_factor_,
blue_impl->HighResTiling()->contents_scale());
} }
float device_scale_factor_; float device_scale_factor_;
...@@ -953,16 +957,19 @@ class LayerTreeHostReadbackDeviceScalePixelTest ...@@ -953,16 +957,19 @@ class LayerTreeHostReadbackDeviceScalePixelTest
TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
ReadbackSubrect_Software) { ReadbackSubrect_Software) {
scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); scoped_refptr<FakePictureLayer> background =
FakePictureLayer::Create(&white_client_);
background->SetBounds(gfx::Size(100, 100)); background->SetBounds(gfx::Size(100, 100));
background->SetIsDrawable(true); background->SetIsDrawable(true);
scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); scoped_refptr<FakePictureLayer> green =
FakePictureLayer::Create(&green_client_);
green->SetBounds(gfx::Size(100, 100)); green->SetBounds(gfx::Size(100, 100));
green->SetIsDrawable(true); green->SetIsDrawable(true);
background->AddChild(green); background->AddChild(green);
scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); scoped_refptr<FakePictureLayer> blue =
FakePictureLayer::Create(&blue_client_);
blue->SetPosition(gfx::Point(50, 50)); blue->SetPosition(gfx::Point(50, 50));
blue->SetBounds(gfx::Size(25, 25)); blue->SetBounds(gfx::Size(25, 25));
blue->SetIsDrawable(true); blue->SetIsDrawable(true);
...@@ -971,8 +978,6 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, ...@@ -971,8 +978,6 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
// Grab the middle of the root layer. // Grab the middle of the root layer.
copy_subrect_ = gfx::Rect(25, 25, 50, 50); copy_subrect_ = gfx::Rect(25, 25, 50, 50);
device_scale_factor_ = 2.f; device_scale_factor_ = 2.f;
this->impl_side_painting_ = false;
RunPixelTest(SOFTWARE_WITH_DEFAULT, RunPixelTest(SOFTWARE_WITH_DEFAULT,
background, background,
base::FilePath(FILE_PATH_LITERAL( base::FilePath(FILE_PATH_LITERAL(
...@@ -981,16 +986,19 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, ...@@ -981,16 +986,19 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
ReadbackSubrect_GL) { ReadbackSubrect_GL) {
scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); scoped_refptr<FakePictureLayer> background =
FakePictureLayer::Create(&white_client_);
background->SetBounds(gfx::Size(100, 100)); background->SetBounds(gfx::Size(100, 100));
background->SetIsDrawable(true); background->SetIsDrawable(true);
scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); scoped_refptr<FakePictureLayer> green =
FakePictureLayer::Create(&green_client_);
green->SetBounds(gfx::Size(100, 100)); green->SetBounds(gfx::Size(100, 100));
green->SetIsDrawable(true); green->SetIsDrawable(true);
background->AddChild(green); background->AddChild(green);
scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); scoped_refptr<FakePictureLayer> blue =
FakePictureLayer::Create(&blue_client_);
blue->SetPosition(gfx::Point(50, 50)); blue->SetPosition(gfx::Point(50, 50));
blue->SetBounds(gfx::Size(25, 25)); blue->SetBounds(gfx::Size(25, 25));
blue->SetIsDrawable(true); blue->SetIsDrawable(true);
...@@ -999,8 +1007,6 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, ...@@ -999,8 +1007,6 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
// Grab the middle of the root layer. // Grab the middle of the root layer.
copy_subrect_ = gfx::Rect(25, 25, 50, 50); copy_subrect_ = gfx::Rect(25, 25, 50, 50);
device_scale_factor_ = 2.f; device_scale_factor_ = 2.f;
this->impl_side_painting_ = false;
RunPixelTest(GL_WITH_DEFAULT, RunPixelTest(GL_WITH_DEFAULT,
background, background,
base::FilePath(FILE_PATH_LITERAL( base::FilePath(FILE_PATH_LITERAL(
...@@ -1009,17 +1015,20 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, ...@@ -1009,17 +1015,20 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
ReadbackNonRootLayerSubrect_Software) { ReadbackNonRootLayerSubrect_Software) {
scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); scoped_refptr<FakePictureLayer> background =
FakePictureLayer::Create(&white_client_);
background->SetBounds(gfx::Size(100, 100)); background->SetBounds(gfx::Size(100, 100));
background->SetIsDrawable(true); background->SetIsDrawable(true);
scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); scoped_refptr<FakePictureLayer> green =
FakePictureLayer::Create(&green_client_);
green->SetPosition(gfx::Point(10, 20)); green->SetPosition(gfx::Point(10, 20));
green->SetBounds(gfx::Size(90, 80)); green->SetBounds(gfx::Size(90, 80));
green->SetIsDrawable(true); green->SetIsDrawable(true);
background->AddChild(green); background->AddChild(green);
scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); scoped_refptr<FakePictureLayer> blue =
FakePictureLayer::Create(&blue_client_);
blue->SetPosition(gfx::Point(50, 50)); blue->SetPosition(gfx::Point(50, 50));
blue->SetBounds(gfx::Size(25, 25)); blue->SetBounds(gfx::Size(25, 25));
blue->SetIsDrawable(true); blue->SetIsDrawable(true);
...@@ -1028,8 +1037,6 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, ...@@ -1028,8 +1037,6 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
// Grab the green layer's content with blue in the bottom right. // Grab the green layer's content with blue in the bottom right.
copy_subrect_ = gfx::Rect(25, 25, 50, 50); copy_subrect_ = gfx::Rect(25, 25, 50, 50);
device_scale_factor_ = 2.f; device_scale_factor_ = 2.f;
this->impl_side_painting_ = false;
RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT, RunPixelTestWithReadbackTarget(SOFTWARE_WITH_DEFAULT,
background, background,
green.get(), green.get(),
...@@ -1039,17 +1046,20 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, ...@@ -1039,17 +1046,20 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
ReadbackNonRootLayerSubrect_GL) { ReadbackNonRootLayerSubrect_GL) {
scoped_refptr<ContentLayer> background = ContentLayer::Create(&white_client_); scoped_refptr<FakePictureLayer> background =
FakePictureLayer::Create(&white_client_);
background->SetBounds(gfx::Size(100, 100)); background->SetBounds(gfx::Size(100, 100));
background->SetIsDrawable(true); background->SetIsDrawable(true);
scoped_refptr<ContentLayer> green = ContentLayer::Create(&green_client_); scoped_refptr<FakePictureLayer> green =
FakePictureLayer::Create(&green_client_);
green->SetPosition(gfx::Point(10, 20)); green->SetPosition(gfx::Point(10, 20));
green->SetBounds(gfx::Size(90, 80)); green->SetBounds(gfx::Size(90, 80));
green->SetIsDrawable(true); green->SetIsDrawable(true);
background->AddChild(green); background->AddChild(green);
scoped_refptr<ContentLayer> blue = ContentLayer::Create(&blue_client_); scoped_refptr<FakePictureLayer> blue =
FakePictureLayer::Create(&blue_client_);
blue->SetPosition(gfx::Point(50, 50)); blue->SetPosition(gfx::Point(50, 50));
blue->SetBounds(gfx::Size(25, 25)); blue->SetBounds(gfx::Size(25, 25));
blue->SetIsDrawable(true); blue->SetIsDrawable(true);
...@@ -1058,8 +1068,6 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest, ...@@ -1058,8 +1068,6 @@ TEST_F(LayerTreeHostReadbackDeviceScalePixelTest,
// Grab the green layer's content with blue in the bottom right. // Grab the green layer's content with blue in the bottom right.
copy_subrect_ = gfx::Rect(25, 25, 50, 50); copy_subrect_ = gfx::Rect(25, 25, 50, 50);
device_scale_factor_ = 2.f; device_scale_factor_ = 2.f;
this->impl_side_painting_ = false;
RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT, RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT,
background, background,
green.get(), green.get(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment