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

Side by Side Diff: cc/layers/layer_unittest.cc

Issue 719453007: Make Keyframe use TimeTicks/TimeDelta to represent time instead of double. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « cc/input/top_controls_manager.cc ('k') | cc/test/animation_test_common.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layers/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include "cc/animation/keyframed_animation_curve.h" 7 #include "cc/animation/keyframed_animation_curve.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/layers/layer_impl.h" 9 #include "cc/layers/layer_impl.h"
10 #include "cc/resources/layer_painter.h" 10 #include "cc/resources/layer_painter.h"
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 scoped_refptr<Layer> child = Layer::Create(); 1137 scoped_refptr<Layer> child = Layer::Create();
1138 root->AddChild(child); 1138 root->AddChild(child);
1139 LayerTreeHostFactory factory; 1139 LayerTreeHostFactory factory;
1140 scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create(); 1140 scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create();
1141 layer_tree_host->SetRootLayer(root); 1141 layer_tree_host->SetRootLayer(root);
1142 } 1142 }
1143 1143
1144 static bool AddTestAnimation(Layer* layer) { 1144 static bool AddTestAnimation(Layer* layer) {
1145 scoped_ptr<KeyframedFloatAnimationCurve> curve = 1145 scoped_ptr<KeyframedFloatAnimationCurve> curve =
1146 KeyframedFloatAnimationCurve::Create(); 1146 KeyframedFloatAnimationCurve::Create();
1147 curve->AddKeyframe(FloatKeyframe::Create(0.0, 0.3f, nullptr)); 1147 curve->AddKeyframe(FloatKeyframe::Create(base::TimeDelta(), 0.3f, nullptr));
1148 curve->AddKeyframe(FloatKeyframe::Create(1.0, 0.7f, nullptr)); 1148 curve->AddKeyframe(
1149 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.7f, nullptr));
1149 scoped_ptr<Animation> animation = 1150 scoped_ptr<Animation> animation =
1150 Animation::Create(curve.Pass(), 0, 0, Animation::Opacity); 1151 Animation::Create(curve.Pass(), 0, 0, Animation::Opacity);
1151 1152
1152 return layer->AddAnimation(animation.Pass()); 1153 return layer->AddAnimation(animation.Pass());
1153 } 1154 }
1154 1155
1155 TEST(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { 1156 TEST(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) {
1156 scoped_refptr<Layer> layer = Layer::Create(); 1157 scoped_refptr<Layer> layer = Layer::Create();
1157 1158
1158 // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the 1159 // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 root_layer->AddChild(becomes_not_draws_content); 1249 root_layer->AddChild(becomes_not_draws_content);
1249 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent()); 1250 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent());
1250 1251
1251 becomes_draws_content->SetIsDrawable(true); 1252 becomes_draws_content->SetIsDrawable(true);
1252 root_layer->AddChild(becomes_draws_content); 1253 root_layer->AddChild(becomes_draws_content);
1253 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent()); 1254 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent());
1254 } 1255 }
1255 1256
1256 } // namespace 1257 } // namespace
1257 } // namespace cc 1258 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/top_controls_manager.cc ('k') | cc/test/animation_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698