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/ash_switches.h" | |
James Cook
2013/08/22 00:19:12
Is this needed?
Harry McCleave
2013/08/27 00:37:00
Done.
| |
7 #include "ash/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
8 #include "ash/launcher/launcher_button.h" | 9 #include "ash/launcher/launcher_button.h" |
9 #include "ash/launcher/launcher_model.h" | 10 #include "ash/launcher/launcher_model.h" |
10 #include "ash/launcher/launcher_view.h" | 11 #include "ash/launcher/launcher_view.h" |
11 #include "ash/root_window_controller.h" | 12 #include "ash/root_window_controller.h" |
12 #include "ash/shelf/shelf_layout_manager.h" | 13 #include "ash/shelf/shelf_layout_manager.h" |
13 #include "ash/shell.h" | 14 #include "ash/shell.h" |
14 #include "ash/test/ash_test_base.h" | 15 #include "ash/test/ash_test_base.h" |
15 #include "ash/test/launcher_view_test_api.h" | 16 #include "ash/test/launcher_view_test_api.h" |
16 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
18 #include "base/command_line.h" | |
James Cook
2013/08/22 00:19:12
Is this needed?
Harry McCleave
2013/08/27 00:37:00
Done.
| |
17 #include "ui/aura/root_window.h" | 19 #include "ui/aura/root_window.h" |
18 #include "ui/gfx/display.h" | 20 #include "ui/gfx/display.h" |
19 #include "ui/gfx/screen.h" | 21 #include "ui/gfx/screen.h" |
20 #include "ui/views/corewm/corewm_switches.h" | 22 #include "ui/views/corewm/corewm_switches.h" |
21 #include "ui/views/view.h" | 23 #include "ui/views/view.h" |
22 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
23 | 25 |
24 namespace ash { | 26 namespace ash { |
25 | 27 |
26 namespace { | 28 namespace { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 } | 67 } |
66 | 68 |
67 TEST_F(ShelfWidgetTest, TestAlignment) { | 69 TEST_F(ShelfWidgetTest, TestAlignment) { |
68 Launcher* launcher = Launcher::ForPrimaryDisplay(); | 70 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
69 UpdateDisplay("400x400"); | 71 UpdateDisplay("400x400"); |
70 ASSERT_TRUE(launcher); | 72 ASSERT_TRUE(launcher); |
71 { | 73 { |
72 SCOPED_TRACE("Single Bottom"); | 74 SCOPED_TRACE("Single Bottom"); |
73 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), | 75 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), |
74 SHELF_ALIGNMENT_BOTTOM, | 76 SHELF_ALIGNMENT_BOTTOM, |
75 "0,0 400x352"); | 77 "0,0 400x353"); |
76 } | 78 } |
77 { | 79 { |
78 SCOPED_TRACE("Single Right"); | 80 SCOPED_TRACE("Single Right"); |
79 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), | 81 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), |
80 SHELF_ALIGNMENT_RIGHT, | 82 SHELF_ALIGNMENT_RIGHT, |
81 "0,0 352x400"); | 83 "0,0 353x400"); |
82 } | 84 } |
83 { | 85 { |
84 SCOPED_TRACE("Single Left"); | 86 SCOPED_TRACE("Single Left"); |
85 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), | 87 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), |
86 SHELF_ALIGNMENT_LEFT, | 88 SHELF_ALIGNMENT_LEFT, |
87 "48,0 352x400"); | 89 "47,0 353x400"); |
88 } | 90 } |
89 if (!SupportsMultipleDisplays()) | 91 if (!SupportsMultipleDisplays()) |
90 return; | 92 return; |
91 | 93 |
92 UpdateDisplay("300x300,500x500"); | 94 UpdateDisplay("300x300,500x500"); |
93 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 95 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
94 { | 96 { |
95 SCOPED_TRACE("Primary Bottom"); | 97 SCOPED_TRACE("Primary Bottom"); |
96 TestLauncherAlignment(root_windows[0], | 98 TestLauncherAlignment(root_windows[0], |
97 SHELF_ALIGNMENT_BOTTOM, | 99 SHELF_ALIGNMENT_BOTTOM, |
98 "0,0 300x252"); | 100 "0,0 300x253"); |
99 } | 101 } |
100 { | 102 { |
101 SCOPED_TRACE("Primary Right"); | 103 SCOPED_TRACE("Primary Right"); |
102 TestLauncherAlignment(root_windows[0], | 104 TestLauncherAlignment(root_windows[0], |
103 SHELF_ALIGNMENT_RIGHT, | 105 SHELF_ALIGNMENT_RIGHT, |
104 "0,0 252x300"); | 106 "0,0 253x300"); |
105 } | 107 } |
106 { | 108 { |
107 SCOPED_TRACE("Primary Left"); | 109 SCOPED_TRACE("Primary Left"); |
108 TestLauncherAlignment(root_windows[0], | 110 TestLauncherAlignment(root_windows[0], |
109 SHELF_ALIGNMENT_LEFT, | 111 SHELF_ALIGNMENT_LEFT, |
110 "48,0 252x300"); | 112 "47,0 253x300"); |
111 } | 113 } |
112 { | 114 { |
113 SCOPED_TRACE("Secondary Bottom"); | 115 SCOPED_TRACE("Secondary Bottom"); |
114 TestLauncherAlignment(root_windows[1], | 116 TestLauncherAlignment(root_windows[1], |
115 SHELF_ALIGNMENT_BOTTOM, | 117 SHELF_ALIGNMENT_BOTTOM, |
116 "300,0 500x452"); | 118 "300,0 500x453"); |
117 } | 119 } |
118 { | 120 { |
119 SCOPED_TRACE("Secondary Right"); | 121 SCOPED_TRACE("Secondary Right"); |
120 TestLauncherAlignment(root_windows[1], | 122 TestLauncherAlignment(root_windows[1], |
121 SHELF_ALIGNMENT_RIGHT, | 123 SHELF_ALIGNMENT_RIGHT, |
122 "300,0 452x500"); | 124 "300,0 453x500"); |
123 } | 125 } |
124 { | 126 { |
125 SCOPED_TRACE("Secondary Left"); | 127 SCOPED_TRACE("Secondary Left"); |
126 TestLauncherAlignment(root_windows[1], | 128 TestLauncherAlignment(root_windows[1], |
127 SHELF_ALIGNMENT_LEFT, | 129 SHELF_ALIGNMENT_LEFT, |
128 "348,0 452x500"); | 130 "347,0 453x500"); |
129 } | 131 } |
130 } | 132 } |
131 | 133 |
132 // Makes sure the launcher is initially sized correctly. | 134 // Makes sure the launcher is initially sized correctly. |
133 TEST_F(ShelfWidgetTest, LauncherInitiallySized) { | 135 TEST_F(ShelfWidgetTest, LauncherInitiallySized) { |
134 ShelfWidget* shelf_widget = GetShelfWidget(); | 136 ShelfWidget* shelf_widget = GetShelfWidget(); |
135 Launcher* launcher = shelf_widget->launcher(); | 137 Launcher* launcher = shelf_widget->launcher(); |
136 ASSERT_TRUE(launcher); | 138 ASSERT_TRUE(launcher); |
137 internal::ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); | 139 internal::ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); |
138 ASSERT_TRUE(shelf_layout_manager); | 140 ASSERT_TRUE(shelf_layout_manager); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 const int status_width = | 188 const int status_width = |
187 shelf->status_area_widget()->GetWindowBoundsInScreen().width(); | 189 shelf->status_area_widget()->GetWindowBoundsInScreen().width(); |
188 EXPECT_GT(status_width, 0); | 190 EXPECT_GT(status_width, 0); |
189 EXPECT_EQ(status_width, | 191 EXPECT_EQ(status_width, |
190 shelf->GetContentsView()->width() - | 192 shelf->GetContentsView()->width() - |
191 launcher->GetLauncherViewForTest()->width()); | 193 launcher->GetLauncherViewForTest()->width()); |
192 } | 194 } |
193 #endif | 195 #endif |
194 | 196 |
195 } // namespace ash | 197 } // namespace ash |
OLD | NEW |