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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 692213002: Create PageScaleAnimation after ImplTree is activated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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_impl.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index db1048d59fce4cc7722f1f4c6b21b7fc66b9a7cc..5261d26fa5177c253c88c5fc297a0629695d923a 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -1164,11 +1164,12 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimation) {
did_request_redraw_ = false;
did_request_animate_ = false;
- host_impl_->active_tree()->SetPageScaleAnimation(
- gfx::Vector2d(),
- false,
- 2.f,
- duration);
+ host_impl_->active_tree()->SetPendingPageScaleAnimation(
+ scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation(
+ gfx::Vector2d(),
+ false,
+ 2.f,
+ duration)));
host_impl_->ActivateSyncTree();
EXPECT_FALSE(did_request_redraw_);
EXPECT_TRUE(did_request_animate_);
@@ -1207,8 +1208,12 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimation) {
did_request_redraw_ = false;
did_request_animate_ = false;
- host_impl_->active_tree()->SetPageScaleAnimation(
- gfx::Vector2d(25, 25), true, min_page_scale, duration);
+ host_impl_->active_tree()->SetPendingPageScaleAnimation(
+ scoped_ptr<PendingPageScaleAnimation> (new PendingPageScaleAnimation(
+ gfx::Vector2d(25, 25),
+ true,
+ min_page_scale,
+ duration)));
host_impl_->ActivateSyncTree();
EXPECT_FALSE(did_request_redraw_);
EXPECT_TRUE(did_request_animate_);
@@ -1258,11 +1263,12 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationNoOp) {
max_page_scale);
scroll_layer->SetScrollOffset(gfx::ScrollOffset(50, 50));
- host_impl_->active_tree()->SetPageScaleAnimation(
- gfx::Vector2d(),
- true,
- 1.f,
- duration);
+ host_impl_->active_tree()->SetPendingPageScaleAnimation(
+ scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation(
+ gfx::Vector2d(),
+ true,
+ 1.f,
+ duration)));
host_impl_->ActivateSyncTree();
host_impl_->Animate(start_time);
host_impl_->Animate(halfway_through_animation);
@@ -1306,26 +1312,29 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationTransferedOnSyncTreeActivate) {
scroll_layer->SetScrollOffset(gfx::ScrollOffset(50, 50));
// Make sure TakePageScaleAnimation works properly.
- host_impl_->sync_tree()->SetPageScaleAnimation(
- gfx::Vector2d(),
- false,
- target_scale,
- duration);
- scoped_ptr<PageScaleAnimation> psa =
- host_impl_->sync_tree()->TakePageScaleAnimation();
- EXPECT_EQ(target_scale, psa->target_page_scale_factor());
- EXPECT_EQ(duration, psa->duration());
- EXPECT_EQ(nullptr, host_impl_->sync_tree()->TakePageScaleAnimation());
+
+ host_impl_->sync_tree()->SetPendingPageScaleAnimation(
+ scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation(
+ gfx::Vector2d(),
+ false,
+ target_scale,
+ duration)));
+ scoped_ptr<PendingPageScaleAnimation> psa =
+ host_impl_->sync_tree()->TakePendingPageScaleAnimation();
+ EXPECT_EQ(target_scale, psa->scale);
+ EXPECT_EQ(duration, psa->duration);
+ EXPECT_EQ(nullptr, host_impl_->sync_tree()->TakePendingPageScaleAnimation());
// Recreate the PSA. Nothing should happen here since the tree containing the
// PSA hasn't been activated yet.
did_request_redraw_ = false;
did_request_animate_ = false;
- host_impl_->sync_tree()->SetPageScaleAnimation(
- gfx::Vector2d(),
- false,
- target_scale,
- duration);
+ host_impl_->sync_tree()->SetPendingPageScaleAnimation(
+ scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation(
+ gfx::Vector2d(),
+ false,
+ target_scale,
+ duration)));
host_impl_->Animate(halfway_through_animation);
EXPECT_FALSE(did_request_animate_);
EXPECT_FALSE(did_request_redraw_);
@@ -1333,7 +1342,8 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationTransferedOnSyncTreeActivate) {
// Activate the sync tree. This should cause the animation to become enabled.
// It should also clear the pointer on the sync tree.
host_impl_->ActivateSyncTree();
- EXPECT_EQ(nullptr, host_impl_->sync_tree()->TakePageScaleAnimation().get());
+ EXPECT_EQ(nullptr,
+ host_impl_->sync_tree()->TakePendingPageScaleAnimation().get());
EXPECT_FALSE(did_request_redraw_);
EXPECT_TRUE(did_request_animate_);
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698