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

Side by Side Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 863253002: Update from https://crrev.com/312600 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "cc/animation/animation_curve.h" 7 #include "cc/animation/animation_curve.h"
8 #include "cc/animation/layer_animation_controller.h" 8 #include "cc/animation/layer_animation_controller.h"
9 #include "cc/animation/scroll_offset_animation_curve.h" 9 #include "cc/animation/scroll_offset_animation_curve.h"
10 #include "cc/animation/timing_function.h" 10 #include "cc/animation/timing_function.h"
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f), 1036 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f),
1037 EaseInOutTimingFunction::Create())); 1037 EaseInOutTimingFunction::Create()));
1038 scoped_ptr<Animation> animation( 1038 scoped_ptr<Animation> animation(
1039 Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset)); 1039 Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset));
1040 animation->set_needs_synchronized_start_time(true); 1040 animation->set_needs_synchronized_start_time(true);
1041 scroll_layer_->AddAnimation(animation.Pass()); 1041 scroll_layer_->AddAnimation(animation.Pass());
1042 } 1042 }
1043 1043
1044 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1044 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1045 1045
1046 void DidCommit() override { 1046 void BeginMainFrame(const BeginFrameArgs& args) override {
1047 Animation* animation = 1047 switch (layer_tree_host()->source_frame_number()) {
1048 scroll_layer_->layer_animation_controller()->GetAnimation( 1048 case 0:
1049 Animation::ScrollOffset); 1049 break;
1050 if (animation) { 1050 case 1: {
1051 scroll_layer_->layer_animation_controller()->RemoveAnimation( 1051 Animation* animation =
1052 animation->id()); 1052 scroll_layer_->layer_animation_controller()->GetAnimation(
1053 scroll_layer_->SetScrollOffset(final_postion_); 1053 Animation::ScrollOffset);
1054 } else { 1054 scroll_layer_->layer_animation_controller()->RemoveAnimation(
1055 EXPECT_EQ(final_postion_, scroll_layer_->scroll_offset()); 1055 animation->id());
1056 scroll_layer_->SetScrollOffset(final_postion_);
1057 break;
1058 }
1059 default:
1060 EXPECT_EQ(final_postion_, scroll_layer_->scroll_offset());
1056 } 1061 }
1057 } 1062 }
1058 1063
1059 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { 1064 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override {
1060 if (host_impl->settings().impl_side_painting) 1065 if (host_impl->settings().impl_side_painting)
1061 host_impl->BlockNotifyReadyToActivateForTesting(true); 1066 host_impl->BlockNotifyReadyToActivateForTesting(true);
1062 } 1067 }
1063 1068
1064 void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, 1069 void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
1065 const BeginFrameArgs& args) override { 1070 const BeginFrameArgs& args) override {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 private: 1265 private:
1261 scoped_refptr<Layer> content_; 1266 scoped_refptr<Layer> content_;
1262 int num_swap_buffers_; 1267 int num_swap_buffers_;
1263 }; 1268 };
1264 1269
1265 SINGLE_AND_MULTI_THREAD_TEST_F( 1270 SINGLE_AND_MULTI_THREAD_TEST_F(
1266 LayerTreeHostAnimationTestAddAnimationAfterAnimating); 1271 LayerTreeHostAnimationTestAddAnimationAfterAnimating);
1267 1272
1268 } // namespace 1273 } // namespace
1269 } // namespace cc 1274 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698