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

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

Issue 609663003: cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cc-passas: PassAs-presubmit-warning 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
« no previous file with comments | « cc/layers/layer_perftest.cc ('k') | cc/layers/nine_patch_layer.cc » ('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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber()); 71 EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber());
72 parent_ = NULL; 72 parent_ = NULL;
73 child1_ = NULL; 73 child1_ = NULL;
74 child2_ = NULL; 74 child2_ = NULL;
75 child3_ = NULL; 75 child3_ = NULL;
76 grand_child1_ = NULL; 76 grand_child1_ = NULL;
77 grand_child2_ = NULL; 77 grand_child2_ = NULL;
78 grand_child3_ = NULL; 78 grand_child3_ = NULL;
79 79
80 layer_tree_host_->SetRootLayer(NULL); 80 layer_tree_host_->SetRootLayer(NULL);
81 layer_tree_host_.reset(); 81 layer_tree_host_ = nullptr;
82 } 82 }
83 83
84 void VerifyTestTreeInitialState() const { 84 void VerifyTestTreeInitialState() const {
85 ASSERT_EQ(3U, parent_->children().size()); 85 ASSERT_EQ(3U, parent_->children().size());
86 EXPECT_EQ(child1_, parent_->children()[0]); 86 EXPECT_EQ(child1_, parent_->children()[0]);
87 EXPECT_EQ(child2_, parent_->children()[1]); 87 EXPECT_EQ(child2_, parent_->children()[1]);
88 EXPECT_EQ(child3_, parent_->children()[2]); 88 EXPECT_EQ(child3_, parent_->children()[2]);
89 EXPECT_EQ(parent_.get(), child1_->parent()); 89 EXPECT_EQ(parent_.get(), child1_->parent());
90 EXPECT_EQ(parent_.get(), child2_->parent()); 90 EXPECT_EQ(parent_.get(), child2_->parent());
91 EXPECT_EQ(parent_.get(), child3_->parent()); 91 EXPECT_EQ(parent_.get(), child3_->parent());
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 static bool AddTestAnimation(Layer* layer) { 1137 static bool AddTestAnimation(Layer* layer) {
1138 scoped_ptr<KeyframedFloatAnimationCurve> curve = 1138 scoped_ptr<KeyframedFloatAnimationCurve> curve =
1139 KeyframedFloatAnimationCurve::Create(); 1139 KeyframedFloatAnimationCurve::Create();
1140 curve->AddKeyframe(FloatKeyframe::Create(0.0, 1140 curve->AddKeyframe(FloatKeyframe::Create(0.0,
1141 0.3f, 1141 0.3f,
1142 scoped_ptr<TimingFunction>())); 1142 scoped_ptr<TimingFunction>()));
1143 curve->AddKeyframe(FloatKeyframe::Create(1.0, 1143 curve->AddKeyframe(FloatKeyframe::Create(1.0,
1144 0.7f, 1144 0.7f,
1145 scoped_ptr<TimingFunction>())); 1145 scoped_ptr<TimingFunction>()));
1146 scoped_ptr<Animation> animation = 1146 scoped_ptr<Animation> animation =
1147 Animation::Create(curve.PassAs<AnimationCurve>(), 1147 Animation::Create(curve.Pass(), 0, 0, Animation::Opacity);
1148 0,
1149 0,
1150 Animation::Opacity);
1151 1148
1152 return layer->AddAnimation(animation.Pass()); 1149 return layer->AddAnimation(animation.Pass());
1153 } 1150 }
1154 1151
1155 TEST(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { 1152 TEST(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) {
1156 scoped_refptr<Layer> layer = Layer::Create(); 1153 scoped_refptr<Layer> layer = Layer::Create();
1157 1154
1158 // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the 1155 // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the
1159 // animation should not be accepted. 1156 // animation should not be accepted.
1160 EXPECT_FALSE(AddTestAnimation(layer.get())); 1157 EXPECT_FALSE(AddTestAnimation(layer.get()));
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 root_layer->AddChild(becomes_not_draws_content); 1245 root_layer->AddChild(becomes_not_draws_content);
1249 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent()); 1246 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent());
1250 1247
1251 becomes_draws_content->SetIsDrawable(true); 1248 becomes_draws_content->SetIsDrawable(true);
1252 root_layer->AddChild(becomes_draws_content); 1249 root_layer->AddChild(becomes_draws_content);
1253 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent()); 1250 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent());
1254 } 1251 }
1255 1252
1256 } // namespace 1253 } // namespace
1257 } // namespace cc 1254 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_perftest.cc ('k') | cc/layers/nine_patch_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698