| Index: ash/system/toast/toast_manager_unittest.cc
|
| diff --git a/ash/system/toast/toast_manager_unittest.cc b/ash/system/toast/toast_manager_unittest.cc
|
| index 99d4ad0b2b92e1ac14614216654f5f00d8cf6839..0aa8c6a76ad63381584349c19ecbd2fbaa759cb8 100644
|
| --- a/ash/system/toast/toast_manager_unittest.cc
|
| +++ b/ash/system/toast/toast_manager_unittest.cc
|
| @@ -10,6 +10,8 @@
|
| #include "ash/system/toast/toast_manager.h"
|
| #include "ash/test/ash_test_base.h"
|
| #include "base/run_loop.h"
|
| +#include "ui/compositor/scoped_animation_duration_scale_mode.h"
|
| +#include "ui/compositor/scoped_layer_animation_settings.h"
|
|
|
| namespace ash {
|
|
|
| @@ -35,6 +37,8 @@ class ToastManagerTest : public test::AshTestBase {
|
|
|
| manager_->ResetToastIdForTesting();
|
| EXPECT_EQ(0, GetToastId());
|
| + test_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode(
|
| + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION));
|
| }
|
|
|
| protected:
|
| @@ -78,6 +82,8 @@ class ToastManagerTest : public test::AshTestBase {
|
| private:
|
| ToastManager* manager_ = nullptr;
|
|
|
| + scoped_ptr<ui::ScopedAnimationDurationScaleMode> test_duration_mode_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(ToastManagerTest);
|
| };
|
|
|
| @@ -97,6 +103,26 @@ TEST_F(ToastManagerTest, ShowAndCloseManually) {
|
|
|
| EXPECT_EQ(1, GetToastId());
|
|
|
| + while (GetCurrentWidget()->GetLayer()->GetAnimator()->is_animating())
|
| + base::RunLoop().RunUntilIdle();
|
| +
|
| + ClickDismissButton();
|
| +
|
| + while (GetCurrentOverlay() != nullptr)
|
| + base::RunLoop().RunUntilIdle();
|
| +}
|
| +
|
| +TEST_F(ToastManagerTest, ShowAndCloseManuallyDuringAnimation) {
|
| + ui::ScopedAnimationDurationScaleMode slow_animation_duration(
|
| + ui::ScopedAnimationDurationScaleMode::SLOW_DURATION);
|
| +
|
| + manager()->Show("DUMMY", kLongLongDuration /* prevent timeout */);
|
| + base::RunLoop().RunUntilIdle();
|
| +
|
| + EXPECT_EQ(1, GetToastId());
|
| + EXPECT_TRUE(GetCurrentWidget()->GetLayer()->GetAnimator()->is_animating());
|
| +
|
| + // Close it during animation.
|
| ClickDismissButton();
|
|
|
| while (GetCurrentOverlay() != nullptr)
|
|
|