| 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_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" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 void TestLauncherAlignment(WmWindow* root, | 53 void TestLauncherAlignment(WmWindow* root, |
| 54 ShelfAlignment alignment, | 54 ShelfAlignment alignment, |
| 55 const gfx::Rect& expected) { | 55 const gfx::Rect& expected) { |
| 56 root->GetRootWindowController()->GetShelf()->SetAlignment(alignment); | 56 root->GetRootWindowController()->GetShelf()->SetAlignment(alignment); |
| 57 EXPECT_EQ(expected.ToString(), | 57 EXPECT_EQ(expected.ToString(), |
| 58 root->GetDisplayNearestWindow().work_area().ToString()); | 58 root->GetDisplayNearestWindow().work_area().ToString()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 TEST_P(ShelfWidgetTest, TestAlignment) { | 61 TEST_P(ShelfWidgetTest, TestAlignment) { |
| 62 if (!SupportsHostWindowResize()) | |
| 63 return; | |
| 64 | |
| 65 // Note that for a left- and right-aligned shelf, this offset must be | 62 // Note that for a left- and right-aligned shelf, this offset must be |
| 66 // applied to a maximized window's width rather than its height. | 63 // applied to a maximized window's width rather than its height. |
| 67 const int offset = GetMdMaximizedWindowHeightOffset(); | 64 const int offset = GetMdMaximizedWindowHeightOffset(); |
| 68 const int kShelfSize = GetShelfConstant(SHELF_SIZE); | 65 const int kShelfSize = GetShelfConstant(SHELF_SIZE); |
| 69 UpdateDisplay("400x400"); | 66 UpdateDisplay("400x400"); |
| 70 { | 67 { |
| 71 SCOPED_TRACE("Single Bottom"); | 68 SCOPED_TRACE("Single Bottom"); |
| 72 TestLauncherAlignment(WmShell::Get()->GetPrimaryRootWindow(), | 69 TestLauncherAlignment(WmShell::Get()->GetPrimaryRootWindow(), |
| 73 SHELF_ALIGNMENT_BOTTOM, | 70 SHELF_ALIGNMENT_BOTTOM, |
| 74 gfx::Rect(0, 0, 400, 353 + offset)); | 71 gfx::Rect(0, 0, 400, 353 + offset)); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 const int status_width2 = | 204 const int status_width2 = |
| 208 shelf_widget2->status_area_widget()->GetWindowBoundsInScreen().width(); | 205 shelf_widget2->status_area_widget()->GetWindowBoundsInScreen().width(); |
| 209 EXPECT_GT(status_width2, 0); | 206 EXPECT_GT(status_width2, 0); |
| 210 EXPECT_EQ(shelf_widget2->GetContentsView()->width(), | 207 EXPECT_EQ(shelf_widget2->GetContentsView()->width(), |
| 211 shelf2->GetShelfViewForTesting()->width() + status_width2); | 208 shelf2->GetShelfViewForTesting()->width() + status_width2); |
| 212 } | 209 } |
| 213 | 210 |
| 214 // Tests that the shelf lets mouse-events close to the edge fall through to the | 211 // Tests that the shelf lets mouse-events close to the edge fall through to the |
| 215 // window underneath. | 212 // window underneath. |
| 216 TEST_P(ShelfWidgetTest, ShelfEdgeOverlappingWindowHitTestMouse) { | 213 TEST_P(ShelfWidgetTest, ShelfEdgeOverlappingWindowHitTestMouse) { |
| 217 if (!SupportsHostWindowResize()) | |
| 218 return; | |
| 219 | |
| 220 UpdateDisplay("400x400"); | 214 UpdateDisplay("400x400"); |
| 221 ShelfWidget* shelf_widget = GetShelfWidget(); | 215 ShelfWidget* shelf_widget = GetShelfWidget(); |
| 222 gfx::Rect shelf_bounds = shelf_widget->GetWindowBoundsInScreen(); | 216 gfx::Rect shelf_bounds = shelf_widget->GetWindowBoundsInScreen(); |
| 223 | 217 |
| 224 EXPECT_TRUE(!shelf_bounds.IsEmpty()); | 218 EXPECT_TRUE(!shelf_bounds.IsEmpty()); |
| 225 ShelfLayoutManager* shelf_layout_manager = | 219 ShelfLayoutManager* shelf_layout_manager = |
| 226 shelf_widget->shelf_layout_manager(); | 220 shelf_widget->shelf_layout_manager(); |
| 227 ASSERT_TRUE(shelf_layout_manager); | 221 ASSERT_TRUE(shelf_layout_manager); |
| 228 EXPECT_EQ(SHELF_VISIBLE, shelf_layout_manager->visibility_state()); | 222 EXPECT_EQ(SHELF_VISIBLE, shelf_layout_manager->visibility_state()); |
| 229 | 223 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 490 } |
| 497 | 491 |
| 498 TEST_P(ShelfWidgetTestWithDelegate, CreateLockedShelf) { | 492 TEST_P(ShelfWidgetTestWithDelegate, CreateLockedShelf) { |
| 499 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. | 493 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. |
| 500 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM_LOCKED, | 494 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM_LOCKED, |
| 501 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | 495 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, |
| 502 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); | 496 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); |
| 503 } | 497 } |
| 504 | 498 |
| 505 } // namespace ash | 499 } // namespace ash |
| OLD | NEW |