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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 14017008: Ensure that pinch-zoom scrollbar animations trigger a draw (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits 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/layers/scrollbar_layer.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('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 edf6722a07d8b7bddd8de1295148d541c0f956d2..2910dd9b136f6c7bc26c78db76ff68d81a8b3efe 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -254,6 +254,11 @@ class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
PostSetNeedsCommitToMainThread();
}
+ virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ if (host_impl->active_tree()->source_frame_number() == 1)
+ EndTest();
+ }
+
virtual void DidCommit() OVERRIDE {
switch (layer_tree_host()->commit_number()) {
case 1:
@@ -263,7 +268,6 @@ class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
default:
// No extra commits.
EXPECT_EQ(2, layer_tree_host()->commit_number());
- EndTest();
}
}
@@ -276,6 +280,61 @@ class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate);
+class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate
+ : public LayerTreeHostTest {
+ public:
+ LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate()
+ : root_layer_(FakeContentLayer::Create(&client_)) {}
+
+ virtual void SetupTree() OVERRIDE {
+ root_layer_->SetBounds(gfx::Size(10, 20));
+
+ bool paint_scrollbar = true;
+ bool has_thumb = false;
+ scrollbar_ = FakeScrollbarLayer::Create(paint_scrollbar,
+ has_thumb,
+ root_layer_->id());
+ scrollbar_->SetPosition(gfx::Point(0, 10));
+ scrollbar_->SetBounds(gfx::Size(10, 10));
+
+ root_layer_->AddChild(scrollbar_);
+
+ layer_tree_host()->SetRootLayer(root_layer_);
+ LayerTreeHostTest::SetupTree();
+ }
+
+ virtual void BeginTest() OVERRIDE {
+ PostSetNeedsCommitToMainThread();
+ }
+
+ virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ if (host_impl->active_tree()->source_frame_number() == 1)
+ EndTest();
+ }
+
+ virtual void DidCommit() OVERRIDE {
+ switch (layer_tree_host()->commit_number()) {
+ case 1:
+ // This should cause a single commit.
+ scrollbar_->SetRasterScale(4.0f);
+ break;
+ default:
+ // No extra commits.
+ EXPECT_EQ(2, layer_tree_host()->commit_number());
+ }
+ }
+
+ virtual void AfterTest() OVERRIDE {}
+
+ private:
+ FakeContentLayerClient client_;
+ scoped_refptr<FakeContentLayer> root_layer_;
+ scoped_refptr<FakeScrollbarLayer> scrollbar_;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(
+ LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate);
+
class LayerTreeHostTestCompositeAndReadback : public LayerTreeHostTest {
public:
LayerTreeHostTestCompositeAndReadback() : num_commits_(0) {}
« no previous file with comments | « cc/layers/scrollbar_layer.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698