Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2279)

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 563523002: cc: Change LayerTreeHost unit tests to use impl painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 9a7cc581733b07494d8ae32cb2c3456f1cc1151c..5f4acf38161c6714177bfa5f01c6430fe36faede 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -274,12 +274,14 @@ MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedraw);
class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
public:
LayerTreeHostTestSetNeedsRedrawRect()
- : num_draws_(0),
- bounds_(50, 50),
- invalid_rect_(10, 10, 20, 20),
- root_layer_(ContentLayer::Create(&client_)) {}
+ : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
virtual void BeginTest() OVERRIDE {
+ if (layer_tree_host()->settings().impl_side_painting)
+ root_layer_ = FakePictureLayer::Create(&client_);
+ else
+ root_layer_ = ContentLayer::Create(&client_);
+
root_layer_->SetIsDrawable(true);
root_layer_->SetBounds(bounds_);
layer_tree_host()->SetRootLayer(root_layer_);
@@ -324,7 +326,7 @@ class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
const gfx::Size bounds_;
const gfx::Rect invalid_rect_;
FakeContentLayerClient client_;
- scoped_refptr<ContentLayer> root_layer_;
+ scoped_refptr<Layer> root_layer_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedrawRect);
@@ -443,12 +445,14 @@ SINGLE_AND_MULTI_THREAD_TEST_F(
class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
public:
LayerTreeHostTestSetNextCommitForcesRedraw()
- : num_draws_(0),
- bounds_(50, 50),
- invalid_rect_(10, 10, 20, 20),
- root_layer_(ContentLayer::Create(&client_)) {}
+ : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
virtual void BeginTest() OVERRIDE {
+ if (layer_tree_host()->settings().impl_side_painting)
+ root_layer_ = FakePictureLayer::Create(&client_);
+ else
+ root_layer_ = ContentLayer::Create(&client_);
+
root_layer_->SetIsDrawable(true);
root_layer_->SetBounds(bounds_);
layer_tree_host()->SetRootLayer(root_layer_);
@@ -526,7 +530,7 @@ class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
const gfx::Size bounds_;
const gfx::Rect invalid_rect_;
FakeContentLayerClient client_;
- scoped_refptr<ContentLayer> root_layer_;
+ scoped_refptr<Layer> root_layer_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw);
@@ -535,22 +539,34 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw);
// its damage is preserved until the next time it is drawn.
class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest {
public:
- LayerTreeHostTestUndrawnLayersDamageLater()
- : root_layer_(ContentLayer::Create(&client_)) {}
+ LayerTreeHostTestUndrawnLayersDamageLater() {}
virtual void SetupTree() OVERRIDE {
+ if (layer_tree_host()->settings().impl_side_painting)
+ root_layer_ = FakePictureLayer::Create(&client_);
+ else
+ root_layer_ = ContentLayer::Create(&client_);
+
root_layer_->SetIsDrawable(true);
root_layer_->SetBounds(gfx::Size(50, 50));
layer_tree_host()->SetRootLayer(root_layer_);
// The initially transparent layer has a larger child layer, which is
// not initially drawn because of the this (parent) layer.
- parent_layer_ = FakeContentLayer::Create(&client_);
+ if (layer_tree_host()->settings().impl_side_painting)
+ parent_layer_ = FakePictureLayer::Create(&client_);
+ else
+ parent_layer_ = FakeContentLayer::Create(&client_);
+
parent_layer_->SetBounds(gfx::Size(15, 15));
parent_layer_->SetOpacity(0.0f);
root_layer_->AddChild(parent_layer_);
- child_layer_ = FakeContentLayer::Create(&client_);
+ if (layer_tree_host()->settings().impl_side_painting)
+ child_layer_ = FakePictureLayer::Create(&client_);
+ else
+ child_layer_ = FakeContentLayer::Create(&client_);
+
child_layer_->SetBounds(gfx::Size(25, 25));
parent_layer_->AddChild(child_layer_);
@@ -616,9 +632,9 @@ class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest {
private:
FakeContentLayerClient client_;
- scoped_refptr<ContentLayer> root_layer_;
- scoped_refptr<FakeContentLayer> parent_layer_;
- scoped_refptr<FakeContentLayer> child_layer_;
+ scoped_refptr<Layer> root_layer_;
+ scoped_refptr<Layer> parent_layer_;
+ scoped_refptr<Layer> child_layer_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUndrawnLayersDamageLater);
@@ -1019,10 +1035,10 @@ class LayerTreeHostTestOpacityChange : public LayerTreeHostTest {
MULTI_THREAD_TEST_F(LayerTreeHostTestOpacityChange);
-class NoScaleContentLayer : public ContentLayer {
+class NoScalePictureLayer : public PictureLayer {
public:
- static scoped_refptr<NoScaleContentLayer> Create(ContentLayerClient* client) {
- return make_scoped_refptr(new NoScaleContentLayer(client));
+ static scoped_refptr<NoScalePictureLayer> Create(ContentLayerClient* client) {
+ return make_scoped_refptr(new NoScalePictureLayer(client));
}
virtual void CalculateContentsScale(float ideal_contents_scale,
@@ -1037,17 +1053,17 @@ class NoScaleContentLayer : public ContentLayer {
}
private:
- explicit NoScaleContentLayer(ContentLayerClient* client)
- : ContentLayer(client) {}
- virtual ~NoScaleContentLayer() {}
+ explicit NoScalePictureLayer(ContentLayerClient* client)
+ : PictureLayer(client) {}
+ virtual ~NoScalePictureLayer() {}
};
class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers
: public LayerTreeHostTest {
public:
LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers()
- : root_layer_(NoScaleContentLayer::Create(&client_)),
- child_layer_(ContentLayer::Create(&client_)) {}
+ : root_layer_(NoScalePictureLayer::Create(&client_)),
+ child_layer_(PictureLayer::Create(&client_)) {}
virtual void BeginTest() OVERRIDE {
layer_tree_host()->SetViewportSize(gfx::Size(60, 60));
@@ -1138,8 +1154,8 @@ class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers
private:
FakeContentLayerClient client_;
- scoped_refptr<NoScaleContentLayer> root_layer_;
- scoped_refptr<ContentLayer> child_layer_;
+ scoped_refptr<NoScalePictureLayer> root_layer_;
+ scoped_refptr<PictureLayer> child_layer_;
};
MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers);
danakj 2014/09/10 15:24:29 Does this test work? I'm a bit surprised you can a
sohanjg 2014/09/15 10:38:39 Acknowledged.
@@ -1156,7 +1172,7 @@ class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest {
}
virtual void SetupTree() OVERRIDE {
- layer_ = FakeContentLayer::Create(&client_);
+ layer_ = FakePictureLayer::Create(&client_);
layer_->SetBounds(gfx::Size(10, 20));
bool paint_scrollbar = true;
@@ -1244,13 +1260,15 @@ class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest {
protected:
FakeContentLayerClient client_;
- scoped_refptr<FakeContentLayer> layer_;
+ scoped_refptr<FakePictureLayer> layer_;
scoped_refptr<FakePaintedScrollbarLayer> scrollbar_;
int drew_frame_;
};
-MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(
- LayerTreeHostTestDirectRendererAtomicCommit);
+TEST_F(LayerTreeHostTestDirectRendererAtomicCommit,
+ RunMultiThread_DirectRenderer_ImplSidePaint) {
+ RunTest(true, false, true);
+}
class LayerTreeHostTestDelegatingRendererAtomicCommit
: public LayerTreeHostTestDirectRendererAtomicCommit {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698