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

Side by Side Diff: cc/animation/layer_animation_controller_unittest.cc

Issue 584503005: Make scroll offset type of float in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: link crbug to TODO Created 6 years, 2 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/animation/layer_animation_controller.h" 5 #include "cc/animation/layer_animation_controller.h"
6 6
7 #include "cc/animation/animation.h" 7 #include "cc/animation/animation.h"
8 #include "cc/animation/animation_curve.h" 8 #include "cc/animation/animation_curve.h"
9 #include "cc/animation/animation_delegate.h" 9 #include "cc/animation/animation_delegate.h"
10 #include "cc/animation/animation_registrar.h" 10 #include "cc/animation/animation_registrar.h"
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 controller_impl->set_value_provider(&dummy_provider_impl); 656 controller_impl->set_value_provider(&dummy_provider_impl);
657 scoped_ptr<AnimationEventsVector> events( 657 scoped_ptr<AnimationEventsVector> events(
658 make_scoped_ptr(new AnimationEventsVector)); 658 make_scoped_ptr(new AnimationEventsVector));
659 FakeLayerAnimationValueObserver dummy; 659 FakeLayerAnimationValueObserver dummy;
660 FakeLayerAnimationValueProvider dummy_provider; 660 FakeLayerAnimationValueProvider dummy_provider;
661 scoped_refptr<LayerAnimationController> controller( 661 scoped_refptr<LayerAnimationController> controller(
662 LayerAnimationController::Create(0)); 662 LayerAnimationController::Create(0));
663 controller->AddValueObserver(&dummy); 663 controller->AddValueObserver(&dummy);
664 controller->set_value_provider(&dummy_provider); 664 controller->set_value_provider(&dummy_provider);
665 665
666 gfx::Vector2dF initial_value(100.f, 300.f); 666 gfx::ScrollOffset initial_value(100.f, 300.f);
667 gfx::Vector2dF target_value(300.f, 200.f); 667 gfx::ScrollOffset target_value(300.f, 200.f);
668 scoped_ptr<ScrollOffsetAnimationCurve> curve( 668 scoped_ptr<ScrollOffsetAnimationCurve> curve(
669 ScrollOffsetAnimationCurve::Create( 669 ScrollOffsetAnimationCurve::Create(
670 target_value, 670 target_value,
671 EaseInOutTimingFunction::Create().Pass())); 671 EaseInOutTimingFunction::Create().Pass()));
672 672
673 scoped_ptr<Animation> animation( 673 scoped_ptr<Animation> animation(
674 Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset)); 674 Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset));
675 animation->set_needs_synchronized_start_time(true); 675 animation->set_needs_synchronized_start_time(true);
676 controller->AddAnimation(animation.Pass()); 676 controller->AddAnimation(animation.Pass());
677 677
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 controller_impl->AddValueObserver(&dummy_impl); 738 controller_impl->AddValueObserver(&dummy_impl);
739 scoped_ptr<AnimationEventsVector> events( 739 scoped_ptr<AnimationEventsVector> events(
740 make_scoped_ptr(new AnimationEventsVector)); 740 make_scoped_ptr(new AnimationEventsVector));
741 FakeLayerAnimationValueObserver dummy; 741 FakeLayerAnimationValueObserver dummy;
742 FakeLayerAnimationValueProvider dummy_provider; 742 FakeLayerAnimationValueProvider dummy_provider;
743 scoped_refptr<LayerAnimationController> controller( 743 scoped_refptr<LayerAnimationController> controller(
744 LayerAnimationController::Create(0)); 744 LayerAnimationController::Create(0));
745 controller->AddValueObserver(&dummy); 745 controller->AddValueObserver(&dummy);
746 controller->set_value_provider(&dummy_provider); 746 controller->set_value_provider(&dummy_provider);
747 747
748 gfx::Vector2dF initial_value(500.f, 100.f); 748 gfx::ScrollOffset initial_value(500.f, 100.f);
749 gfx::Vector2dF target_value(300.f, 200.f); 749 gfx::ScrollOffset target_value(300.f, 200.f);
750 scoped_ptr<ScrollOffsetAnimationCurve> curve( 750 scoped_ptr<ScrollOffsetAnimationCurve> curve(
751 ScrollOffsetAnimationCurve::Create( 751 ScrollOffsetAnimationCurve::Create(
752 target_value, 752 target_value,
753 EaseInOutTimingFunction::Create().Pass())); 753 EaseInOutTimingFunction::Create().Pass()));
754 754
755 scoped_ptr<Animation> animation( 755 scoped_ptr<Animation> animation(
756 Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset)); 756 Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset));
757 animation->set_needs_synchronized_start_time(true); 757 animation->set_needs_synchronized_start_time(true);
758 controller->AddAnimation(animation.Pass()); 758 controller->AddAnimation(animation.Pass());
759 759
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 } 812 }
813 813
814 TEST(LayerAnimationControllerTest, ScrollOffsetTransitionOnImplOnly) { 814 TEST(LayerAnimationControllerTest, ScrollOffsetTransitionOnImplOnly) {
815 FakeLayerAnimationValueObserver dummy_impl; 815 FakeLayerAnimationValueObserver dummy_impl;
816 scoped_refptr<LayerAnimationController> controller_impl( 816 scoped_refptr<LayerAnimationController> controller_impl(
817 LayerAnimationController::Create(0)); 817 LayerAnimationController::Create(0));
818 controller_impl->AddValueObserver(&dummy_impl); 818 controller_impl->AddValueObserver(&dummy_impl);
819 scoped_ptr<AnimationEventsVector> events( 819 scoped_ptr<AnimationEventsVector> events(
820 make_scoped_ptr(new AnimationEventsVector)); 820 make_scoped_ptr(new AnimationEventsVector));
821 821
822 gfx::Vector2dF initial_value(100.f, 300.f); 822 gfx::ScrollOffset initial_value(100.f, 300.f);
823 gfx::Vector2dF target_value(300.f, 200.f); 823 gfx::ScrollOffset target_value(300.f, 200.f);
824 scoped_ptr<ScrollOffsetAnimationCurve> curve( 824 scoped_ptr<ScrollOffsetAnimationCurve> curve(
825 ScrollOffsetAnimationCurve::Create( 825 ScrollOffsetAnimationCurve::Create(
826 target_value, 826 target_value,
827 EaseInOutTimingFunction::Create().Pass())); 827 EaseInOutTimingFunction::Create().Pass()));
828 curve->SetInitialValue(initial_value); 828 curve->SetInitialValue(initial_value);
829 double duration_in_seconds = curve->Duration(); 829 double duration_in_seconds = curve->Duration();
830 830
831 scoped_ptr<Animation> animation( 831 scoped_ptr<Animation> animation(
832 Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset)); 832 Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset));
833 animation->set_is_impl_only(true); 833 animation->set_is_impl_only(true);
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 // been ticked at the new animation's starting point. 2254 // been ticked at the new animation's starting point.
2255 EXPECT_EQ(Animation::Running, 2255 EXPECT_EQ(Animation::Running,
2256 controller_impl->GetAnimation(second_animation_group_id, 2256 controller_impl->GetAnimation(second_animation_group_id,
2257 Animation::Opacity)->run_state()); 2257 Animation::Opacity)->run_state());
2258 EXPECT_EQ(1.f, pending_dummy_impl.opacity()); 2258 EXPECT_EQ(1.f, pending_dummy_impl.opacity());
2259 EXPECT_EQ(1.f, dummy_impl.opacity()); 2259 EXPECT_EQ(1.f, dummy_impl.opacity());
2260 } 2260 }
2261 2261
2262 } // namespace 2262 } // namespace
2263 } // namespace cc 2263 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/layer_animation_controller.cc ('k') | cc/animation/layer_animation_value_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698