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

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

Issue 1998933002: Update shelf spacing in Chrome OS according to the MD specs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 6 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/system/status_area_widget_delegate.cc ('k') | ash/system/tray/tray_background_view.cc » ('j') | 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/display/display_manager.h" 6 #include "ash/display/display_manager.h"
6 #include "ash/screen_util.h" 7 #include "ash/screen_util.h"
7 #include "ash/shelf/shelf.h" 8 #include "ash/shelf/shelf.h"
8 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/system/toast/toast_manager.h" 11 #include "ash/system/toast/toast_manager.h"
11 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
12 #include "base/run_loop.h" 13 #include "base/run_loop.h"
13 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
14 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 15 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 200
200 ShowToast("DUMMY", ToastData::kInfiniteDuration); 201 ShowToast("DUMMY", ToastData::kInfiniteDuration);
201 EXPECT_EQ(1, GetToastSerial()); 202 EXPECT_EQ(1, GetToastSerial());
202 203
203 gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen(); 204 gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen();
204 gfx::Rect root_bounds = 205 gfx::Rect root_bounds =
205 ScreenUtil::GetShelfDisplayBoundsInRoot(Shell::GetPrimaryRootWindow()); 206 ScreenUtil::GetShelfDisplayBoundsInRoot(Shell::GetPrimaryRootWindow());
206 207
207 EXPECT_TRUE(toast_bounds.Intersects(shelf->user_work_area_bounds())); 208 EXPECT_TRUE(toast_bounds.Intersects(shelf->user_work_area_bounds()));
208 EXPECT_NEAR(root_bounds.CenterPoint().x(), toast_bounds.CenterPoint().x(), 1); 209 EXPECT_NEAR(root_bounds.CenterPoint().x(), toast_bounds.CenterPoint().x(), 1);
209 EXPECT_EQ(root_bounds.bottom() - ShelfLayoutManager::kAutoHideSize - 5, 210 EXPECT_EQ(root_bounds.bottom() - kShelfAutoHideSize - 5,
210 toast_bounds.bottom()); 211 toast_bounds.bottom());
211 } 212 }
212 213
213 TEST_F(ToastManagerTest, PositionWithHiddenBottomShelf) { 214 TEST_F(ToastManagerTest, PositionWithHiddenBottomShelf) {
214 ShelfLayoutManager* shelf = 215 ShelfLayoutManager* shelf =
215 Shelf::ForPrimaryDisplay()->shelf_layout_manager(); 216 Shelf::ForPrimaryDisplay()->shelf_layout_manager();
216 SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); 217 SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN);
217 SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM); 218 SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM);
218 SetShelfState(ash::SHELF_HIDDEN); 219 SetShelfState(ash::SHELF_HIDDEN);
219 220
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 EXPECT_EQ("TEXT3", GetCurrentText()); 309 EXPECT_EQ("TEXT3", GetCurrentText());
309 // Cancel the shown toast. 310 // Cancel the shown toast.
310 CancelToast(id3); 311 CancelToast(id3);
311 // Confirm that the shown toast disappears. 312 // Confirm that the shown toast disappears.
312 EXPECT_FALSE(GetCurrentOverlay()); 313 EXPECT_FALSE(GetCurrentOverlay());
313 // Confirm that only 1 toast is shown. 314 // Confirm that only 1 toast is shown.
314 EXPECT_EQ(2, GetToastSerial()); 315 EXPECT_EQ(2, GetToastSerial());
315 } 316 }
316 317
317 } // namespace ash 318 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/status_area_widget_delegate.cc ('k') | ash/system/tray/tray_background_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698