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(); |
239 } | 244 } |
240 | 245 |
241 TEST_F(ToastManagerTest, PositionWithUnifiedDesktop) { | 246 TEST_F(ToastManagerTest, PositionWithUnifiedDesktop) { |
242 if (!SupportsMultipleDisplays()) | 247 if (!SupportsMultipleDisplays()) |
243 return; | 248 return; |
244 | 249 |
245 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 250 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
246 display_manager->SetUnifiedDesktopEnabled(true); | 251 display_manager->SetUnifiedDesktopEnabled(true); |
247 UpdateDisplay("1000x500,0+600-100x500"); | 252 UpdateDisplay("1000x500,0+600-100x500"); |
248 | 253 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 EXPECT_EQ(base::ASCIIToUTF16("TEXT3"), GetCurrentText()); | 289 EXPECT_EQ(base::ASCIIToUTF16("TEXT3"), GetCurrentText()); |
285 // Cancel the shown toast. | 290 // Cancel the shown toast. |
286 CancelToast(id3); | 291 CancelToast(id3); |
287 // Confirm that the shown toast disappears. | 292 // Confirm that the shown toast disappears. |
288 EXPECT_FALSE(GetCurrentOverlay()); | 293 EXPECT_FALSE(GetCurrentOverlay()); |
289 // Confirm that only 1 toast is shown. | 294 // Confirm that only 1 toast is shown. |
290 EXPECT_EQ(2, GetToastSerial()); | 295 EXPECT_EQ(2, GetToastSerial()); |
291 } | 296 } |
292 | 297 |
293 } // namespace ash | 298 } // namespace ash |
OLD | NEW |