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

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

Issue 1881373002: CC Animation: Erase AnimationRegistrar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@private
Patch Set: Created 4 years, 8 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/layer_animation_controller.cc ('k') | cc/cc.gyp » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layer_animation_controller.h" 5 #include "cc/animation/layer_animation_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "cc/animation/animation.h" 10 #include "cc/animation/animation.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 FakeLayerAnimationValueObserver dummy_impl; 225 FakeLayerAnimationValueObserver dummy_impl;
226 scoped_refptr<LayerAnimationController> controller_impl( 226 scoped_refptr<LayerAnimationController> controller_impl(
227 LayerAnimationController::Create(0)); 227 LayerAnimationController::Create(0));
228 controller_impl->AddValueObserver(&dummy_impl); 228 controller_impl->AddValueObserver(&dummy_impl);
229 FakeLayerAnimationValueObserver dummy; 229 FakeLayerAnimationValueObserver dummy;
230 scoped_refptr<LayerAnimationController> controller( 230 scoped_refptr<LayerAnimationController> controller(
231 LayerAnimationController::Create(0)); 231 LayerAnimationController::Create(0));
232 controller->AddValueObserver(&dummy); 232 controller->AddValueObserver(&dummy);
233 std::unique_ptr<AnimationEvents> events = host->CreateEvents(); 233 std::unique_ptr<AnimationEvents> events = host->CreateEvents();
234 234
235 host->SetAnimationRegistrarFor(controller); 235 controller->SetAnimationHost(host.get());
236 host_impl->SetAnimationRegistrarFor(controller_impl); 236 controller_impl->SetAnimationHost(host_impl.get());
237 EXPECT_EQ(1u, host->all_animation_controllers_for_testing().size()); 237 EXPECT_EQ(1u, host->all_animation_controllers_for_testing().size());
238 EXPECT_EQ(1u, host_impl->all_animation_controllers_for_testing().size()); 238 EXPECT_EQ(1u, host_impl->all_animation_controllers_for_testing().size());
239 239
240 // Initially, both controllers should be inactive. 240 // Initially, both controllers should be inactive.
241 EXPECT_EQ(0u, host->active_animation_controllers_for_testing().size()); 241 EXPECT_EQ(0u, host->active_animation_controllers_for_testing().size());
242 EXPECT_EQ(0u, host_impl->active_animation_controllers_for_testing().size()); 242 EXPECT_EQ(0u, host_impl->active_animation_controllers_for_testing().size());
243 243
244 AddOpacityTransitionToController(controller.get(), 1, 0, 1, false); 244 AddOpacityTransitionToController(controller.get(), 1, 0, 1, false);
245 // The main thread controller should now be active. 245 // The main thread controller should now be active.
246 EXPECT_EQ(1u, host->active_animation_controllers_for_testing().size()); 246 EXPECT_EQ(1u, host->active_animation_controllers_for_testing().size());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // The main thread controller should have de-activated. 290 // The main thread controller should have de-activated.
291 EXPECT_EQ(0u, host->active_animation_controllers_for_testing().size()); 291 EXPECT_EQ(0u, host->active_animation_controllers_for_testing().size());
292 292
293 controller->PushAnimationUpdatesTo(controller_impl.get()); 293 controller->PushAnimationUpdatesTo(controller_impl.get());
294 controller_impl->ActivateAnimations(); 294 controller_impl->ActivateAnimations();
295 EXPECT_FALSE(controller->has_any_animation()); 295 EXPECT_FALSE(controller->has_any_animation());
296 EXPECT_FALSE(controller_impl->has_any_animation()); 296 EXPECT_FALSE(controller_impl->has_any_animation());
297 EXPECT_EQ(0u, host->active_animation_controllers_for_testing().size()); 297 EXPECT_EQ(0u, host->active_animation_controllers_for_testing().size());
298 EXPECT_EQ(0u, host_impl->active_animation_controllers_for_testing().size()); 298 EXPECT_EQ(0u, host_impl->active_animation_controllers_for_testing().size());
299 299
300 host->ResetAnimationRegistrarFor(controller); 300 controller->SetAnimationHost(nullptr);
301 host_impl->ResetAnimationRegistrarFor(controller_impl); 301 controller_impl->SetAnimationHost(nullptr);
302 } 302 }
303 303
304 TEST(LayerAnimationControllerTest, SyncPause) { 304 TEST(LayerAnimationControllerTest, SyncPause) {
305 FakeLayerAnimationValueObserver dummy_impl; 305 FakeLayerAnimationValueObserver dummy_impl;
306 scoped_refptr<LayerAnimationController> controller_impl( 306 scoped_refptr<LayerAnimationController> controller_impl(
307 LayerAnimationController::Create(0)); 307 LayerAnimationController::Create(0));
308 controller_impl->AddValueObserver(&dummy_impl); 308 controller_impl->AddValueObserver(&dummy_impl);
309 FakeLayerAnimationValueObserver dummy; 309 FakeLayerAnimationValueObserver dummy;
310 scoped_refptr<LayerAnimationController> controller( 310 scoped_refptr<LayerAnimationController> controller(
311 LayerAnimationController::Create(0)); 311 LayerAnimationController::Create(0));
(...skipping 2809 matching lines...) Expand 10 before | Expand all | Expand 10 after
3121 TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE)); 3121 TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
3122 EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty( 3122 EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
3123 TargetProperty::OPACITY, 3123 TargetProperty::OPACITY,
3124 LayerAnimationController::ObserverType::PENDING)); 3124 LayerAnimationController::ObserverType::PENDING));
3125 EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty( 3125 EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
3126 TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE)); 3126 TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
3127 } 3127 }
3128 3128
3129 } // namespace 3129 } // namespace
3130 } // namespace cc 3130 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/layer_animation_controller.cc ('k') | cc/cc.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698