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

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: Add test 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 | « no previous file | 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..8662e1693b76c41bf0065f815b3b39ceb5a215b5 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -765,5 +765,57 @@ 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_(ContentLayer::Create(&client_)),
+ started_times_(0) {}
+
+ virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ settings->use_pinch_zoom_scrollbars = true;
+ }
+
+ virtual void BeginTest() OVERRIDE {
+ root_layer_->SetIsDrawable(true);
+ root_layer_->SetBounds(gfx::Size(100, 100));
+ layer_tree_host()->SetRootLayer(root_layer_);
danakj 2013/04/17 20:54:09 Can you set up the layer tree in SetupTree() inste
ajuma 2013/04/18 18:42:51 Done.
+ layer_tree_host()->SetPageScaleFactorAndLimits(0.5, 0.5, 0.9);
danakj 2013/04/17 20:54:09 These are floats. 0.5f etc
wjmaclean 2013/04/17 20:56:54 Minor nit: we generally would only have pinch zoom
danakj 2013/04/17 21:01:03 Oh, is this test actually triggering the scrollbar
ajuma 2013/04/18 18:42:51 Done.
+ PostSetNeedsCommitToMainThread();
+ }
+
+ virtual void AnimateLayers(LayerTreeHostImpl* host_impl,
+ base::TimeTicks monotonic_time) OVERRIDE {
+ if (host_impl->active_tree()->page_scale_factor() == 1.0)
danakj 2013/04/17 20:54:09 1.f
ajuma 2013/04/18 18:42:51 Done.
+ return;
+
+ if (started_times_ == 0) {
danakj 2013/04/17 20:54:09 seems like a good spot for a switch?
ajuma 2013/04/18 18:42:51 Done.
+ host_impl->active_tree()->DidBeginScroll();
+ started_times_++;
+ return;
+ }
+
+ if (started_times_ == 1) {
+ host_impl->active_tree()->DidEndScroll();
+ started_times_++;
+ return;
+ }
+
+ if (started_times_ == 2)
+ EndTest();
+ }
+
+ virtual void AfterTest() OVERRIDE {}
+
+ private:
+ FakeContentLayerClient client_;
+ scoped_refptr<ContentLayer> root_layer_;
+ int started_times_;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestPinchZoomScrollbars);
+
} // namespace
} // namespace cc
« no previous file with comments | « no previous file | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698