Chromium Code Reviews| 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/display/display_manager.h" | 5 #include "ash/display/display_manager.h" |
| 6 #include "ash/screen_util.h" | 6 #include "ash/screen_util.h" |
| 7 #include "ash/shelf/shelf.h" | 7 #include "ash/shelf/shelf.h" |
| 8 #include "ash/shelf/shelf_constants.h" | |
|
tdanderson
2016/06/10 22:54:43
file moved to ash/common
yiyix
2016/06/13 18:43:55
Done.
| |
| 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" |
| 15 | 16 |
| 16 namespace ash { | 17 namespace ash { |
| 17 | 18 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 | 190 |
| 190 ShowToast("DUMMY", kLongLongDuration /* prevent timeout */); | 191 ShowToast("DUMMY", kLongLongDuration /* prevent timeout */); |
| 191 EXPECT_EQ(1, GetToastSerial()); | 192 EXPECT_EQ(1, GetToastSerial()); |
| 192 | 193 |
| 193 gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen(); | 194 gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen(); |
| 194 gfx::Rect root_bounds = | 195 gfx::Rect root_bounds = |
| 195 ScreenUtil::GetShelfDisplayBoundsInRoot(Shell::GetPrimaryRootWindow()); | 196 ScreenUtil::GetShelfDisplayBoundsInRoot(Shell::GetPrimaryRootWindow()); |
| 196 | 197 |
| 197 EXPECT_TRUE(toast_bounds.Intersects(shelf->user_work_area_bounds())); | 198 EXPECT_TRUE(toast_bounds.Intersects(shelf->user_work_area_bounds())); |
| 198 EXPECT_NEAR(root_bounds.CenterPoint().x(), toast_bounds.CenterPoint().x(), 1); | 199 EXPECT_NEAR(root_bounds.CenterPoint().x(), toast_bounds.CenterPoint().x(), 1); |
| 199 EXPECT_EQ(root_bounds.bottom() - ShelfLayoutManager::kAutoHideSize - 5, | 200 EXPECT_EQ(root_bounds.bottom() - kShelfAutoHideSize - 5, |
| 200 toast_bounds.bottom()); | 201 toast_bounds.bottom()); |
| 201 } | 202 } |
| 202 | 203 |
| 203 TEST_F(ToastManagerTest, PositionWithHiddenBottomShelf) { | 204 TEST_F(ToastManagerTest, PositionWithHiddenBottomShelf) { |
| 204 ShelfLayoutManager* shelf = | 205 ShelfLayoutManager* shelf = |
| 205 Shelf::ForPrimaryDisplay()->shelf_layout_manager(); | 206 Shelf::ForPrimaryDisplay()->shelf_layout_manager(); |
| 206 SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); | 207 SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); |
| 207 SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM); | 208 SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM); |
| 208 SetShelfState(ash::SHELF_HIDDEN); | 209 SetShelfState(ash::SHELF_HIDDEN); |
| 209 | 210 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 EXPECT_EQ("TEXT3", GetCurrentText()); | 299 EXPECT_EQ("TEXT3", GetCurrentText()); |
| 299 // Cancel the shown toast. | 300 // Cancel the shown toast. |
| 300 CancelToast(id3); | 301 CancelToast(id3); |
| 301 // Confirm that the shown toast disappears. | 302 // Confirm that the shown toast disappears. |
| 302 EXPECT_FALSE(GetCurrentOverlay()); | 303 EXPECT_FALSE(GetCurrentOverlay()); |
| 303 // Confirm that only 1 toast is shown. | 304 // Confirm that only 1 toast is shown. |
| 304 EXPECT_EQ(2, GetToastSerial()); | 305 EXPECT_EQ(2, GetToastSerial()); |
| 305 } | 306 } |
| 306 | 307 |
| 307 } // namespace ash | 308 } // namespace ash |
| OLD | NEW |