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

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

Issue 1944623002: CC Animation: Use ElementId to attach CC animation players. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@erasedomids
Patch Set: Let CC clients generate their own ElementIds locally. Created 4 years, 7 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
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/element_animations.h" 5 #include "cc/animation/element_animations.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_player.h" 10 #include "cc/animation/animation_player.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 scoped_refptr<ElementAnimations> animations_impl = element_animations_impl(); 390 scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
391 391
392 AnimationHost* host = client_.host(); 392 AnimationHost* host = client_.host();
393 AnimationHost* host_impl = client_impl_.host(); 393 AnimationHost* host_impl = client_impl_.host();
394 394
395 auto events = host_impl_->CreateEvents(); 395 auto events = host_impl_->CreateEvents();
396 396
397 EXPECT_EQ(1u, host->all_element_animations_for_testing().size()); 397 EXPECT_EQ(1u, host->all_element_animations_for_testing().size());
398 EXPECT_EQ(1u, host_impl->all_element_animations_for_testing().size()); 398 EXPECT_EQ(1u, host_impl->all_element_animations_for_testing().size());
399 399
400 // Initially, both animationss should be inactive. 400 // Initially, both animations should be inactive.
401 EXPECT_EQ(0u, host->active_element_animations_for_testing().size()); 401 EXPECT_EQ(0u, host->active_element_animations_for_testing().size());
402 EXPECT_EQ(0u, host_impl->active_element_animations_for_testing().size()); 402 EXPECT_EQ(0u, host_impl->active_element_animations_for_testing().size());
403 403
404 AddOpacityTransitionToElementAnimations(animations.get(), 1, 0, 1, false); 404 AddOpacityTransitionToElementAnimations(animations.get(), 1, 0, 1, false);
405 // The main thread animations should now be active. 405 // The main thread animations should now be active.
406 EXPECT_EQ(1u, host->active_element_animations_for_testing().size()); 406 EXPECT_EQ(1u, host->active_element_animations_for_testing().size());
407 407
408 animations->PushPropertiesTo(animations_impl.get()); 408 animations->PushPropertiesTo(animations_impl.get());
409 animations_impl->ActivateAnimations(); 409 animations_impl->ActivateAnimations();
410 // Both animationss should now be active. 410 // Both animations should now be active.
411 EXPECT_EQ(1u, host->active_element_animations_for_testing().size()); 411 EXPECT_EQ(1u, host->active_element_animations_for_testing().size());
412 EXPECT_EQ(1u, host_impl->active_element_animations_for_testing().size()); 412 EXPECT_EQ(1u, host_impl->active_element_animations_for_testing().size());
413 413
414 animations_impl->Animate(kInitialTickTime); 414 animations_impl->Animate(kInitialTickTime);
415 animations_impl->UpdateState(true, events.get()); 415 animations_impl->UpdateState(true, events.get());
416 EXPECT_EQ(1u, events->events_.size()); 416 EXPECT_EQ(1u, events->events_.size());
417 animations->NotifyAnimationStarted(events->events_[0]); 417 animations->NotifyAnimationStarted(events->events_[0]);
418 418
419 EXPECT_EQ(1u, host->active_element_animations_for_testing().size()); 419 EXPECT_EQ(1u, host->active_element_animations_for_testing().size());
420 EXPECT_EQ(1u, host_impl->active_element_animations_for_testing().size()); 420 EXPECT_EQ(1u, host_impl->active_element_animations_for_testing().size());
(...skipping 2819 matching lines...) Expand 10 before | Expand all | Expand 10 after
3240 EXPECT_FALSE(animations->IsPotentiallyAnimatingProperty( 3240 EXPECT_FALSE(animations->IsPotentiallyAnimatingProperty(
3241 TargetProperty::OPACITY, ElementListType::ACTIVE)); 3241 TargetProperty::OPACITY, ElementListType::ACTIVE));
3242 EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty( 3242 EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
3243 TargetProperty::OPACITY, ElementListType::PENDING)); 3243 TargetProperty::OPACITY, ElementListType::PENDING));
3244 EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty( 3244 EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
3245 TargetProperty::OPACITY, ElementListType::ACTIVE)); 3245 TargetProperty::OPACITY, ElementListType::ACTIVE));
3246 } 3246 }
3247 3247
3248 } // namespace 3248 } // namespace
3249 } // namespace cc 3249 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/element_animations.cc ('k') | cc/cc_tests.gyp » ('j') | cc/trees/layer_tree_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698