Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: ash/shelf/shelf_widget_unittest.cc

Issue 2293183002: ash: Remove ash::Shelf in favor of ash::WmShelf (Closed)
Patch Set: rebase again Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/shelf/shelf_view_unittest.cc ('k') | ash/shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_widget.h" 5 #include "ash/common/shelf/shelf_widget.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/shelf/shelf_constants.h" 8 #include "ash/common/shelf/shelf_constants.h"
9 #include "ash/common/shelf/shelf_delegate.h" 9 #include "ash/common/shelf/shelf_delegate.h"
10 #include "ash/common/shelf/shelf_layout_manager.h" 10 #include "ash/common/shelf/shelf_layout_manager.h"
11 #include "ash/common/shelf/shelf_view.h" 11 #include "ash/common/shelf/shelf_view.h"
12 #include "ash/common/shelf/wm_shelf.h" 12 #include "ash/common/shelf/wm_shelf.h"
13 #include "ash/common/system/status_area_widget.h" 13 #include "ash/common/system/status_area_widget.h"
14 #include "ash/common/wm_root_window_controller.h" 14 #include "ash/common/wm_root_window_controller.h"
15 #include "ash/common/wm_shell.h" 15 #include "ash/common/wm_shell.h"
16 #include "ash/common/wm_window.h" 16 #include "ash/common/wm_window.h"
17 #include "ash/root_window_controller.h" 17 #include "ash/root_window_controller.h"
18 #include "ash/shell.h" 18 #include "ash/shell.h"
19 #include "ash/test/ash_md_test_base.h" 19 #include "ash/test/ash_md_test_base.h"
20 #include "ash/test/ash_test_helper.h" 20 #include "ash/test/ash_test_helper.h"
21 #include "ash/test/shelf_test_api.h"
22 #include "ash/test/shelf_view_test_api.h" 21 #include "ash/test/shelf_view_test_api.h"
23 #include "ash/test/test_shell_delegate.h" 22 #include "ash/test/test_shell_delegate.h"
24 #include "ash/wm/window_util.h" 23 #include "ash/wm/window_util.h"
25 #include "ui/aura/window_event_dispatcher.h" 24 #include "ui/aura/window_event_dispatcher.h"
26 #include "ui/display/display.h" 25 #include "ui/display/display.h"
27 #include "ui/events/event_utils.h" 26 #include "ui/events/event_utils.h"
28 #include "ui/views/view.h" 27 #include "ui/views/view.h"
29 #include "ui/views/widget/widget.h" 28 #include "ui/views/widget/widget.h"
30 29
31 namespace ash { 30 namespace ash {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // Verifies shelf is created with correct size after user login and when its 174 // Verifies shelf is created with correct size after user login and when its
176 // container and status widget has finished sizing. 175 // container and status widget has finished sizing.
177 // See http://crbug.com/252533 176 // See http://crbug.com/252533
178 TEST_P(ShelfWidgetTest, ShelfInitiallySizedAfterLogin) { 177 TEST_P(ShelfWidgetTest, ShelfInitiallySizedAfterLogin) {
179 if (!SupportsMultipleDisplays()) 178 if (!SupportsMultipleDisplays())
180 return; 179 return;
181 180
182 SetUserLoggedIn(false); 181 SetUserLoggedIn(false);
183 UpdateDisplay("300x200,400x300"); 182 UpdateDisplay("300x200,400x300");
184 183
185 ShelfWidget* shelf_widget = nullptr; 184 // Both displays have a shelf controller.
186 Shell::RootWindowControllerList controllers( 185 std::vector<WmWindow*> roots = WmShell::Get()->GetAllRootWindows();
187 Shell::GetAllRootWindowControllers()); 186 WmShelf* shelf1 = WmShelf::ForWindow(roots[0]);
188 for (Shell::RootWindowControllerList::const_iterator i = controllers.begin(); 187 WmShelf* shelf2 = WmShelf::ForWindow(roots[1]);
189 i != controllers.end(); ++i) { 188 ASSERT_TRUE(shelf1);
190 if (!(*i)->shelf_widget()->shelf()) { 189 ASSERT_TRUE(shelf2);
191 shelf_widget = (*i)->shelf_widget(); 190
192 break; 191 // Both shelf controllers have a shelf widget.
193 } 192 ShelfWidget* shelf_widget1 = shelf1->shelf_widget();
194 } 193 ShelfWidget* shelf_widget2 = shelf2->shelf_widget();
195 ASSERT_TRUE(shelf_widget); 194 ASSERT_TRUE(shelf_widget1);
195 ASSERT_TRUE(shelf_widget2);
196 196
197 SetUserLoggedIn(true); 197 SetUserLoggedIn(true);
198 Shell::GetInstance()->CreateShelf(); 198 Shell::GetInstance()->CreateShelf();
199 199
200 Shelf* shelf = shelf_widget->shelf(); 200 // The shelf view and status area horizontally fill the shelf widget.
201 ASSERT_TRUE(shelf); 201 const int status_width1 =
202 shelf_widget1->status_area_widget()->GetWindowBoundsInScreen().width();
203 EXPECT_GT(status_width1, 0);
204 EXPECT_EQ(shelf_widget1->GetContentsView()->width(),
205 shelf1->GetShelfViewForTesting()->width() + status_width1);
202 206
203 const int status_width = 207 const int status_width2 =
204 shelf_widget->status_area_widget()->GetWindowBoundsInScreen().width(); 208 shelf_widget2->status_area_widget()->GetWindowBoundsInScreen().width();
205 EXPECT_GT(status_width, 0); 209 EXPECT_GT(status_width2, 0);
206 EXPECT_EQ(status_width, shelf_widget->GetContentsView()->width() - 210 EXPECT_EQ(shelf_widget2->GetContentsView()->width(),
207 test::ShelfTestAPI(shelf).shelf_view()->width()); 211 shelf2->GetShelfViewForTesting()->width() + status_width2);
208 } 212 }
209 213
210 // Tests that the shelf lets mouse-events close to the edge fall through to the 214 // Tests that the shelf lets mouse-events close to the edge fall through to the
211 // window underneath. 215 // window underneath.
212 TEST_P(ShelfWidgetTest, ShelfEdgeOverlappingWindowHitTestMouse) { 216 TEST_P(ShelfWidgetTest, ShelfEdgeOverlappingWindowHitTestMouse) {
213 if (!SupportsHostWindowResize()) 217 if (!SupportsHostWindowResize())
214 return; 218 return;
215 219
216 UpdateDisplay("400x400"); 220 UpdateDisplay("400x400");
217 ShelfWidget* shelf_widget = GetShelfWidget(); 221 ShelfWidget* shelf_widget = GetShelfWidget();
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 492 }
489 493
490 TEST_P(ShelfWidgetTestWithDelegate, CreateLockedShelf) { 494 TEST_P(ShelfWidgetTestWithDelegate, CreateLockedShelf) {
491 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. 495 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior.
492 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM_LOCKED, 496 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM_LOCKED,
493 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, 497 SHELF_AUTO_HIDE_BEHAVIOR_NEVER,
494 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); 498 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN);
495 } 499 }
496 500
497 } // namespace ash 501 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view_unittest.cc ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698