Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: ash/system/toast/toast_manager_unittest.cc

Issue 2150603003: Prevent hiding a toast during animation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test failures Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/common/system/toast/toast_overlay.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ash/common/system/toast/toast_overlay.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698