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/common/wm/wm_screen_util.h" | 8 #include "ash/common/wm/wm_screen_util.h" |
9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 gfx::RectF precise_toast_bounds(toast_bounds); | 228 gfx::RectF precise_toast_bounds(toast_bounds); |
229 gfx::Rect root_bounds = wm::GetDisplayBoundsWithShelf(shelf->GetWindow()); | 229 gfx::Rect root_bounds = wm::GetDisplayBoundsWithShelf(shelf->GetWindow()); |
230 | 230 |
231 EXPECT_TRUE(toast_bounds.Intersects(shelf->GetUserWorkAreaBounds())); | 231 EXPECT_TRUE(toast_bounds.Intersects(shelf->GetUserWorkAreaBounds())); |
232 EXPECT_EQ(root_bounds.bottom() - 5, toast_bounds.bottom()); | 232 EXPECT_EQ(root_bounds.bottom() - 5, toast_bounds.bottom()); |
233 | 233 |
234 gfx::Rect shelf_bounds = shelf->GetIdealBounds(); | 234 gfx::Rect shelf_bounds = shelf->GetIdealBounds(); |
235 EXPECT_FALSE(toast_bounds.Intersects(shelf_bounds)); | 235 EXPECT_FALSE(toast_bounds.Intersects(shelf_bounds)); |
236 EXPECT_EQ(round(shelf_bounds.right() + | 236 EXPECT_EQ(round(shelf_bounds.right() + |
237 (root_bounds.width() - shelf_bounds.width()) / 2.0), | 237 (root_bounds.width() - shelf_bounds.width()) / 2.0), |
238 round(precise_toast_bounds.CenterPoint().x())) | 238 round(precise_toast_bounds.CenterPoint().x())); |
239 << "Shelf right bound: " << shelf_bounds.right() | |
240 << "\nRoot width: " << root_bounds.width() | |
241 << "\nShelf width: " << shelf_bounds.width() | |
242 << "\nPrecise toast center x position: " | |
243 << precise_toast_bounds.CenterPoint().x(); | |
244 } | 239 } |
245 | 240 |
246 TEST_F(ToastManagerTest, PositionWithUnifiedDesktop) { | 241 TEST_F(ToastManagerTest, PositionWithUnifiedDesktop) { |
247 if (!SupportsMultipleDisplays()) | 242 if (!SupportsMultipleDisplays()) |
248 return; | 243 return; |
249 | 244 |
250 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 245 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
251 display_manager->SetUnifiedDesktopEnabled(true); | 246 display_manager->SetUnifiedDesktopEnabled(true); |
252 UpdateDisplay("1000x500,0+600-100x500"); | 247 UpdateDisplay("1000x500,0+600-100x500"); |
253 | 248 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 EXPECT_EQ(base::ASCIIToUTF16("TEXT3"), GetCurrentText()); | 284 EXPECT_EQ(base::ASCIIToUTF16("TEXT3"), GetCurrentText()); |
290 // Cancel the shown toast. | 285 // Cancel the shown toast. |
291 CancelToast(id3); | 286 CancelToast(id3); |
292 // Confirm that the shown toast disappears. | 287 // Confirm that the shown toast disappears. |
293 EXPECT_FALSE(GetCurrentOverlay()); | 288 EXPECT_FALSE(GetCurrentOverlay()); |
294 // Confirm that only 1 toast is shown. | 289 // Confirm that only 1 toast is shown. |
295 EXPECT_EQ(2, GetToastSerial()); | 290 EXPECT_EQ(2, GetToastSerial()); |
296 } | 291 } |
297 | 292 |
298 } // namespace ash | 293 } // namespace ash |
OLD | NEW |