| 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/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 EXPECT_EQ(root_bounds.bottom() - 5, toast_bounds.bottom()); | 248 EXPECT_EQ(root_bounds.bottom() - 5, toast_bounds.bottom()); |
| 249 | 249 |
| 250 gfx::Rect shelf_bounds = shelf->GetIdealBounds(); | 250 gfx::Rect shelf_bounds = shelf->GetIdealBounds(); |
| 251 EXPECT_FALSE(toast_bounds.Intersects(shelf_bounds)); | 251 EXPECT_FALSE(toast_bounds.Intersects(shelf_bounds)); |
| 252 EXPECT_NEAR( | 252 EXPECT_NEAR( |
| 253 shelf_bounds.right() + (root_bounds.width() - shelf_bounds.width()) / 2.0, | 253 shelf_bounds.right() + (root_bounds.width() - shelf_bounds.width()) / 2.0, |
| 254 precise_toast_bounds.CenterPoint().x(), 1.f /* accepted error */); | 254 precise_toast_bounds.CenterPoint().x(), 1.f /* accepted error */); |
| 255 } | 255 } |
| 256 | 256 |
| 257 TEST_F(ToastManagerTest, PositionWithUnifiedDesktop) { | 257 TEST_F(ToastManagerTest, PositionWithUnifiedDesktop) { |
| 258 if (!SupportsMultipleDisplays()) | |
| 259 return; | |
| 260 display_manager()->SetUnifiedDesktopEnabled(true); | 258 display_manager()->SetUnifiedDesktopEnabled(true); |
| 261 UpdateDisplay("1000x500,0+600-100x500"); | 259 UpdateDisplay("1000x500,0+600-100x500"); |
| 262 | 260 |
| 263 WmShelf* shelf = GetPrimaryShelf(); | 261 WmShelf* shelf = GetPrimaryShelf(); |
| 264 EXPECT_EQ(SHELF_ALIGNMENT_BOTTOM, shelf->GetAlignment()); | 262 EXPECT_EQ(SHELF_ALIGNMENT_BOTTOM, shelf->GetAlignment()); |
| 265 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 263 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 266 | 264 |
| 267 ShowToast("DUMMY", ToastData::kInfiniteDuration); | 265 ShowToast("DUMMY", ToastData::kInfiniteDuration); |
| 268 EXPECT_EQ(1, GetToastSerial()); | 266 EXPECT_EQ(1, GetToastSerial()); |
| 269 | 267 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 298 EXPECT_EQ(base::ASCIIToUTF16("TEXT3"), GetCurrentText()); | 296 EXPECT_EQ(base::ASCIIToUTF16("TEXT3"), GetCurrentText()); |
| 299 // Cancel the shown toast. | 297 // Cancel the shown toast. |
| 300 CancelToast(id3); | 298 CancelToast(id3); |
| 301 // Confirm that the shown toast disappears. | 299 // Confirm that the shown toast disappears. |
| 302 EXPECT_FALSE(GetCurrentOverlay()); | 300 EXPECT_FALSE(GetCurrentOverlay()); |
| 303 // Confirm that only 1 toast is shown. | 301 // Confirm that only 1 toast is shown. |
| 304 EXPECT_EQ(2, GetToastSerial()); | 302 EXPECT_EQ(2, GetToastSerial()); |
| 305 } | 303 } |
| 306 | 304 |
| 307 } // namespace ash | 305 } // namespace ash |
| OLD | NEW |