| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 3376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3387 TEST_F(WindowTest, WindowDestroyCompletesAnimations) { | 3387 TEST_F(WindowTest, WindowDestroyCompletesAnimations) { |
| 3388 ui::ScopedAnimationDurationScaleMode test_duration_mode( | 3388 ui::ScopedAnimationDurationScaleMode test_duration_mode( |
| 3389 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); | 3389 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); |
| 3390 scoped_refptr<ui::LayerAnimator> animator = | 3390 scoped_refptr<ui::LayerAnimator> animator = |
| 3391 ui::LayerAnimator::CreateImplicitAnimator(); | 3391 ui::LayerAnimator::CreateImplicitAnimator(); |
| 3392 TestLayerAnimationObserver observer; | 3392 TestLayerAnimationObserver observer; |
| 3393 animator->AddObserver(&observer); | 3393 animator->AddObserver(&observer); |
| 3394 // Make sure destroying a Window completes the animation. | 3394 // Make sure destroying a Window completes the animation. |
| 3395 { | 3395 { |
| 3396 scoped_ptr<Window> window(CreateTestWindowWithId(1, root_window())); | 3396 scoped_ptr<Window> window(CreateTestWindowWithId(1, root_window())); |
| 3397 window->layer()->SetAnimator(animator); | 3397 window->layer()->SetAnimator(animator.get()); |
| 3398 | 3398 |
| 3399 gfx::Transform transform; | 3399 gfx::Transform transform; |
| 3400 transform.Scale(0.5f, 0.5f); | 3400 transform.Scale(0.5f, 0.5f); |
| 3401 window->SetTransform(transform); | 3401 window->SetTransform(transform); |
| 3402 | 3402 |
| 3403 EXPECT_TRUE(animator->is_animating()); | 3403 EXPECT_TRUE(animator->is_animating()); |
| 3404 EXPECT_FALSE(observer.animation_completed()); | 3404 EXPECT_FALSE(observer.animation_completed()); |
| 3405 } | 3405 } |
| 3406 EXPECT_TRUE(animator); | 3406 EXPECT_TRUE(animator.get()); |
| 3407 EXPECT_FALSE(animator->is_animating()); | 3407 EXPECT_FALSE(animator->is_animating()); |
| 3408 EXPECT_TRUE(observer.animation_completed()); | 3408 EXPECT_TRUE(observer.animation_completed()); |
| 3409 EXPECT_FALSE(observer.animation_aborted()); | 3409 EXPECT_FALSE(observer.animation_aborted()); |
| 3410 animator->RemoveObserver(&observer); | 3410 animator->RemoveObserver(&observer); |
| 3411 observer.Reset(); | 3411 observer.Reset(); |
| 3412 | 3412 |
| 3413 animator = ui::LayerAnimator::CreateImplicitAnimator(); | 3413 animator = ui::LayerAnimator::CreateImplicitAnimator(); |
| 3414 animator->AddObserver(&observer); | 3414 animator->AddObserver(&observer); |
| 3415 ui::Layer layer; | 3415 ui::Layer layer; |
| 3416 layer.SetAnimator(animator); | 3416 layer.SetAnimator(animator.get()); |
| 3417 { | 3417 { |
| 3418 scoped_ptr<Window> window(CreateTestWindowWithId(1, root_window())); | 3418 scoped_ptr<Window> window(CreateTestWindowWithId(1, root_window())); |
| 3419 window->layer()->Add(&layer); | 3419 window->layer()->Add(&layer); |
| 3420 | 3420 |
| 3421 gfx::Transform transform; | 3421 gfx::Transform transform; |
| 3422 transform.Scale(0.5f, 0.5f); | 3422 transform.Scale(0.5f, 0.5f); |
| 3423 layer.SetTransform(transform); | 3423 layer.SetTransform(transform); |
| 3424 | 3424 |
| 3425 EXPECT_TRUE(animator->is_animating()); | 3425 EXPECT_TRUE(animator->is_animating()); |
| 3426 EXPECT_FALSE(observer.animation_completed()); | 3426 EXPECT_FALSE(observer.animation_completed()); |
| 3427 } | 3427 } |
| 3428 | 3428 |
| 3429 EXPECT_TRUE(animator); | 3429 EXPECT_TRUE(animator.get()); |
| 3430 EXPECT_FALSE(animator->is_animating()); | 3430 EXPECT_FALSE(animator->is_animating()); |
| 3431 EXPECT_TRUE(observer.animation_completed()); | 3431 EXPECT_TRUE(observer.animation_completed()); |
| 3432 EXPECT_FALSE(observer.animation_aborted()); | 3432 EXPECT_FALSE(observer.animation_aborted()); |
| 3433 animator->RemoveObserver(&observer); | 3433 animator->RemoveObserver(&observer); |
| 3434 } | 3434 } |
| 3435 | 3435 |
| 3436 } // namespace test | 3436 } // namespace test |
| 3437 } // namespace aura | 3437 } // namespace aura |
| OLD | NEW |