| 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 a605e11a7ffb767fc9bef3dae52945e851d85a7f..d31eccb84a188a7e33b53cf906d3ab97777edc14 100644
|
| --- a/ash/system/toast/toast_manager_unittest.cc
|
| +++ b/ash/system/toast/toast_manager_unittest.cc
|
| @@ -10,6 +10,7 @@
|
| #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"
|
|
|
| namespace ash {
|
|
|
| @@ -83,7 +84,6 @@ class ToastManagerTest : public test::AshTestBase {
|
|
|
| TEST_F(ToastManagerTest, ShowAndCloseAutomatically) {
|
| manager()->Show("DUMMY", 10);
|
| - base::RunLoop().RunUntilIdle();
|
|
|
| EXPECT_EQ(1, GetToastId());
|
|
|
| @@ -93,10 +93,28 @@ TEST_F(ToastManagerTest, ShowAndCloseAutomatically) {
|
|
|
| TEST_F(ToastManagerTest, ShowAndCloseManually) {
|
| manager()->Show("DUMMY", kLongLongDuration /* prevent timeout */);
|
| +
|
| + EXPECT_EQ(1, GetToastId());
|
| +
|
| + EXPECT_FALSE(GetCurrentWidget()->GetLayer()->GetAnimator()->is_animating());
|
| +
|
| + ClickDismissButton();
|
| +
|
| + EXPECT_EQ(nullptr, GetCurrentOverlay());
|
| +}
|
| +
|
| +TEST_F(ToastManagerTest, ShowAndCloseManuallyDuringAnimation) {
|
| + ui::ScopedAnimationDurationScaleMode slow_animation_duration(
|
| + ui::ScopedAnimationDurationScaleMode::SLOW_DURATION);
|
| +
|
| + manager()->Show("DUMMY", kLongLongDuration /* prevent timeout */);
|
| + EXPECT_TRUE(GetCurrentWidget()->GetLayer()->GetAnimator()->is_animating());
|
| base::RunLoop().RunUntilIdle();
|
|
|
| EXPECT_EQ(1, GetToastId());
|
| + EXPECT_TRUE(GetCurrentWidget()->GetLayer()->GetAnimator()->is_animating());
|
|
|
| + // Close it during animation.
|
| ClickDismissButton();
|
|
|
| while (GetCurrentOverlay() != nullptr)
|
| @@ -108,9 +126,7 @@ TEST_F(ToastManagerTest, QueueMessage) {
|
| manager()->Show("DUMMY2", 10);
|
| manager()->Show("DUMMY3", 10);
|
|
|
| - while (GetToastId() != 1)
|
| - base::RunLoop().RunUntilIdle();
|
| -
|
| + EXPECT_EQ(1, GetToastId());
|
| EXPECT_EQ("DUMMY1", GetCurrentText());
|
|
|
| while (GetToastId() != 2)
|
| @@ -131,7 +147,6 @@ TEST_F(ToastManagerTest, PositionWithVisibleBottomShelf) {
|
| SetShelfAlignment(ash::SHELF_ALIGNMENT_BOTTOM);
|
|
|
| manager()->Show("DUMMY", kLongLongDuration /* prevent timeout */);
|
| - base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(1, GetToastId());
|
|
|
| gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen();
|
| @@ -164,7 +179,6 @@ TEST_F(ToastManagerTest, PositionWithAutoHiddenBottomShelf) {
|
| EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
|
|
|
| manager()->Show("DUMMY", kLongLongDuration /* prevent timeout */);
|
| - base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(1, GetToastId());
|
|
|
| gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen();
|
| @@ -185,7 +199,6 @@ TEST_F(ToastManagerTest, PositionWithHiddenBottomShelf) {
|
| SetShelfState(ash::SHELF_HIDDEN);
|
|
|
| manager()->Show("DUMMY", kLongLongDuration /* prevent timeout */);
|
| - base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(1, GetToastId());
|
|
|
| gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen();
|
| @@ -204,7 +217,6 @@ TEST_F(ToastManagerTest, PositionWithVisibleLeftShelf) {
|
| SetShelfAlignment(ash::SHELF_ALIGNMENT_LEFT);
|
|
|
| manager()->Show("DUMMY", kLongLongDuration /* prevent timeout */);
|
| - base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(1, GetToastId());
|
|
|
| gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen();
|
| @@ -239,7 +251,6 @@ TEST_F(ToastManagerTest, PositionWithUnifiedDesktop) {
|
| SetShelfAlignment(ash::SHELF_ALIGNMENT_BOTTOM);
|
|
|
| manager()->Show("DUMMY", kLongLongDuration /* prevent timeout */);
|
| - base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(1, GetToastId());
|
|
|
| gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen();
|
|
|