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

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

Issue 2261113002: CC Animation: Introduce some dirty flags to optimize PushProperties on commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do not change SetNeedsCommit invalidation, leave it as-is. Created 4 years, 3 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/animation/animation_player.cc ('k') | cc/animation/animation_timeline.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/animation_player.h" 5 #include "cc/animation/animation_player.h"
6 6
7 #include "cc/animation/animation_delegate.h" 7 #include "cc/animation/animation_delegate.h"
8 #include "cc/animation/animation_host.h" 8 #include "cc/animation/animation_host.h"
9 #include "cc/animation/animation_id_provider.h" 9 #include "cc/animation/animation_id_provider.h"
10 #include "cc/animation/animation_timeline.h" 10 #include "cc/animation/animation_timeline.h"
11 #include "cc/animation/element_animations.h" 11 #include "cc/animation/element_animations.h"
12 #include "cc/test/animation_test_common.h" 12 #include "cc/test/animation_test_common.h"
13 #include "cc/test/animation_timelines_test_common.h" 13 #include "cc/test/animation_timelines_test_common.h"
14 14
15 namespace cc { 15 namespace cc {
16 namespace { 16 namespace {
17 17
18 class AnimationPlayerTest : public AnimationTimelinesTest { 18 class AnimationPlayerTest : public AnimationTimelinesTest {
19 public: 19 public:
20 AnimationPlayerTest() {} 20 AnimationPlayerTest() {}
21 ~AnimationPlayerTest() override {} 21 ~AnimationPlayerTest() override {}
22 }; 22 };
23 23
24 // See element_animations_unittest.cc for active/pending observers tests. 24 // See element_animations_unittest.cc for active/pending observers tests.
25 25
26 TEST_F(AnimationPlayerTest, AttachDetachLayerIfTimelineAttached) { 26 TEST_F(AnimationPlayerTest, AttachDetachLayerIfTimelineAttached) {
27 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(false));
27 host_->AddAnimationTimeline(timeline_); 28 host_->AddAnimationTimeline(timeline_);
29 EXPECT_TRUE(timeline_->needs_push_properties());
30 EXPECT_FALSE(player_->needs_push_properties());
31
28 timeline_->AttachPlayer(player_); 32 timeline_->AttachPlayer(player_);
29 EXPECT_FALSE(player_->element_animations()); 33 EXPECT_FALSE(player_->element_animations());
30 EXPECT_FALSE(player_->element_id()); 34 EXPECT_FALSE(player_->element_id());
31 35
36 EXPECT_TRUE(timeline_->needs_push_properties());
37 EXPECT_FALSE(player_->needs_push_properties());
38
32 host_->PushPropertiesTo(host_impl_); 39 host_->PushPropertiesTo(host_impl_);
33 40
34 EXPECT_FALSE(GetImplPlayerForLayerId(element_id_)); 41 EXPECT_FALSE(GetImplPlayerForLayerId(element_id_));
35 42
36 GetImplTimelineAndPlayerByID(); 43 GetImplTimelineAndPlayerByID();
37 44
38 EXPECT_FALSE(player_impl_->element_animations()); 45 EXPECT_FALSE(player_impl_->element_animations());
39 EXPECT_FALSE(player_impl_->element_id()); 46 EXPECT_FALSE(player_impl_->element_id());
47 EXPECT_FALSE(player_->needs_push_properties());
48 EXPECT_FALSE(timeline_->needs_push_properties());
40 49
41 player_->AttachElement(element_id_); 50 player_->AttachElement(element_id_);
42 EXPECT_EQ(player_, GetPlayerForElementId(element_id_)); 51 EXPECT_EQ(player_, GetPlayerForElementId(element_id_));
43 EXPECT_TRUE(player_->element_animations()); 52 EXPECT_TRUE(player_->element_animations());
44 EXPECT_EQ(player_->element_id(), element_id_); 53 EXPECT_EQ(player_->element_id(), element_id_);
54 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(true));
45 55
46 host_->PushPropertiesTo(host_impl_); 56 host_->PushPropertiesTo(host_impl_);
47 57
48 EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(element_id_)); 58 EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(element_id_));
49 EXPECT_TRUE(player_impl_->element_animations()); 59 EXPECT_TRUE(player_impl_->element_animations());
50 EXPECT_EQ(player_impl_->element_id(), element_id_); 60 EXPECT_EQ(player_impl_->element_id(), element_id_);
61 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(false));
51 62
52 player_->DetachElement(); 63 player_->DetachElement();
53 EXPECT_FALSE(GetPlayerForElementId(element_id_)); 64 EXPECT_FALSE(GetPlayerForElementId(element_id_));
54 EXPECT_FALSE(player_->element_animations()); 65 EXPECT_FALSE(player_->element_animations());
55 EXPECT_FALSE(player_->element_id()); 66 EXPECT_FALSE(player_->element_id());
67 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(true));
56 68
57 host_->PushPropertiesTo(host_impl_); 69 host_->PushPropertiesTo(host_impl_);
58 70
59 EXPECT_FALSE(GetImplPlayerForLayerId(element_id_)); 71 EXPECT_FALSE(GetImplPlayerForLayerId(element_id_));
60 EXPECT_FALSE(player_impl_->element_animations()); 72 EXPECT_FALSE(player_impl_->element_animations());
61 EXPECT_FALSE(player_impl_->element_id()); 73 EXPECT_FALSE(player_impl_->element_id());
74 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(false));
62 75
63 timeline_->DetachPlayer(player_); 76 timeline_->DetachPlayer(player_);
64 EXPECT_FALSE(player_->animation_timeline()); 77 EXPECT_FALSE(player_->animation_timeline());
65 EXPECT_FALSE(player_->element_animations()); 78 EXPECT_FALSE(player_->element_animations());
66 EXPECT_FALSE(player_->element_id()); 79 EXPECT_FALSE(player_->element_id());
80 EXPECT_TRUE(timeline_->needs_push_properties());
81 EXPECT_FALSE(player_->needs_push_properties());
82
83 host_->PushPropertiesTo(host_impl_);
84 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(false));
67 } 85 }
68 86
69 TEST_F(AnimationPlayerTest, AttachDetachTimelineIfLayerAttached) { 87 TEST_F(AnimationPlayerTest, AttachDetachTimelineIfLayerAttached) {
70 host_->AddAnimationTimeline(timeline_); 88 host_->AddAnimationTimeline(timeline_);
71 89
72 EXPECT_FALSE(player_->element_animations()); 90 EXPECT_FALSE(player_->element_animations());
73 EXPECT_FALSE(player_->element_id()); 91 EXPECT_FALSE(player_->element_id());
92 EXPECT_FALSE(player_->needs_push_properties());
74 93
75 player_->AttachElement(element_id_); 94 player_->AttachElement(element_id_);
76 EXPECT_FALSE(player_->animation_timeline()); 95 EXPECT_FALSE(player_->animation_timeline());
77 EXPECT_FALSE(GetPlayerForElementId(element_id_)); 96 EXPECT_FALSE(GetPlayerForElementId(element_id_));
78 EXPECT_FALSE(player_->element_animations()); 97 EXPECT_FALSE(player_->element_animations());
79 EXPECT_EQ(player_->element_id(), element_id_); 98 EXPECT_EQ(player_->element_id(), element_id_);
99 EXPECT_FALSE(player_->needs_push_properties());
80 100
81 timeline_->AttachPlayer(player_); 101 timeline_->AttachPlayer(player_);
82 EXPECT_EQ(timeline_, player_->animation_timeline()); 102 EXPECT_EQ(timeline_, player_->animation_timeline());
83 EXPECT_EQ(player_, GetPlayerForElementId(element_id_)); 103 EXPECT_EQ(player_, GetPlayerForElementId(element_id_));
84 EXPECT_TRUE(player_->element_animations()); 104 EXPECT_TRUE(player_->element_animations());
85 EXPECT_EQ(player_->element_id(), element_id_); 105 EXPECT_EQ(player_->element_id(), element_id_);
106 EXPECT_TRUE(player_->needs_push_properties());
86 107
87 // Removing player from timeline detaches layer. 108 // Removing player from timeline detaches layer.
88 timeline_->DetachPlayer(player_); 109 timeline_->DetachPlayer(player_);
89 EXPECT_FALSE(player_->animation_timeline()); 110 EXPECT_FALSE(player_->animation_timeline());
90 EXPECT_FALSE(GetPlayerForElementId(element_id_)); 111 EXPECT_FALSE(GetPlayerForElementId(element_id_));
91 EXPECT_FALSE(player_->element_animations()); 112 EXPECT_FALSE(player_->element_animations());
92 EXPECT_FALSE(player_->element_id()); 113 EXPECT_FALSE(player_->element_id());
114 EXPECT_TRUE(player_->needs_push_properties());
93 } 115 }
94 116
95 TEST_F(AnimationPlayerTest, PropertiesMutate) { 117 TEST_F(AnimationPlayerTest, PropertiesMutate) {
96 client_.RegisterElement(element_id_, ElementListType::ACTIVE); 118 client_.RegisterElement(element_id_, ElementListType::ACTIVE);
97 client_impl_.RegisterElement(element_id_, ElementListType::PENDING); 119 client_impl_.RegisterElement(element_id_, ElementListType::PENDING);
98 client_impl_.RegisterElement(element_id_, ElementListType::ACTIVE); 120 client_impl_.RegisterElement(element_id_, ElementListType::ACTIVE);
99 121
100 host_->AddAnimationTimeline(timeline_); 122 host_->AddAnimationTimeline(timeline_);
101 timeline_->AttachPlayer(player_); 123 timeline_->AttachPlayer(player_);
102 player_->AttachElement(element_id_); 124 player_->AttachElement(element_id_);
125 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(true));
126
127 host_->PushPropertiesTo(host_impl_);
128 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(false));
103 129
104 const float start_opacity = .7f; 130 const float start_opacity = .7f;
105 const float end_opacity = .3f; 131 const float end_opacity = .3f;
106 132
107 const float start_brightness = .6f; 133 const float start_brightness = .6f;
108 const float end_brightness = .4f; 134 const float end_brightness = .4f;
109 135
110 const int transform_x = 10; 136 const int transform_x = 10;
111 const int transform_y = 20; 137 const int transform_y = 20;
112 138
113 const double duration = 1.; 139 const double duration = 1.;
114 140
115 AddOpacityTransitionToPlayer(player_.get(), duration, start_opacity, 141 AddOpacityTransitionToPlayer(player_.get(), duration, start_opacity,
116 end_opacity, false); 142 end_opacity, false);
117 AddAnimatedTransformToPlayer(player_.get(), duration, transform_x, 143 AddAnimatedTransformToPlayer(player_.get(), duration, transform_x,
118 transform_y); 144 transform_y);
119 AddAnimatedFilterToPlayer(player_.get(), duration, start_brightness, 145 AddAnimatedFilterToPlayer(player_.get(), duration, start_brightness,
120 end_brightness); 146 end_brightness);
147 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(true));
121 148
122 host_->PushPropertiesTo(host_impl_); 149 host_->PushPropertiesTo(host_impl_);
150 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(false));
123 151
124 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE, 152 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE,
125 TargetProperty::OPACITY)); 153 TargetProperty::OPACITY));
126 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE, 154 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE,
127 TargetProperty::TRANSFORM)); 155 TargetProperty::TRANSFORM));
128 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE, 156 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE,
129 TargetProperty::FILTER)); 157 TargetProperty::FILTER));
130 158
131 EXPECT_FALSE(client_impl_.IsPropertyMutated( 159 EXPECT_FALSE(client_impl_.IsPropertyMutated(
132 element_id_, ElementListType::ACTIVE, TargetProperty::OPACITY)); 160 element_id_, ElementListType::ACTIVE, TargetProperty::OPACITY));
133 EXPECT_FALSE(client_impl_.IsPropertyMutated( 161 EXPECT_FALSE(client_impl_.IsPropertyMutated(
134 element_id_, ElementListType::ACTIVE, TargetProperty::TRANSFORM)); 162 element_id_, ElementListType::ACTIVE, TargetProperty::TRANSFORM));
135 EXPECT_FALSE(client_impl_.IsPropertyMutated( 163 EXPECT_FALSE(client_impl_.IsPropertyMutated(
136 element_id_, ElementListType::ACTIVE, TargetProperty::FILTER)); 164 element_id_, ElementListType::ACTIVE, TargetProperty::FILTER));
137 165
138 host_impl_->ActivateAnimations(); 166 host_impl_->ActivateAnimations();
139 167
140 base::TimeTicks time; 168 base::TimeTicks time;
141 time += base::TimeDelta::FromSecondsD(0.1); 169 time += base::TimeDelta::FromSecondsD(0.1);
142 AnimateLayersTransferEvents(time, 3u); 170 AnimateLayersTransferEvents(time, 3u);
171 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(false));
143 172
144 time += base::TimeDelta::FromSecondsD(duration); 173 time += base::TimeDelta::FromSecondsD(duration);
145 AnimateLayersTransferEvents(time, 3u); 174 AnimateLayersTransferEvents(time, 3u);
175 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(false));
146 176
147 client_.ExpectOpacityPropertyMutated(element_id_, ElementListType::ACTIVE, 177 client_.ExpectOpacityPropertyMutated(element_id_, ElementListType::ACTIVE,
148 end_opacity); 178 end_opacity);
149 client_.ExpectTransformPropertyMutated(element_id_, ElementListType::ACTIVE, 179 client_.ExpectTransformPropertyMutated(element_id_, ElementListType::ACTIVE,
150 transform_x, transform_y); 180 transform_x, transform_y);
151 client_.ExpectFilterPropertyMutated(element_id_, ElementListType::ACTIVE, 181 client_.ExpectFilterPropertyMutated(element_id_, ElementListType::ACTIVE,
152 end_brightness); 182 end_brightness);
153 183
154 client_impl_.ExpectOpacityPropertyMutated( 184 client_impl_.ExpectOpacityPropertyMutated(
155 element_id_, ElementListType::ACTIVE, end_opacity); 185 element_id_, ElementListType::ACTIVE, end_opacity);
(...skipping 17 matching lines...) Expand all
173 client_.RegisterElement(element_id_, ElementListType::ACTIVE); 203 client_.RegisterElement(element_id_, ElementListType::ACTIVE);
174 client_impl_.RegisterElement(element_id_, ElementListType::PENDING); 204 client_impl_.RegisterElement(element_id_, ElementListType::PENDING);
175 client_impl_.RegisterElement(element_id_, ElementListType::ACTIVE); 205 client_impl_.RegisterElement(element_id_, ElementListType::ACTIVE);
176 206
177 scoped_refptr<AnimationPlayer> player1 = 207 scoped_refptr<AnimationPlayer> player1 =
178 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); 208 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId());
179 scoped_refptr<AnimationPlayer> player2 = 209 scoped_refptr<AnimationPlayer> player2 =
180 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); 210 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId());
181 211
182 host_->AddAnimationTimeline(timeline_); 212 host_->AddAnimationTimeline(timeline_);
213
183 timeline_->AttachPlayer(player1); 214 timeline_->AttachPlayer(player1);
215 EXPECT_TRUE(timeline_->needs_push_properties());
216
184 timeline_->AttachPlayer(player2); 217 timeline_->AttachPlayer(player2);
218 EXPECT_TRUE(timeline_->needs_push_properties());
185 219
186 player1->set_animation_delegate(&delegate1); 220 player1->set_animation_delegate(&delegate1);
187 player2->set_animation_delegate(&delegate2); 221 player2->set_animation_delegate(&delegate2);
188 222
189 // Attach players to the same layer. 223 // Attach players to the same layer.
190 player1->AttachElement(element_id_); 224 player1->AttachElement(element_id_);
191 player2->AttachElement(element_id_); 225 player2->AttachElement(element_id_);
192 226
193 const float start_opacity = .7f; 227 const float start_opacity = .7f;
194 const float end_opacity = .3f; 228 const float end_opacity = .3f;
(...skipping 20 matching lines...) Expand all
215 base::TimeTicks time; 249 base::TimeTicks time;
216 time += base::TimeDelta::FromSecondsD(0.1); 250 time += base::TimeDelta::FromSecondsD(0.1);
217 AnimateLayersTransferEvents(time, 2u); 251 AnimateLayersTransferEvents(time, 2u);
218 252
219 EXPECT_TRUE(delegate1.started()); 253 EXPECT_TRUE(delegate1.started());
220 EXPECT_FALSE(delegate1.finished()); 254 EXPECT_FALSE(delegate1.finished());
221 255
222 EXPECT_TRUE(delegate2.started()); 256 EXPECT_TRUE(delegate2.started());
223 EXPECT_FALSE(delegate2.finished()); 257 EXPECT_FALSE(delegate2.finished());
224 258
259 EXPECT_FALSE(player1->needs_push_properties());
260 EXPECT_FALSE(player2->needs_push_properties());
261
225 time += base::TimeDelta::FromSecondsD(duration); 262 time += base::TimeDelta::FromSecondsD(duration);
226 AnimateLayersTransferEvents(time, 2u); 263 AnimateLayersTransferEvents(time, 2u);
227 264
228 EXPECT_TRUE(delegate1.finished()); 265 EXPECT_TRUE(delegate1.finished());
229 EXPECT_TRUE(delegate2.finished()); 266 EXPECT_TRUE(delegate2.finished());
230 267
268 EXPECT_FALSE(player1->needs_push_properties());
269 EXPECT_FALSE(player2->needs_push_properties());
270
231 client_.ExpectOpacityPropertyMutated(element_id_, ElementListType::ACTIVE, 271 client_.ExpectOpacityPropertyMutated(element_id_, ElementListType::ACTIVE,
232 end_opacity); 272 end_opacity);
233 client_.ExpectTransformPropertyMutated(element_id_, ElementListType::ACTIVE, 273 client_.ExpectTransformPropertyMutated(element_id_, ElementListType::ACTIVE,
234 transform_x, transform_y); 274 transform_x, transform_y);
235 275
236 client_impl_.ExpectOpacityPropertyMutated( 276 client_impl_.ExpectOpacityPropertyMutated(
237 element_id_, ElementListType::ACTIVE, end_opacity); 277 element_id_, ElementListType::ACTIVE, end_opacity);
238 client_impl_.ExpectTransformPropertyMutated( 278 client_impl_.ExpectTransformPropertyMutated(
239 element_id_, ElementListType::ACTIVE, transform_x, transform_y); 279 element_id_, ElementListType::ACTIVE, transform_x, transform_y);
240 280
(...skipping 10 matching lines...) Expand all
251 291
252 const double duration = 1.; 292 const double duration = 1.;
253 const float start_opacity = .7f; 293 const float start_opacity = .7f;
254 const float end_opacity = .3f; 294 const float end_opacity = .3f;
255 295
256 const int filter_id = 296 const int filter_id =
257 AddAnimatedFilterToPlayer(player_.get(), duration, 0.1f, 0.9f); 297 AddAnimatedFilterToPlayer(player_.get(), duration, 0.1f, 0.9f);
258 const int opacity_id = AddOpacityTransitionToPlayer( 298 const int opacity_id = AddOpacityTransitionToPlayer(
259 player_.get(), duration, start_opacity, end_opacity, false); 299 player_.get(), duration, start_opacity, end_opacity, false);
260 300
301 EXPECT_FALSE(player_->needs_push_properties());
302
261 host_->AddAnimationTimeline(timeline_); 303 host_->AddAnimationTimeline(timeline_);
262 timeline_->AttachPlayer(player_); 304 timeline_->AttachPlayer(player_);
263 305
306 EXPECT_FALSE(player_->needs_push_properties());
264 EXPECT_FALSE(player_->element_animations()); 307 EXPECT_FALSE(player_->element_animations());
265 player_->RemoveAnimation(filter_id); 308 player_->RemoveAnimation(filter_id);
309 EXPECT_FALSE(player_->needs_push_properties());
266 310
267 player_->AttachElement(element_id_); 311 player_->AttachElement(element_id_);
268 312
269 EXPECT_TRUE(player_->element_animations()); 313 EXPECT_TRUE(player_->element_animations());
270 EXPECT_FALSE(player_->element_animations() 314 EXPECT_FALSE(player_->element_animations()
271 ->GetAnimationById(filter_id)); 315 ->GetAnimationById(filter_id));
272 EXPECT_TRUE(player_->element_animations() 316 EXPECT_TRUE(player_->element_animations()
273 ->GetAnimationById(opacity_id)); 317 ->GetAnimationById(opacity_id));
318 EXPECT_TRUE(player_->needs_push_properties());
274 319
275 host_->PushPropertiesTo(host_impl_); 320 host_->PushPropertiesTo(host_impl_);
276 321
277 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE, 322 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE,
278 TargetProperty::OPACITY)); 323 TargetProperty::OPACITY));
279 EXPECT_FALSE(client_impl_.IsPropertyMutated( 324 EXPECT_FALSE(client_impl_.IsPropertyMutated(
280 element_id_, ElementListType::ACTIVE, TargetProperty::OPACITY)); 325 element_id_, ElementListType::ACTIVE, TargetProperty::OPACITY));
281 326
282 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE, 327 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE,
283 TargetProperty::FILTER)); 328 TargetProperty::FILTER));
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 385
341 GetImplTimelineAndPlayerByID(); 386 GetImplTimelineAndPlayerByID();
342 387
343 EXPECT_EQ(player_, GetPlayerForElementId(element_id_)); 388 EXPECT_EQ(player_, GetPlayerForElementId(element_id_));
344 EXPECT_TRUE(player_->element_animations()); 389 EXPECT_TRUE(player_->element_animations());
345 EXPECT_EQ(player_->element_id(), element_id_); 390 EXPECT_EQ(player_->element_id(), element_id_);
346 391
347 EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(element_id_)); 392 EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(element_id_));
348 EXPECT_TRUE(player_impl_->element_animations()); 393 EXPECT_TRUE(player_impl_->element_animations());
349 EXPECT_EQ(player_impl_->element_id(), element_id_); 394 EXPECT_EQ(player_impl_->element_id(), element_id_);
395 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(false));
350 396
351 const ElementId new_element_id(NextTestLayerId(), 0); 397 const ElementId new_element_id(NextTestLayerId(), 0);
352 player_->DetachElement(); 398 player_->DetachElement();
353 player_->AttachElement(new_element_id); 399 player_->AttachElement(new_element_id);
354 400
355 EXPECT_EQ(player_, GetPlayerForElementId(new_element_id)); 401 EXPECT_EQ(player_, GetPlayerForElementId(new_element_id));
356 EXPECT_TRUE(player_->element_animations()); 402 EXPECT_TRUE(player_->element_animations());
357 EXPECT_EQ(player_->element_id(), new_element_id); 403 EXPECT_EQ(player_->element_id(), new_element_id);
404 EXPECT_TRUE(CheckPlayerTimelineNeedsPushProperties(true));
358 405
359 host_->PushPropertiesTo(host_impl_); 406 host_->PushPropertiesTo(host_impl_);
360 407
361 EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(new_element_id)); 408 EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(new_element_id));
362 EXPECT_TRUE(player_impl_->element_animations()); 409 EXPECT_TRUE(player_impl_->element_animations());
363 EXPECT_EQ(player_impl_->element_id(), new_element_id); 410 EXPECT_EQ(player_impl_->element_id(), new_element_id);
364 } 411 }
365 412
366 } // namespace 413 } // namespace
367 } // namespace cc 414 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/animation_player.cc ('k') | cc/animation/animation_timeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698