| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/common/shelf/shelf_constants.h" | 5 #include "ash/common/shelf/shelf_constants.h" |
| 6 #include "ash/common/shelf/wm_shelf.h" | 6 #include "ash/common/shelf/wm_shelf.h" |
| 7 #include "ash/common/system/toast/toast_manager.h" | 7 #include "ash/common/system/toast/toast_manager.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 ui::ScopedAnimationDurationScaleMode slow_animation_duration( | 115 ui::ScopedAnimationDurationScaleMode slow_animation_duration( |
| 116 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION); | 116 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION); |
| 117 | 117 |
| 118 ShowToast("DUMMY", ToastData::kInfiniteDuration); | 118 ShowToast("DUMMY", ToastData::kInfiniteDuration); |
| 119 EXPECT_TRUE(GetCurrentWidget()->GetLayer()->GetAnimator()->is_animating()); | 119 EXPECT_TRUE(GetCurrentWidget()->GetLayer()->GetAnimator()->is_animating()); |
| 120 base::RunLoop().RunUntilIdle(); | 120 base::RunLoop().RunUntilIdle(); |
| 121 | 121 |
| 122 EXPECT_EQ(1, GetToastSerial()); | 122 EXPECT_EQ(1, GetToastSerial()); |
| 123 EXPECT_TRUE(GetCurrentWidget()->GetLayer()->GetAnimator()->is_animating()); | 123 EXPECT_TRUE(GetCurrentWidget()->GetLayer()->GetAnimator()->is_animating()); |
| 124 | 124 |
| 125 // Close it during animation. | 125 // Try to close it during animation. |
| 126 ClickDismissButton(); | 126 ClickDismissButton(); |
| 127 | 127 |
| 128 while (GetCurrentOverlay() != nullptr) | 128 while (GetCurrentWidget()->GetLayer()->GetAnimator()->is_animating()) |
| 129 base::RunLoop().RunUntilIdle(); | 129 base::RunLoop().RunUntilIdle(); |
| 130 |
| 131 // Toast isn't closed. |
| 132 EXPECT_TRUE(GetCurrentOverlay() != nullptr); |
| 130 } | 133 } |
| 131 | 134 |
| 132 TEST_F(ToastManagerTest, QueueMessage) { | 135 TEST_F(ToastManagerTest, QueueMessage) { |
| 133 ShowToast("DUMMY1", 10); | 136 ShowToast("DUMMY1", 10); |
| 134 ShowToast("DUMMY2", 10); | 137 ShowToast("DUMMY2", 10); |
| 135 ShowToast("DUMMY3", 10); | 138 ShowToast("DUMMY3", 10); |
| 136 | 139 |
| 137 EXPECT_EQ(1, GetToastSerial()); | 140 EXPECT_EQ(1, GetToastSerial()); |
| 138 EXPECT_EQ("DUMMY1", GetCurrentText()); | 141 EXPECT_EQ("DUMMY1", GetCurrentText()); |
| 139 | 142 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 EXPECT_EQ("TEXT3", GetCurrentText()); | 294 EXPECT_EQ("TEXT3", GetCurrentText()); |
| 292 // Cancel the shown toast. | 295 // Cancel the shown toast. |
| 293 CancelToast(id3); | 296 CancelToast(id3); |
| 294 // Confirm that the shown toast disappears. | 297 // Confirm that the shown toast disappears. |
| 295 EXPECT_FALSE(GetCurrentOverlay()); | 298 EXPECT_FALSE(GetCurrentOverlay()); |
| 296 // Confirm that only 1 toast is shown. | 299 // Confirm that only 1 toast is shown. |
| 297 EXPECT_EQ(2, GetToastSerial()); | 300 EXPECT_EQ(2, GetToastSerial()); |
| 298 } | 301 } |
| 299 | 302 |
| 300 } // namespace ash | 303 } // namespace ash |
| OLD | NEW |