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/shelf/shelf_widget.h" | 5 #include "ash/shelf/shelf_widget.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shelf/shelf_constants.h" | 8 #include "ash/shelf/shelf_constants.h" |
9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shelf/shelf_view.h" | 10 #include "ash/shelf/shelf_view.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 void TestLauncherAlignment(WmWindow* root, | 42 void TestLauncherAlignment(WmWindow* root, |
43 ShelfAlignment alignment, | 43 ShelfAlignment alignment, |
44 const gfx::Rect& expected) { | 44 const gfx::Rect& expected) { |
45 root->GetRootWindowController()->GetShelf()->SetAlignment(alignment); | 45 root->GetRootWindowController()->GetShelf()->SetAlignment(alignment); |
46 EXPECT_EQ(expected.ToString(), | 46 EXPECT_EQ(expected.ToString(), |
47 root->GetDisplayNearestWindow().work_area().ToString()); | 47 root->GetDisplayNearestWindow().work_area().ToString()); |
48 } | 48 } |
49 | 49 |
50 TEST_F(ShelfWidgetTest, TestAlignment) { | 50 TEST_F(ShelfWidgetTest, TestAlignment) { |
51 const int kShelfSize = GetShelfConstant(SHELF_SIZE); | |
52 UpdateDisplay("400x400"); | 51 UpdateDisplay("400x400"); |
53 { | 52 { |
54 SCOPED_TRACE("Single Bottom"); | 53 SCOPED_TRACE("Single Bottom"); |
55 TestLauncherAlignment(ShellPort::Get()->GetPrimaryRootWindow(), | 54 TestLauncherAlignment(ShellPort::Get()->GetPrimaryRootWindow(), |
56 SHELF_ALIGNMENT_BOTTOM, gfx::Rect(0, 0, 400, 352)); | 55 SHELF_ALIGNMENT_BOTTOM, gfx::Rect(0, 0, 400, 352)); |
57 } | 56 } |
58 { | 57 { |
59 SCOPED_TRACE("Single Locked"); | 58 SCOPED_TRACE("Single Locked"); |
60 TestLauncherAlignment(ShellPort::Get()->GetPrimaryRootWindow(), | 59 TestLauncherAlignment(ShellPort::Get()->GetPrimaryRootWindow(), |
61 SHELF_ALIGNMENT_BOTTOM_LOCKED, | 60 SHELF_ALIGNMENT_BOTTOM_LOCKED, |
62 gfx::Rect(0, 0, 400, 352)); | 61 gfx::Rect(0, 0, 400, 352)); |
63 } | 62 } |
64 { | 63 { |
65 SCOPED_TRACE("Single Right"); | 64 SCOPED_TRACE("Single Right"); |
66 TestLauncherAlignment(ShellPort::Get()->GetPrimaryRootWindow(), | 65 TestLauncherAlignment(ShellPort::Get()->GetPrimaryRootWindow(), |
67 SHELF_ALIGNMENT_RIGHT, gfx::Rect(0, 0, 352, 400)); | 66 SHELF_ALIGNMENT_RIGHT, gfx::Rect(0, 0, 352, 400)); |
68 } | 67 } |
69 { | 68 { |
70 SCOPED_TRACE("Single Left"); | 69 SCOPED_TRACE("Single Left"); |
71 TestLauncherAlignment(ShellPort::Get()->GetPrimaryRootWindow(), | 70 TestLauncherAlignment(ShellPort::Get()->GetPrimaryRootWindow(), |
72 SHELF_ALIGNMENT_LEFT, | 71 SHELF_ALIGNMENT_LEFT, |
73 gfx::Rect(kShelfSize, 0, 352, 400)); | 72 gfx::Rect(kShelfSize, 0, 352, 400)); |
74 } | 73 } |
75 } | 74 } |
76 | 75 |
77 TEST_F(ShelfWidgetTest, TestAlignmentForMultipleDisplays) { | 76 TEST_F(ShelfWidgetTest, TestAlignmentForMultipleDisplays) { |
78 const int kShelfSize = GetShelfConstant(SHELF_SIZE); | |
79 UpdateDisplay("300x300,500x500"); | 77 UpdateDisplay("300x300,500x500"); |
80 std::vector<WmWindow*> root_windows = ShellPort::Get()->GetAllRootWindows(); | 78 std::vector<WmWindow*> root_windows = ShellPort::Get()->GetAllRootWindows(); |
81 { | 79 { |
82 SCOPED_TRACE("Primary Bottom"); | 80 SCOPED_TRACE("Primary Bottom"); |
83 TestLauncherAlignment(root_windows[0], SHELF_ALIGNMENT_BOTTOM, | 81 TestLauncherAlignment(root_windows[0], SHELF_ALIGNMENT_BOTTOM, |
84 gfx::Rect(0, 0, 300, 252)); | 82 gfx::Rect(0, 0, 300, 252)); |
85 } | 83 } |
86 { | 84 { |
87 SCOPED_TRACE("Primary Locked"); | 85 SCOPED_TRACE("Primary Locked"); |
88 TestLauncherAlignment(root_windows[0], SHELF_ALIGNMENT_BOTTOM_LOCKED, | 86 TestLauncherAlignment(root_windows[0], SHELF_ALIGNMENT_BOTTOM_LOCKED, |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 } | 408 } |
411 | 409 |
412 TEST_F(ShelfWidgetTestWithInitializer, CreateLockedShelf) { | 410 TEST_F(ShelfWidgetTestWithInitializer, CreateLockedShelf) { |
413 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. | 411 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. |
414 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM_LOCKED, | 412 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM_LOCKED, |
415 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | 413 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, |
416 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); | 414 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); |
417 } | 415 } |
418 | 416 |
419 } // namespace ash | 417 } // namespace ash |
OLD | NEW |