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

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

Issue 12676029: cc: Fix capitalization style in chromified files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/animation/layer_animation_controller.cc ('k') | cc/base/hash_pair.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/keyframed_animation_curve.h" 9 #include "cc/animation/keyframed_animation_curve.h"
10 #include "cc/animation/transform_operations.h" 10 #include "cc/animation/transform_operations.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 scoped_ptr<Animation> to_add(CreateAnimation( 198 scoped_ptr<Animation> to_add(CreateAnimation(
199 scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(), 199 scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
200 1, 200 1,
201 Animation::Opacity)); 201 Animation::Opacity));
202 202
203 controller->AddAnimation(to_add.Pass()); 203 controller->AddAnimation(to_add.Pass());
204 controller->Animate(0.0); 204 controller->Animate(0.0);
205 controller->UpdateState(events.get()); 205 controller->UpdateState(events.get());
206 EXPECT_TRUE(controller->HasActiveAnimation()); 206 EXPECT_TRUE(controller->HasActiveAnimation());
207 EXPECT_EQ(0.f, dummy.opacity()); 207 EXPECT_EQ(0.f, dummy.opacity());
208 // A non-implOnly animation should not generate property updates. 208 // A non-impl-only animation should not generate property updates.
209 const AnimationEvent* event = GetMostRecentPropertyUpdateEvent(events.get()); 209 const AnimationEvent* event = GetMostRecentPropertyUpdateEvent(events.get());
210 EXPECT_FALSE(event); 210 EXPECT_FALSE(event);
211 controller->Animate(1.0); 211 controller->Animate(1.0);
212 controller->UpdateState(events.get()); 212 controller->UpdateState(events.get());
213 EXPECT_EQ(1.f, dummy.opacity()); 213 EXPECT_EQ(1.f, dummy.opacity());
214 EXPECT_FALSE(controller->HasActiveAnimation()); 214 EXPECT_FALSE(controller->HasActiveAnimation());
215 event = GetMostRecentPropertyUpdateEvent(events.get()); 215 event = GetMostRecentPropertyUpdateEvent(events.get());
216 EXPECT_FALSE(event); 216 EXPECT_FALSE(event);
217 } 217 }
218 218
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 controller->set_force_sync(); 845 controller->set_force_sync();
846 846
847 controller->PushAnimationUpdatesTo(controller_impl.get()); 847 controller->PushAnimationUpdatesTo(controller_impl.get());
848 848
849 active_animation = controller_impl->GetAnimation(0, Animation::Opacity); 849 active_animation = controller_impl->GetAnimation(0, Animation::Opacity);
850 EXPECT_TRUE(active_animation); 850 EXPECT_TRUE(active_animation);
851 EXPECT_EQ(Animation::WaitingForTargetAvailability, 851 EXPECT_EQ(Animation::WaitingForTargetAvailability,
852 active_animation->run_state()); 852 active_animation->run_state());
853 } 853 }
854 854
855 // Tests that skipping a call to updateState works as expected. 855 // Tests that skipping a call to UpdateState works as expected.
856 TEST(LayerAnimationControllerTest, SkipUpdateState) { 856 TEST(LayerAnimationControllerTest, SkipUpdateState) {
857 scoped_ptr<AnimationEventsVector> events( 857 scoped_ptr<AnimationEventsVector> events(
858 make_scoped_ptr(new AnimationEventsVector)); 858 make_scoped_ptr(new AnimationEventsVector));
859 FakeLayerAnimationValueObserver dummy; 859 FakeLayerAnimationValueObserver dummy;
860 scoped_refptr<LayerAnimationController> controller( 860 scoped_refptr<LayerAnimationController> controller(
861 LayerAnimationController::Create(0)); 861 LayerAnimationController::Create(0));
862 controller->AddObserver(&dummy); 862 controller->AddObserver(&dummy);
863 863
864 controller->AddAnimation(CreateAnimation( 864 controller->AddAnimation(CreateAnimation(
865 scoped_ptr<AnimationCurve>(new FakeTransformTransition(1)).Pass(), 865 scoped_ptr<AnimationCurve>(new FakeTransformTransition(1)).Pass(),
866 1, 866 1,
867 Animation::Transform)); 867 Animation::Transform));
868 868
869 controller->Animate(0.0); 869 controller->Animate(0.0);
870 controller->UpdateState(events.get()); 870 controller->UpdateState(events.get());
871 871
872 controller->AddAnimation(CreateAnimation( 872 controller->AddAnimation(CreateAnimation(
873 scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(), 873 scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(),
874 2, 874 2,
875 Animation::Opacity)); 875 Animation::Opacity));
876 876
877 // Animate but don't updateState. 877 // Animate but don't UpdateState.
878 controller->Animate(1.0); 878 controller->Animate(1.0);
879 879
880 controller->Animate(2.0); 880 controller->Animate(2.0);
881 events.reset(new AnimationEventsVector); 881 events.reset(new AnimationEventsVector);
882 controller->UpdateState(events.get()); 882 controller->UpdateState(events.get());
883 883
884 // Should have one Started event and one Finished event. 884 // Should have one Started event and one Finished event.
885 EXPECT_EQ(2, events->size()); 885 EXPECT_EQ(2, events->size());
886 EXPECT_NE((*events)[0].type, (*events)[1].type); 886 EXPECT_NE((*events)[0].type, (*events)[1].type);
887 887
888 // The float transition should still be at its starting point. 888 // The float transition should still be at its starting point.
889 EXPECT_TRUE(controller->HasActiveAnimation()); 889 EXPECT_TRUE(controller->HasActiveAnimation());
890 EXPECT_EQ(0.f, dummy.opacity()); 890 EXPECT_EQ(0.f, dummy.opacity());
891 891
892 controller->Animate(3.0); 892 controller->Animate(3.0);
893 controller->UpdateState(events.get()); 893 controller->UpdateState(events.get());
894 894
895 // The float tranisition should now be done. 895 // The float tranisition should now be done.
896 EXPECT_EQ(1.f, dummy.opacity()); 896 EXPECT_EQ(1.f, dummy.opacity());
897 EXPECT_FALSE(controller->HasActiveAnimation()); 897 EXPECT_FALSE(controller->HasActiveAnimation());
898 } 898 }
899 899
900 } // namespace 900 } // namespace
901 } // namespace cc 901 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/layer_animation_controller.cc ('k') | cc/base/hash_pair.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698