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

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

Issue 2165693002: Fix tests in when MD is set to EXPERIMENTAL by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments 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
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 216
217 TEST_F(ToastManagerTest, PositionWithVisibleLeftShelf) { 217 TEST_F(ToastManagerTest, PositionWithVisibleLeftShelf) {
218 WmShelf* shelf = GetPrimaryShelf(); 218 WmShelf* shelf = GetPrimaryShelf();
219 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); 219 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
220 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); 220 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
221 221
222 ShowToast("DUMMY", ToastData::kInfiniteDuration); 222 ShowToast("DUMMY", ToastData::kInfiniteDuration);
223 EXPECT_EQ(1, GetToastSerial()); 223 EXPECT_EQ(1, GetToastSerial());
224 224
225 gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen(); 225 gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen();
226 gfx::RectF precise_toast_bounds(toast_bounds);
226 gfx::Rect root_bounds = 227 gfx::Rect root_bounds =
227 ScreenUtil::GetShelfDisplayBoundsInRoot(Shell::GetPrimaryRootWindow()); 228 ScreenUtil::GetShelfDisplayBoundsInRoot(Shell::GetPrimaryRootWindow());
228 229
229 EXPECT_TRUE(toast_bounds.Intersects(shelf->GetUserWorkAreaBounds())); 230 EXPECT_TRUE(toast_bounds.Intersects(shelf->GetUserWorkAreaBounds()));
230 EXPECT_EQ(root_bounds.bottom() - 5, toast_bounds.bottom()); 231 EXPECT_EQ(root_bounds.bottom() - 5, toast_bounds.bottom());
231 232
232 if (SupportsHostWindowResize()) { 233 if (SupportsHostWindowResize()) {
233 // If host resize is not supported then calling WmShelf::GetIdealBounds() 234 // If host resize is not supported then calling WmShelf::GetIdealBounds()
234 // doesn't return correct value. 235 // doesn't return correct value.
235 gfx::Rect shelf_bounds = shelf->GetIdealBounds(); 236 gfx::Rect shelf_bounds = shelf->GetIdealBounds();
236 EXPECT_FALSE(toast_bounds.Intersects(shelf_bounds)); 237 EXPECT_FALSE(toast_bounds.Intersects(shelf_bounds));
237 EXPECT_EQ( 238 EXPECT_EQ(round(shelf_bounds.right() +
238 shelf_bounds.right() + (root_bounds.width() - shelf_bounds.width()) / 2, 239 (root_bounds.width() - shelf_bounds.width()) / 2.0),
239 toast_bounds.CenterPoint().x()); 240 round(precise_toast_bounds.CenterPoint().x()));
240 } 241 }
241 } 242 }
242 243
243 TEST_F(ToastManagerTest, PositionWithUnifiedDesktop) { 244 TEST_F(ToastManagerTest, PositionWithUnifiedDesktop) {
244 if (!SupportsMultipleDisplays()) 245 if (!SupportsMultipleDisplays())
245 return; 246 return;
246 247
247 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 248 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
248 display_manager->SetUnifiedDesktopEnabled(true); 249 display_manager->SetUnifiedDesktopEnabled(true);
249 UpdateDisplay("1000x500,0+600-100x500"); 250 UpdateDisplay("1000x500,0+600-100x500");
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 EXPECT_EQ("TEXT3", GetCurrentText()); 292 EXPECT_EQ("TEXT3", GetCurrentText());
292 // Cancel the shown toast. 293 // Cancel the shown toast.
293 CancelToast(id3); 294 CancelToast(id3);
294 // Confirm that the shown toast disappears. 295 // Confirm that the shown toast disappears.
295 EXPECT_FALSE(GetCurrentOverlay()); 296 EXPECT_FALSE(GetCurrentOverlay());
296 // Confirm that only 1 toast is shown. 297 // Confirm that only 1 toast is shown.
297 EXPECT_EQ(2, GetToastSerial()); 298 EXPECT_EQ(2, GetToastSerial());
298 } 299 }
299 300
300 } // namespace ash 301 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/test/ash_md_test_base.h » ('j') | ash/wm/workspace/workspace_window_resizer_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698