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_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/system/toast/toast_manager.h" | 10 #include "ash/system/toast/toast_manager.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // doesn't return correct value. | 146 // doesn't return correct value. |
147 gfx::Rect shelf_bounds = shelf->GetIdealBounds(); | 147 gfx::Rect shelf_bounds = shelf->GetIdealBounds(); |
148 EXPECT_FALSE(toast_bounds.Intersects(shelf_bounds)); | 148 EXPECT_FALSE(toast_bounds.Intersects(shelf_bounds)); |
149 EXPECT_EQ(shelf_bounds.y() - 5, toast_bounds.bottom()); | 149 EXPECT_EQ(shelf_bounds.y() - 5, toast_bounds.bottom()); |
150 EXPECT_EQ(root_bounds.bottom() - shelf_bounds.height() - 5, | 150 EXPECT_EQ(root_bounds.bottom() - shelf_bounds.height() - 5, |
151 toast_bounds.bottom()); | 151 toast_bounds.bottom()); |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 TEST_F(ToastManagerTest, PositionWithAutoHiddenBottomShelf) { | 155 TEST_F(ToastManagerTest, PositionWithAutoHiddenBottomShelf) { |
156 scoped_ptr<aura::Window> window( | 156 std::unique_ptr<aura::Window> window( |
157 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4))); | 157 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4))); |
158 | 158 |
159 ShelfLayoutManager* shelf = | 159 ShelfLayoutManager* shelf = |
160 Shelf::ForPrimaryDisplay()->shelf_layout_manager(); | 160 Shelf::ForPrimaryDisplay()->shelf_layout_manager(); |
161 SetShelfAlignment(ash::SHELF_ALIGNMENT_BOTTOM); | 161 SetShelfAlignment(ash::SHELF_ALIGNMENT_BOTTOM); |
162 SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 162 SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
163 shelf->LayoutShelf(); | 163 shelf->LayoutShelf(); |
164 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); | 164 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); |
165 | 165 |
166 manager()->Show("DUMMY", kLongLongDuration /* prevent timeout */); | 166 manager()->Show("DUMMY", kLongLongDuration /* prevent timeout */); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // doesn't return correct value. | 255 // doesn't return correct value. |
256 gfx::Rect shelf_bounds = shelf->GetIdealBounds(); | 256 gfx::Rect shelf_bounds = shelf->GetIdealBounds(); |
257 EXPECT_FALSE(toast_bounds.Intersects(shelf_bounds)); | 257 EXPECT_FALSE(toast_bounds.Intersects(shelf_bounds)); |
258 EXPECT_EQ(shelf_bounds.y() - 5, toast_bounds.bottom()); | 258 EXPECT_EQ(shelf_bounds.y() - 5, toast_bounds.bottom()); |
259 EXPECT_EQ(root_bounds.bottom() - shelf_bounds.height() - 5, | 259 EXPECT_EQ(root_bounds.bottom() - shelf_bounds.height() - 5, |
260 toast_bounds.bottom()); | 260 toast_bounds.bottom()); |
261 } | 261 } |
262 } | 262 } |
263 | 263 |
264 } // namespace ash | 264 } // namespace ash |
OLD | NEW |