Chromium Code Reviews| Index: ash/wm/window_animations_unittest.cc |
| diff --git a/ash/wm/window_animations_unittest.cc b/ash/wm/window_animations_unittest.cc |
| index 0a5f62569d2767c6ca48f3359436339e751ec6ca..b4a2618012b922bf10ab26b91392f204f8971f17 100644 |
| --- a/ash/wm/window_animations_unittest.cc |
| +++ b/ash/wm/window_animations_unittest.cc |
| @@ -19,7 +19,18 @@ using ui::Layer; |
| namespace ash { |
| namespace internal { |
| -typedef ash::test::AshTestBase WindowAnimationsTest; |
| +class WindowAnimationsTest : public ash::test::AshTestBase { |
| + public: |
| + WindowAnimationsTest() {} |
| + |
| + virtual void TearDown() OVERRIDE { |
| + ui::LayerAnimator::set_disable_animations_for_test(true); |
| + AshTestBase::TearDown(); |
| + } |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(WindowAnimationsTest); |
| +}; |
| TEST_F(WindowAnimationsTest, HideShow) { |
| scoped_ptr<aura::Window> window( |
| @@ -140,7 +151,7 @@ TEST_F(WindowAnimationsTest, LayerTargetVisibility) { |
| } |
| TEST_F(WindowAnimationsTest, CrossFadeToBounds) { |
| - internal::SetDelayedOldLayerDeletionInCrossFadeForTest(true); |
| + ui::LayerAnimator::set_disable_animations_for_test(false); |
| scoped_ptr<Window> window( |
| aura::test::CreateTestWindowWithId(0, NULL)); |
| @@ -165,8 +176,11 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) { |
| EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity()); |
| EXPECT_EQ(ui::Transform(), window->layer()->GetTargetTransform()); |
| - // Allow the animation observer to delete itself. |
| - RunAllPendingInMessageLoop(); |
| + // Run the animations to completion. |
| + static_cast<ui::AnimationContainerElement*>(old_layer->GetAnimator())->Step( |
|
sky
2012/08/25 16:01:43
The old code is fine, but this better matches what
|
| + base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); |
| + static_cast<ui::AnimationContainerElement*>(window->layer()->GetAnimator())-> |
| + Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); |
| // Cross fade to a smaller size, as in a restore animation. |
| old_layer = window->layer(); |
| @@ -184,8 +198,10 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) { |
| EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity()); |
| EXPECT_EQ(ui::Transform(), window->layer()->GetTargetTransform()); |
| - RunAllPendingInMessageLoop(); |
| - internal::SetDelayedOldLayerDeletionInCrossFadeForTest(false); |
| + static_cast<ui::AnimationContainerElement*>(old_layer->GetAnimator())->Step( |
| + base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); |
| + static_cast<ui::AnimationContainerElement*>(window->layer()->GetAnimator())-> |
| + Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); |
| } |
| TEST_F(WindowAnimationsTest, GetCrossFadeDuration) { |