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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 206793003: cc: Split animating and drawing into separate actions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup. Created 6 years, 9 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
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 351ec356968a1cee57baaded51a05c00cc2cc9de..075ea096b95d32efdd3dddbf0a31f6f1385414d7 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -84,6 +84,7 @@ class LayerTreeHostImplTest : public testing::Test,
did_notify_ready_to_activate_(false),
did_request_commit_(false),
did_request_redraw_(false),
+ did_request_animate_(false),
did_request_manage_tiles_(false),
did_upload_visible_tile_(false),
reduce_memory_result_(true),
@@ -125,6 +126,9 @@ class LayerTreeHostImplTest : public testing::Test,
const gfx::Rect& damage_rect) OVERRIDE {
did_request_redraw_ = true;
}
+ virtual void SetNeedsAnimateOnImplThread() OVERRIDE {
+ did_request_animate_ = true;
+ }
virtual void SetNeedsManageTilesOnImplThread() OVERRIDE {
did_request_manage_tiles_ = true;
}
@@ -390,6 +394,7 @@ class LayerTreeHostImplTest : public testing::Test,
bool did_notify_ready_to_activate_;
bool did_request_commit_;
bool did_request_redraw_;
+ bool did_request_animate_;
bool did_request_manage_tiles_;
bool did_upload_visible_tile_;
bool reduce_memory_result_;
@@ -872,6 +877,7 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) {
scroll_layer->FixedContainerSizeDelta());
host_impl_->PinchGestureEnd();
host_impl_->ScrollEnd();
+ EXPECT_FALSE(did_request_animate_);
EXPECT_TRUE(did_request_redraw_);
EXPECT_TRUE(did_request_commit_);
EXPECT_EQ(gfx::Size(50, 50), container_layer->bounds());
@@ -938,6 +944,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50));
host_impl_->PinchGestureEnd();
host_impl_->ScrollEnd();
+ EXPECT_FALSE(did_request_animate_);
EXPECT_TRUE(did_request_redraw_);
EXPECT_TRUE(did_request_commit_);
@@ -1079,19 +1086,30 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimation) {
max_page_scale);
scroll_layer->SetScrollOffset(gfx::Vector2d(50, 50));
+ did_request_redraw_ = false;
+ did_request_animate_ = false;
host_impl_->StartPageScaleAnimation(gfx::Vector2d(), false, 2.f, duration);
+ EXPECT_FALSE(did_request_redraw_);
+ EXPECT_TRUE(did_request_animate_);
+
did_request_redraw_ = false;
+ did_request_animate_ = false;
host_impl_->Animate(start_time);
EXPECT_TRUE(did_request_redraw_);
+ EXPECT_TRUE(did_request_animate_);
did_request_redraw_ = false;
+ did_request_animate_ = false;
host_impl_->Animate(halfway_through_animation);
EXPECT_TRUE(did_request_redraw_);
+ EXPECT_TRUE(did_request_animate_);
did_request_redraw_ = false;
+ did_request_animate_ = false;
did_request_commit_ = false;
host_impl_->Animate(end_time);
EXPECT_TRUE(did_request_commit_);
+ EXPECT_FALSE(did_request_animate_);
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
@@ -1106,16 +1124,25 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimation) {
max_page_scale);
scroll_layer->SetScrollOffset(gfx::Vector2d(50, 50));
+ did_request_redraw_ = false;
+ did_request_animate_ = false;
host_impl_->StartPageScaleAnimation(
gfx::Vector2d(25, 25), true, min_page_scale, duration);
+ EXPECT_FALSE(did_request_redraw_);
+ EXPECT_TRUE(did_request_animate_);
+
did_request_redraw_ = false;
+ did_request_animate_ = false;
host_impl_->Animate(start_time);
EXPECT_TRUE(did_request_redraw_);
+ EXPECT_TRUE(did_request_animate_);
did_request_redraw_ = false;
did_request_commit_ = false;
+ did_request_animate_ = false;
host_impl_->Animate(end_time);
EXPECT_TRUE(did_request_redraw_);
+ EXPECT_FALSE(did_request_animate_);
EXPECT_TRUE(did_request_commit_);
scoped_ptr<ScrollAndScaleSet> scroll_info =
@@ -1264,10 +1291,12 @@ TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) {
host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0));
host_impl_->ScrollEnd();
did_request_redraw_ = false;
+ did_request_animate_ = false;
host_impl_->StartScrollbarAnimation();
EXPECT_LT(base::TimeDelta::FromMilliseconds(19),
requested_scrollbar_animation_delay_);
EXPECT_FALSE(did_request_redraw_);
+ EXPECT_FALSE(did_request_animate_);
requested_scrollbar_animation_delay_ = base::TimeDelta();
// After the fade begins, we should start getting redraws instead of a
@@ -1276,8 +1305,8 @@ TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) {
host_impl_override_time->SetCurrentPhysicalTimeTicksForTest(fake_now);
host_impl_->StartScrollbarAnimation();
EXPECT_EQ(base::TimeDelta(), requested_scrollbar_animation_delay_);
- EXPECT_TRUE(did_request_redraw_);
- did_request_redraw_ = false;
+ EXPECT_TRUE(did_request_animate_);
+ did_request_animate_ = false;
// If no scroll happened recently, StartScrollbarAnimation should have no
// effect.
@@ -1294,6 +1323,7 @@ TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) {
EXPECT_LT(base::TimeDelta::FromMilliseconds(19),
requested_scrollbar_animation_delay_);
EXPECT_FALSE(did_request_redraw_);
+ EXPECT_FALSE(did_request_animate_);
requested_scrollbar_animation_delay_ = base::TimeDelta();
// None of the above should have called CurrentFrameTimeTicks, so if we call

Powered by Google App Engine
This is Rietveld 408576698