| OLD | NEW |
| 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_layout_manager.h" | 9 #include "ash/common/shelf/shelf_layout_manager.h" |
| 10 #include "ash/common/shelf/shelf_view.h" | 10 #include "ash/common/shelf/shelf_view.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 { | 82 { |
| 83 SCOPED_TRACE("Single Left"); | 83 SCOPED_TRACE("Single Left"); |
| 84 TestLauncherAlignment(WmShell::Get()->GetPrimaryRootWindow(), | 84 TestLauncherAlignment(WmShell::Get()->GetPrimaryRootWindow(), |
| 85 SHELF_ALIGNMENT_LEFT, | 85 SHELF_ALIGNMENT_LEFT, |
| 86 gfx::Rect(kShelfSize, 0, 353 + offset, 400)); | 86 gfx::Rect(kShelfSize, 0, 353 + offset, 400)); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 TEST_P(ShelfWidgetTest, TestAlignmentForMultipleDisplays) { | 90 TEST_P(ShelfWidgetTest, TestAlignmentForMultipleDisplays) { |
| 91 if (!SupportsMultipleDisplays()) | |
| 92 return; | |
| 93 | |
| 94 // Note that for a left- and right-aligned shelf, this offset must be | 91 // Note that for a left- and right-aligned shelf, this offset must be |
| 95 // applied to a maximized window's width rather than its height. | 92 // applied to a maximized window's width rather than its height. |
| 96 const int offset = GetMdMaximizedWindowHeightOffset(); | 93 const int offset = GetMdMaximizedWindowHeightOffset(); |
| 97 const int kShelfSize = GetShelfConstant(SHELF_SIZE); | 94 const int kShelfSize = GetShelfConstant(SHELF_SIZE); |
| 98 UpdateDisplay("300x300,500x500"); | 95 UpdateDisplay("300x300,500x500"); |
| 99 std::vector<WmWindow*> root_windows = WmShell::Get()->GetAllRootWindows(); | 96 std::vector<WmWindow*> root_windows = WmShell::Get()->GetAllRootWindows(); |
| 100 { | 97 { |
| 101 SCOPED_TRACE("Primary Bottom"); | 98 SCOPED_TRACE("Primary Bottom"); |
| 102 TestLauncherAlignment(root_windows[0], SHELF_ALIGNMENT_BOTTOM, | 99 TestLauncherAlignment(root_windows[0], SHELF_ALIGNMENT_BOTTOM, |
| 103 gfx::Rect(0, 0, 300, 253 + offset)); | 100 gfx::Rect(0, 0, 300, 253 + offset)); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 params.context = CurrentContext(); | 159 params.context = CurrentContext(); |
| 163 // Widget is now owned by the parent window. | 160 // Widget is now owned by the parent window. |
| 164 widget->Init(params); | 161 widget->Init(params); |
| 165 widget->SetFullscreen(true); | 162 widget->SetFullscreen(true); |
| 166 } | 163 } |
| 167 | 164 |
| 168 // Verifies shelf is created with correct size after user login and when its | 165 // Verifies shelf is created with correct size after user login and when its |
| 169 // container and status widget has finished sizing. | 166 // container and status widget has finished sizing. |
| 170 // See http://crbug.com/252533 | 167 // See http://crbug.com/252533 |
| 171 TEST_P(ShelfWidgetTest, ShelfInitiallySizedAfterLogin) { | 168 TEST_P(ShelfWidgetTest, ShelfInitiallySizedAfterLogin) { |
| 172 if (!SupportsMultipleDisplays()) | |
| 173 return; | |
| 174 | |
| 175 SetUserLoggedIn(false); | 169 SetUserLoggedIn(false); |
| 176 UpdateDisplay("300x200,400x300"); | 170 UpdateDisplay("300x200,400x300"); |
| 177 | 171 |
| 178 // Both displays have a shelf controller. | 172 // Both displays have a shelf controller. |
| 179 std::vector<WmWindow*> roots = WmShell::Get()->GetAllRootWindows(); | 173 std::vector<WmWindow*> roots = WmShell::Get()->GetAllRootWindows(); |
| 180 WmShelf* shelf1 = WmShelf::ForWindow(roots[0]); | 174 WmShelf* shelf1 = WmShelf::ForWindow(roots[0]); |
| 181 WmShelf* shelf2 = WmShelf::ForWindow(roots[1]); | 175 WmShelf* shelf2 = WmShelf::ForWindow(roots[1]); |
| 182 ASSERT_TRUE(shelf1); | 176 ASSERT_TRUE(shelf1); |
| 183 ASSERT_TRUE(shelf2); | 177 ASSERT_TRUE(shelf2); |
| 184 | 178 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 } | 428 } |
| 435 | 429 |
| 436 TEST_P(ShelfWidgetTestWithInitializer, CreateLockedShelf) { | 430 TEST_P(ShelfWidgetTestWithInitializer, CreateLockedShelf) { |
| 437 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. | 431 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. |
| 438 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM_LOCKED, | 432 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM_LOCKED, |
| 439 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | 433 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, |
| 440 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); | 434 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); |
| 441 } | 435 } |
| 442 | 436 |
| 443 } // namespace ash | 437 } // namespace ash |
| OLD | NEW |