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

Unified Diff: cc/trees/layer_tree_host_unittest_animation.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/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_impl.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_animation.cc
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index 423462148be821a37fe373e7469c2bcdbbfe7b29..425886c7c17b714ea13610752ef39b8a4a17c03f 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -765,5 +765,68 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
MULTI_THREAD_TEST_F(
LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations);
+// Test that creating a pinch-zoom scrollbar animation leads to AnimateLayers
+// being called.
+class LayerTreeHostAnimationTestPinchZoomScrollbars
+ : public LayerTreeHostAnimationTest {
+ public:
+ LayerTreeHostAnimationTestPinchZoomScrollbars()
+ : root_layer_(FakeContentLayer::Create(&client_)),
+ started_times_(0),
+ num_commit_complete_(0) {}
+
+ virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ settings->use_pinch_zoom_scrollbars = true;
+ }
+
+ virtual void SetupTree() OVERRIDE {
+ root_layer_->SetBounds(gfx::Size(100, 100));
+ layer_tree_host()->SetRootLayer(root_layer_);
+ LayerTreeHostAnimationTest::SetupTree();
+ }
+
+ virtual void BeginTest() OVERRIDE {
+ layer_tree_host()->SetPageScaleFactorAndLimits(1.55f, 1.f, 4.f);
+ PostSetNeedsCommitToMainThread();
+ }
+
+ virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ num_commit_complete_++;
+ }
+
+ virtual void AnimateLayers(LayerTreeHostImpl* host_impl,
+ base::TimeTicks monotonic_time) OVERRIDE {
+ // Two commits are required for the creation of pinch-zoom scrollbars.
+ // Wait for these to finish.
+ if (num_commit_complete_ < 2)
+ return;
+
+ EXPECT_NE(host_impl->active_tree()->page_scale_factor(), 1.f);
+
+ switch (started_times_) {
+ case 0:
+ host_impl->active_tree()->DidBeginScroll();
+ started_times_++;
+ break;
+ case 1:
+ host_impl->active_tree()->DidEndScroll();
+ started_times_++;
+ break;
+ case 2:
+ EndTest();
+ }
+ }
+
+ virtual void AfterTest() OVERRIDE {}
+
+ private:
+ FakeContentLayerClient client_;
+ scoped_refptr<FakeContentLayer> root_layer_;
+ int started_times_;
+ int num_commit_complete_;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestPinchZoomScrollbars);
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698