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

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

Issue 1700653002: CC Animation: Expose TargetProperty enum to be aliased in Blink Platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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
« no previous file with comments | « cc/animation/animation_player.cc ('k') | cc/animation/animation_unittest.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 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_registrar.h" 10 #include "cc/animation/animation_registrar.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 AddOpacityTransitionToPlayer(player_.get(), duration, start_opacity, 116 AddOpacityTransitionToPlayer(player_.get(), duration, start_opacity,
117 end_opacity, false); 117 end_opacity, false);
118 AddAnimatedTransformToPlayer(player_.get(), duration, transform_x, 118 AddAnimatedTransformToPlayer(player_.get(), duration, transform_x,
119 transform_y); 119 transform_y);
120 AddAnimatedFilterToPlayer(player_.get(), duration, start_brightness, 120 AddAnimatedFilterToPlayer(player_.get(), duration, start_brightness,
121 end_brightness); 121 end_brightness);
122 122
123 host_->PushPropertiesTo(host_impl_); 123 host_->PushPropertiesTo(host_impl_);
124 124
125 EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 125 EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
126 Animation::OPACITY)); 126 TargetProperty::OPACITY));
127 EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 127 EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
128 Animation::TRANSFORM)); 128 TargetProperty::TRANSFORM));
129 EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 129 EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
130 Animation::FILTER)); 130 TargetProperty::FILTER));
131 131
132 EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 132 EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
133 Animation::OPACITY)); 133 TargetProperty::OPACITY));
134 EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 134 EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
135 Animation::TRANSFORM)); 135 TargetProperty::TRANSFORM));
136 EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 136 EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
137 Animation::FILTER)); 137 TargetProperty::FILTER));
138 138
139 host_impl_->animation_registrar()->ActivateAnimations(); 139 host_impl_->animation_registrar()->ActivateAnimations();
140 140
141 base::TimeTicks time; 141 base::TimeTicks time;
142 time += base::TimeDelta::FromSecondsD(0.1); 142 time += base::TimeDelta::FromSecondsD(0.1);
143 AnimateLayersTransferEvents(time, 3u); 143 AnimateLayersTransferEvents(time, 3u);
144 144
145 time += base::TimeDelta::FromSecondsD(duration); 145 time += base::TimeDelta::FromSecondsD(duration);
146 AnimateLayersTransferEvents(time, 3u); 146 AnimateLayersTransferEvents(time, 3u);
147 147
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 EXPECT_FALSE(player_->element_animations() 271 EXPECT_FALSE(player_->element_animations()
272 ->layer_animation_controller() 272 ->layer_animation_controller()
273 ->GetAnimationById(filter_id)); 273 ->GetAnimationById(filter_id));
274 EXPECT_TRUE(player_->element_animations() 274 EXPECT_TRUE(player_->element_animations()
275 ->layer_animation_controller() 275 ->layer_animation_controller()
276 ->GetAnimationById(opacity_id)); 276 ->GetAnimationById(opacity_id));
277 277
278 host_->PushPropertiesTo(host_impl_); 278 host_->PushPropertiesTo(host_impl_);
279 279
280 EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 280 EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
281 Animation::OPACITY)); 281 TargetProperty::OPACITY));
282 EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 282 EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
283 Animation::OPACITY)); 283 TargetProperty::OPACITY));
284 284
285 EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 285 EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
286 Animation::FILTER)); 286 TargetProperty::FILTER));
287 EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 287 EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
288 Animation::FILTER)); 288 TargetProperty::FILTER));
289 289
290 host_impl_->animation_registrar()->ActivateAnimations(); 290 host_impl_->animation_registrar()->ActivateAnimations();
291 291
292 base::TimeTicks time; 292 base::TimeTicks time;
293 time += base::TimeDelta::FromSecondsD(0.1); 293 time += base::TimeDelta::FromSecondsD(0.1);
294 AnimateLayersTransferEvents(time, 1u); 294 AnimateLayersTransferEvents(time, 1u);
295 295
296 time += base::TimeDelta::FromSecondsD(duration); 296 time += base::TimeDelta::FromSecondsD(duration);
297 AnimateLayersTransferEvents(time, 1u); 297 AnimateLayersTransferEvents(time, 1u);
298 298
299 client_.ExpectOpacityPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 299 client_.ExpectOpacityPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
300 end_opacity); 300 end_opacity);
301 client_impl_.ExpectOpacityPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 301 client_impl_.ExpectOpacityPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
302 end_opacity); 302 end_opacity);
303 client_impl_.ExpectOpacityPropertyMutated(layer_id_, LayerTreeType::PENDING, 303 client_impl_.ExpectOpacityPropertyMutated(layer_id_, LayerTreeType::PENDING,
304 end_opacity); 304 end_opacity);
305 305
306 EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 306 EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
307 Animation::FILTER)); 307 TargetProperty::FILTER));
308 EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE, 308 EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
309 Animation::FILTER)); 309 TargetProperty::FILTER));
310 } 310 }
311 311
312 TEST_F(AnimationPlayerTest, AddRemoveAnimationCausesSetNeedsCommit) { 312 TEST_F(AnimationPlayerTest, AddRemoveAnimationCausesSetNeedsCommit) {
313 client_.RegisterLayer(layer_id_, LayerTreeType::ACTIVE); 313 client_.RegisterLayer(layer_id_, LayerTreeType::ACTIVE);
314 host_->AddAnimationTimeline(timeline_); 314 host_->AddAnimationTimeline(timeline_);
315 timeline_->AttachPlayer(player_); 315 timeline_->AttachPlayer(player_);
316 player_->AttachLayer(layer_id_); 316 player_->AttachLayer(layer_id_);
317 317
318 EXPECT_FALSE(client_.mutators_need_commit()); 318 EXPECT_FALSE(client_.mutators_need_commit());
319 319
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 361
362 host_->PushPropertiesTo(host_impl_); 362 host_->PushPropertiesTo(host_impl_);
363 363
364 EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(new_layer_id)); 364 EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(new_layer_id));
365 EXPECT_TRUE(player_impl_->element_animations()); 365 EXPECT_TRUE(player_impl_->element_animations());
366 EXPECT_EQ(player_impl_->layer_id(), new_layer_id); 366 EXPECT_EQ(player_impl_->layer_id(), new_layer_id);
367 } 367 }
368 368
369 } // namespace 369 } // namespace
370 } // namespace cc 370 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/animation_player.cc ('k') | cc/animation/animation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698