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

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

Issue 2377223002: CC Animations: Rewrite unit tests to work with AnimationPlayer. (Closed)
Patch Set: Reparent. Created 4 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/animation/animation_player.cc ('k') | cc/animation/element_animations.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"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 client_.RegisterElement(element_id_, ElementListType::ACTIVE); 288 client_.RegisterElement(element_id_, ElementListType::ACTIVE);
289 client_impl_.RegisterElement(element_id_, ElementListType::PENDING); 289 client_impl_.RegisterElement(element_id_, ElementListType::PENDING);
290 client_impl_.RegisterElement(element_id_, ElementListType::ACTIVE); 290 client_impl_.RegisterElement(element_id_, ElementListType::ACTIVE);
291 291
292 const double duration = 1.; 292 const double duration = 1.;
293 const float start_opacity = .7f; 293 const float start_opacity = .7f;
294 const float end_opacity = .3f; 294 const float end_opacity = .3f;
295 295
296 const int filter_id = 296 const int filter_id =
297 AddAnimatedFilterToPlayer(player_.get(), duration, 0.1f, 0.9f); 297 AddAnimatedFilterToPlayer(player_.get(), duration, 0.1f, 0.9f);
298 const int opacity_id = AddOpacityTransitionToPlayer( 298 AddOpacityTransitionToPlayer(player_.get(), duration, start_opacity,
299 player_.get(), duration, start_opacity, end_opacity, false); 299 end_opacity, false);
300 300
301 EXPECT_FALSE(player_->needs_push_properties()); 301 EXPECT_FALSE(player_->needs_push_properties());
302 302
303 host_->AddAnimationTimeline(timeline_); 303 host_->AddAnimationTimeline(timeline_);
304 timeline_->AttachPlayer(player_); 304 timeline_->AttachPlayer(player_);
305 305
306 EXPECT_FALSE(player_->needs_push_properties()); 306 EXPECT_FALSE(player_->needs_push_properties());
307 EXPECT_FALSE(player_->element_animations()); 307 EXPECT_FALSE(player_->element_animations());
308 player_->RemoveAnimation(filter_id); 308 player_->RemoveAnimation(filter_id);
309 EXPECT_FALSE(player_->needs_push_properties()); 309 EXPECT_FALSE(player_->needs_push_properties());
310 310
311 player_->AttachElement(element_id_); 311 player_->AttachElement(element_id_);
312 312
313 EXPECT_TRUE(player_->element_animations()); 313 EXPECT_TRUE(player_->element_animations());
314 EXPECT_FALSE(player_->element_animations() 314 EXPECT_FALSE(player_->element_animations()->HasAnyAnimationTargetingProperty(
315 ->GetAnimationById(filter_id)); 315 TargetProperty::FILTER));
316 EXPECT_TRUE(player_->element_animations() 316 EXPECT_TRUE(player_->element_animations()->HasAnyAnimationTargetingProperty(
317 ->GetAnimationById(opacity_id)); 317 TargetProperty::OPACITY));
318 EXPECT_TRUE(player_->needs_push_properties()); 318 EXPECT_TRUE(player_->needs_push_properties());
319 319
320 host_->PushPropertiesTo(host_impl_); 320 host_->PushPropertiesTo(host_impl_);
321 321
322 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE, 322 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE,
323 TargetProperty::OPACITY)); 323 TargetProperty::OPACITY));
324 EXPECT_FALSE(client_impl_.IsPropertyMutated( 324 EXPECT_FALSE(client_impl_.IsPropertyMutated(
325 element_id_, ElementListType::ACTIVE, TargetProperty::OPACITY)); 325 element_id_, ElementListType::ACTIVE, TargetProperty::OPACITY));
326 326
327 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE, 327 EXPECT_FALSE(client_.IsPropertyMutated(element_id_, ElementListType::ACTIVE,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 405
406 host_->PushPropertiesTo(host_impl_); 406 host_->PushPropertiesTo(host_impl_);
407 407
408 EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(new_element_id)); 408 EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(new_element_id));
409 EXPECT_TRUE(player_impl_->element_animations()); 409 EXPECT_TRUE(player_impl_->element_animations());
410 EXPECT_EQ(player_impl_->element_id(), new_element_id); 410 EXPECT_EQ(player_impl_->element_id(), new_element_id);
411 } 411 }
412 412
413 } // namespace 413 } // namespace
414 } // namespace cc 414 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/animation_player.cc ('k') | cc/animation/element_animations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698