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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 13939005: cc: Add strict layer property change checking and handle bounds changes during paint. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/CHECK/DCHECK/ Created 7 years, 8 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 | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_settings.h » ('j') | 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 cd3d0fd1f77f792fce6331759bf9307416cbc240..f1e5ee87bfcdcf3427e22b436e7acd21e162edc8 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -2210,5 +2210,61 @@ class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation
MULTI_THREAD_TEST_F(
LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation);
+class LayerTreeHostTestChangeLayerPropertiesInPaintContents
+ : public LayerTreeHostTest {
+ public:
+ class SetBoundsClient : public ContentLayerClient {
+ public:
+ SetBoundsClient() : layer_(0) {}
+
+ void set_layer(Layer* layer) { layer_ = layer; }
+
+ virtual void PaintContents(SkCanvas* canvas,
+ gfx::Rect clip,
+ gfx::RectF* opaque) OVERRIDE {
+ layer_->SetBounds(gfx::Size(2, 2));
+ }
+
+ virtual void DidChangeLayerCanUseLCDText() OVERRIDE {}
+
+ private:
+ Layer* layer_;
+ };
+
+ LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {}
+
+ virtual void SetupTree() OVERRIDE {
+ scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_);
+ root_layer->SetIsDrawable(true);
+ root_layer->SetBounds(gfx::Size(1, 1));
+
+ layer_tree_host()->SetRootLayer(root_layer);
+ client_.set_layer(root_layer.get());
+
+ LayerTreeHostTest::SetupTree();
+ }
+
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ virtual void AfterTest() OVERRIDE {}
+
+ virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ num_commits_++;
+ if (num_commits_ == 1) {
+ LayerImpl* root_layer = host_impl->active_tree()->root_layer();
+ EXPECT_SIZE_EQ(gfx::Size(1, 1), root_layer->bounds());
+ } else {
+ LayerImpl* root_layer = host_impl->active_tree()->root_layer();
+ EXPECT_SIZE_EQ(gfx::Size(2, 2), root_layer->bounds());
+ EndTest();
+ }
+ }
+
+ private:
+ SetBoundsClient client_;
+ int num_commits_;
+};
+
+SINGLE_THREAD_TEST_F(LayerTreeHostTestChangeLayerPropertiesInPaintContents);
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698