OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/system/tray/system_tray.h" | 5 #include "ash/system/tray/system_tray.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/accelerators/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
11 #include "ash/accessibility_delegate.h" | 11 #include "ash/accessibility_delegate.h" |
12 #include "ash/public/cpp/shell_window_ids.h" | 12 #include "ash/public/cpp/shell_window_ids.h" |
13 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
14 #include "ash/shelf/shelf.h" | 14 #include "ash/shelf/shelf.h" |
15 #include "ash/shelf/shelf_widget.h" | 15 #include "ash/shelf/shelf_widget.h" |
16 #include "ash/shell.h" | 16 #include "ash/shell.h" |
17 #include "ash/system/status_area_widget.h" | 17 #include "ash/system/status_area_widget.h" |
18 #include "ash/system/tray/system_tray_bubble.h" | 18 #include "ash/system/tray/system_tray_bubble.h" |
19 #include "ash/system/tray/system_tray_item.h" | 19 #include "ash/system/tray/system_tray_item.h" |
20 #include "ash/system/tray/tray_constants.h" | 20 #include "ash/system/tray/tray_constants.h" |
21 #include "ash/system/tray_drag_controller.h" | |
21 #include "ash/system/web_notification/web_notification_tray.h" | 22 #include "ash/system/web_notification/web_notification_tray.h" |
22 #include "ash/test/ash_test_base.h" | 23 #include "ash/test/ash_test_base.h" |
23 #include "ash/test/status_area_widget_test_helper.h" | 24 #include "ash/test/status_area_widget_test_helper.h" |
24 #include "ash/test/test_system_tray_item.h" | 25 #include "ash/test/test_system_tray_item.h" |
25 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 26 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
26 #include "ash/wm/window_util.h" | 27 #include "ash/wm/window_util.h" |
27 #include "base/memory/ptr_util.h" | 28 #include "base/memory/ptr_util.h" |
28 #include "base/run_loop.h" | 29 #include "base/run_loop.h" |
29 #include "base/test/histogram_tester.h" | 30 #include "base/test/histogram_tester.h" |
30 #include "ui/base/ui_base_types.h" | 31 #include "ui/base/ui_base_types.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
56 DISALLOW_COPY_AND_ASSIGN(ModalWidgetDelegate); | 57 DISALLOW_COPY_AND_ASSIGN(ModalWidgetDelegate); |
57 }; | 58 }; |
58 | 59 |
59 } // namespace | 60 } // namespace |
60 | 61 |
61 class SystemTrayTest : public AshTestBase { | 62 class SystemTrayTest : public AshTestBase { |
62 public: | 63 public: |
63 SystemTrayTest() {} | 64 SystemTrayTest() {} |
64 ~SystemTrayTest() override {} | 65 ~SystemTrayTest() override {} |
65 | 66 |
66 // Swiping on the system tray and ends with finger released. | 67 // Swiping on the system tray and ends with finger released. Note, |start| is |
68 // based on the view's own coordinates. | |
msw
2017/07/12 05:04:51
nit: clarify "the view", do you mean the system tr
minch1
2017/07/13 19:10:35
Can be both system tray and system tray bubble.
| |
67 void SendGestureEvent(gfx::Point& start, | 69 void SendGestureEvent(gfx::Point& start, |
68 float delta, | 70 float delta, |
69 bool is_fling, | 71 bool is_fling, |
70 float velocity_y) { | 72 float velocity_y) { |
71 SystemTray* system_tray = GetPrimarySystemTray(); | 73 SystemTray* system_tray = GetPrimarySystemTray(); |
72 base::TimeTicks timestamp = base::TimeTicks::Now(); | 74 base::TimeTicks timestamp = base::TimeTicks::Now(); |
73 SendScrollStartAndUpdate(start, delta, timestamp); | 75 SendScrollStartAndUpdate(start, delta, timestamp); |
74 | 76 |
75 ui::GestureEventDetails details = | 77 ui::GestureEventDetails details = |
76 is_fling | 78 is_fling |
77 ? ui::GestureEventDetails(ui::ET_SCROLL_FLING_START, 0, velocity_y) | 79 ? ui::GestureEventDetails(ui::ET_SCROLL_FLING_START, 0, velocity_y) |
78 : ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_END); | 80 : ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_END); |
79 ui::GestureEvent event = ui::GestureEvent(start.x(), start.y() + delta, | 81 ui::GestureEvent event = ui::GestureEvent(start.x(), start.y() + delta, |
80 ui::EF_NONE, timestamp, details); | 82 ui::EF_NONE, timestamp, details); |
81 system_tray->OnGestureEvent(&event); | 83 if (is_on_bubble_) |
84 system_tray->GetSystemBubble()->bubble_view()->OnGestureEvent(&event); | |
85 else | |
86 system_tray->OnGestureEvent(&event); | |
82 } | 87 } |
83 | 88 |
84 // Swiping on the system tray without releasing the finger. | 89 // Swiping on the system tray without releasing the finger. |
85 void SendScrollStartAndUpdate(gfx::Point& start, | 90 void SendScrollStartAndUpdate(gfx::Point& start, |
86 float delta, | 91 float delta, |
87 base::TimeTicks& timestamp) { | 92 base::TimeTicks& timestamp) { |
88 SystemTray* system_tray = GetPrimarySystemTray(); | 93 SystemTray* system_tray = GetPrimarySystemTray(); |
89 ui::GestureEventDetails begin_details(ui::ET_GESTURE_SCROLL_BEGIN); | 94 ui::GestureEventDetails begin_details(ui::ET_GESTURE_SCROLL_BEGIN, 0, |
95 scroll_y_hint_); | |
90 ui::GestureEvent begin_event = ui::GestureEvent( | 96 ui::GestureEvent begin_event = ui::GestureEvent( |
91 start.x(), start.y(), ui::EF_NONE, timestamp, begin_details); | 97 start.x(), start.y(), ui::EF_NONE, timestamp, begin_details); |
92 system_tray->OnGestureEvent(&begin_event); | 98 |
99 if (is_on_bubble_) { | |
100 system_tray->GetSystemBubble()->bubble_view()->OnGestureEvent( | |
101 &begin_event); | |
102 } else { | |
103 system_tray->OnGestureEvent(&begin_event); | |
104 } | |
93 | 105 |
94 ui::GestureEventDetails update_details(ui::ET_GESTURE_SCROLL_UPDATE, 0, | 106 ui::GestureEventDetails update_details(ui::ET_GESTURE_SCROLL_UPDATE, 0, |
95 delta); | 107 delta); |
96 timestamp += base::TimeDelta::FromMilliseconds(100); | 108 timestamp += base::TimeDelta::FromMilliseconds(100); |
97 ui::GestureEvent update_event = ui::GestureEvent( | 109 ui::GestureEvent update_event = ui::GestureEvent( |
98 start.x(), start.y() + delta, ui::EF_NONE, timestamp, update_details); | 110 start.x(), start.y() + delta, ui::EF_NONE, timestamp, update_details); |
99 system_tray->OnGestureEvent(&update_event); | 111 |
112 if (is_on_bubble_) { | |
113 system_tray->GetSystemBubble()->bubble_view()->OnGestureEvent( | |
114 &update_event); | |
115 } else { | |
116 system_tray->OnGestureEvent(&update_event); | |
117 } | |
100 } | 118 } |
101 | 119 |
102 // Open the default system tray bubble to get the height of the bubble and | 120 // Open the default system tray bubble to get the height of the bubble and |
103 // then close it. | 121 // then close it. |
104 float GetSystemBubbleHeight() { | 122 float GetSystemBubbleHeight() { |
105 SystemTray* system_tray = GetPrimarySystemTray(); | 123 SystemTray* system_tray = GetPrimarySystemTray(); |
106 system_tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 124 system_tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
107 gfx::Rect bounds = GetSystemBubbleBoundsInScreen(); | 125 gfx::Rect bounds = GetSystemBubbleBoundsInScreen(); |
108 system_tray->CloseSystemBubble(); | 126 system_tray->CloseSystemBubble(); |
109 return bounds.height(); | 127 return bounds.height(); |
110 } | 128 } |
111 | 129 |
112 gfx::Rect GetSystemBubbleBoundsInScreen() { | 130 gfx::Rect GetSystemBubbleBoundsInScreen() { |
113 return GetPrimarySystemTray() | 131 return GetPrimarySystemTray() |
114 ->GetSystemBubble() | 132 ->GetSystemBubble() |
115 ->bubble_view() | 133 ->bubble_view() |
116 ->GetWidget() | 134 ->GetWidget() |
117 ->GetWindowBoundsInScreen(); | 135 ->GetWindowBoundsInScreen(); |
118 } | 136 } |
119 | 137 |
138 void set_scroll_y_hint(float scroll_y_hint) { | |
139 scroll_y_hint_ = scroll_y_hint; | |
140 } | |
141 | |
142 void set_is_on_bubble(bool is_on_bubble) { is_on_bubble_ = is_on_bubble; } | |
143 | |
120 private: | 144 private: |
145 float scroll_y_hint_ = -1.f; | |
msw
2017/07/12 05:04:51
Add explanatory comments for both of these members
minch1
2017/07/13 19:10:36
Done.
| |
146 bool is_on_bubble_ = false; | |
147 | |
121 DISALLOW_COPY_AND_ASSIGN(SystemTrayTest); | 148 DISALLOW_COPY_AND_ASSIGN(SystemTrayTest); |
122 }; | 149 }; |
123 | 150 |
124 // Swiping on the overlap area of shelf and system tray bubble during the | 151 // Swiping on the overlap area of shelf and system tray bubble during the |
125 // animation should close the bubble. | 152 // animation should close the bubble. |
126 TEST_F(SystemTrayTest, SwipingOnShelfDuringAnimation) { | 153 TEST_F(SystemTrayTest, SwipingOnShelfDuringAnimation) { |
127 Shelf* shelf = GetPrimaryShelf(); | 154 Shelf* shelf = GetPrimaryShelf(); |
128 SystemTray* system_tray = GetPrimarySystemTray(); | 155 SystemTray* system_tray = GetPrimarySystemTray(); |
129 gfx::Point start = system_tray->GetLocalBounds().CenterPoint(); | 156 gfx::Point start = system_tray->GetLocalBounds().CenterPoint(); |
130 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 157 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
(...skipping 26 matching lines...) Expand all Loading... | |
157 | 184 |
158 // Dragging the shelf during up animation should close the bubble. | 185 // Dragging the shelf during up animation should close the bubble. |
159 if (current_bounds.y() != original_bounds.y()) { | 186 if (current_bounds.y() != original_bounds.y()) { |
160 generator.GestureScrollSequence(point_on_shelf_start, point_on_shelf_end, | 187 generator.GestureScrollSequence(point_on_shelf_start, point_on_shelf_end, |
161 base::TimeDelta::FromMilliseconds(100), 5); | 188 base::TimeDelta::FromMilliseconds(100), 5); |
162 EXPECT_FALSE(system_tray->HasSystemBubble()); | 189 EXPECT_FALSE(system_tray->HasSystemBubble()); |
163 } | 190 } |
164 | 191 |
165 // Fling down on the shelf with a velocity that exceeds |kFlingVelocity|. | 192 // Fling down on the shelf with a velocity that exceeds |kFlingVelocity|. |
166 EXPECT_FALSE(system_tray->HasSystemBubble()); | 193 EXPECT_FALSE(system_tray->HasSystemBubble()); |
167 SendGestureEvent(start, delta, true, SystemTray::kFlingVelocity + 1); | 194 SendGestureEvent(start, delta, true, TrayDragController::kFlingVelocity + 1); |
168 current_bounds = GetSystemBubbleBoundsInScreen(); | 195 current_bounds = GetSystemBubbleBoundsInScreen(); |
169 EXPECT_TRUE(system_tray->HasSystemBubble()); | 196 EXPECT_TRUE(system_tray->HasSystemBubble()); |
170 | 197 |
171 // Dragging the shelf during down animation should close the bubble. | 198 // Dragging the shelf during down animation should close the bubble. |
172 if (current_bounds.y() != original_bounds.y()) { | 199 if (current_bounds.y() != original_bounds.y()) { |
173 generator.GestureScrollSequence(point_on_shelf_start, point_on_shelf_end, | 200 generator.GestureScrollSequence(point_on_shelf_start, point_on_shelf_end, |
174 base::TimeDelta::FromMilliseconds(100), 5); | 201 base::TimeDelta::FromMilliseconds(100), 5); |
175 EXPECT_FALSE(system_tray->HasSystemBubble()); | 202 EXPECT_FALSE(system_tray->HasSystemBubble()); |
176 } | 203 } |
177 } | 204 } |
178 | 205 |
179 // Swiping on the system tray ends with fling event. | 206 // Swiping on the system tray ends with fling event. |
180 TEST_F(SystemTrayTest, FlingOnSystemTray) { | 207 TEST_F(SystemTrayTest, FlingOnSystemTray) { |
181 Shelf* shelf = GetPrimaryShelf(); | 208 Shelf* shelf = GetPrimaryShelf(); |
182 SystemTray* system_tray = GetPrimarySystemTray(); | 209 SystemTray* system_tray = GetPrimarySystemTray(); |
183 gfx::Point start = system_tray->GetBoundsInScreen().CenterPoint(); | 210 gfx::Point start = system_tray->GetLocalBounds().CenterPoint(); |
184 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 211 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
185 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 212 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
186 true); | 213 true); |
187 | 214 |
188 // Fling up on the system tray should show the bubble if the |velocity_y| is | 215 // Fling up on the system tray should show the bubble if the |velocity_y| is |
189 // larger than |kFlingVelocity| and the dragging amount is larger than one | 216 // larger than |kFlingVelocity| and the dragging amount is larger than one |
190 // third of the height of the bubble. | 217 // third of the height of the bubble. |
191 float delta = -GetSystemBubbleHeight(); | 218 float delta = -GetSystemBubbleHeight(); |
192 SendGestureEvent(start, delta, true, -(SystemTray::kFlingVelocity + 1)); | 219 SendGestureEvent(start, delta, true, |
220 -(TrayDragController::kFlingVelocity + 1)); | |
193 EXPECT_TRUE(system_tray->HasSystemBubble()); | 221 EXPECT_TRUE(system_tray->HasSystemBubble()); |
194 system_tray->CloseSystemBubble(); | 222 system_tray->CloseSystemBubble(); |
195 | 223 |
196 // Fling up on the system tray should show the bubble if the |velocity_y| is | 224 // Fling up on the system tray should show the bubble if the |velocity_y| is |
197 // larger than |kFlingVelocity| even the dragging amount is less than one | 225 // larger than |kFlingVelocity| even the dragging amount is less than one |
198 // third of the height of the bubble. | 226 // third of the height of the bubble. |
199 delta /= 4; | 227 delta /= 4; |
200 SendGestureEvent(start, delta, true, -(SystemTray::kFlingVelocity + 1)); | 228 SendGestureEvent(start, delta, true, |
229 -(TrayDragController::kFlingVelocity + 1)); | |
201 EXPECT_TRUE(system_tray->HasSystemBubble()); | 230 EXPECT_TRUE(system_tray->HasSystemBubble()); |
202 system_tray->CloseSystemBubble(); | 231 system_tray->CloseSystemBubble(); |
203 | 232 |
204 // Fling up on the system tray should show the bubble if the |velocity_y| is | 233 // Fling up on the system tray should show the bubble if the |velocity_y| is |
205 // less than |kFlingVelocity| but the dragging amount if larger than one third | 234 // less than |kFlingVelocity| but the dragging amount if larger than one third |
206 // of the height of the bubble. | 235 // of the height of the bubble. |
207 delta = -GetSystemBubbleHeight(); | 236 delta = -GetSystemBubbleHeight(); |
208 SendGestureEvent(start, delta, true, -(SystemTray::kFlingVelocity - 1)); | 237 SendGestureEvent(start, delta, true, |
238 -(TrayDragController::kFlingVelocity - 1)); | |
209 EXPECT_TRUE(system_tray->HasSystemBubble()); | 239 EXPECT_TRUE(system_tray->HasSystemBubble()); |
210 system_tray->CloseSystemBubble(); | 240 system_tray->CloseSystemBubble(); |
211 | 241 |
212 // Fling up on the system tray should close the bubble if the |velocity_y| | 242 // Fling up on the system tray should close the bubble if the |velocity_y| |
213 // is less than |kFlingVelocity| and the dragging amount is less than one | 243 // is less than |kFlingVelocity| and the dragging amount is less than one |
214 // third of the height of the bubble. | 244 // third of the height of the bubble. |
215 delta /= 4; | 245 delta /= 4; |
216 SendGestureEvent(start, delta, true, -(SystemTray::kFlingVelocity - 1)); | 246 SendGestureEvent(start, delta, true, |
247 -(TrayDragController::kFlingVelocity - 1)); | |
217 EXPECT_FALSE(system_tray->HasSystemBubble()); | 248 EXPECT_FALSE(system_tray->HasSystemBubble()); |
218 | 249 |
219 // Fling down on the system tray should close the bubble if the |velocity_y| | 250 // Fling down on the system tray should close the bubble if the |velocity_y| |
220 // is larger than kFLingVelocity. | 251 // is larger than kFLingVelocity. |
221 SendGestureEvent(start, delta, true, SystemTray::kFlingVelocity + 1); | 252 SendGestureEvent(start, delta, true, TrayDragController::kFlingVelocity + 1); |
222 EXPECT_FALSE(system_tray->HasSystemBubble()); | 253 EXPECT_FALSE(system_tray->HasSystemBubble()); |
223 | 254 |
224 // Fling down on the system tray should close the bubble if the |velocity_y| | 255 // Fling down on the system tray should close the bubble if the |velocity_y| |
225 // is larger than |kFlingVelocity| even the dragging amount is larger than one | 256 // is larger than |kFlingVelocity| even the dragging amount is larger than one |
226 // third of the height of the bubble. | 257 // third of the height of the bubble. |
227 delta = -GetSystemBubbleHeight(); | 258 delta = -GetSystemBubbleHeight(); |
228 SendGestureEvent(start, delta, true, SystemTray::kFlingVelocity + 1); | 259 SendGestureEvent(start, delta, true, TrayDragController::kFlingVelocity + 1); |
229 EXPECT_FALSE(system_tray->HasSystemBubble()); | 260 EXPECT_FALSE(system_tray->HasSystemBubble()); |
230 | 261 |
231 // Fling down on the system tray should open the bubble if the |velocity_y| is | 262 // Fling down on the system tray should open the bubble if the |velocity_y| is |
232 // less than |kFlingVelocity| but the dragging amount exceed one third of the | 263 // less than |kFlingVelocity| but the dragging amount exceed one third of the |
233 // height of the bubble. | 264 // height of the bubble. |
234 SendGestureEvent(start, delta, true, SystemTray::kFlingVelocity - 1); | 265 SendGestureEvent(start, delta, true, TrayDragController::kFlingVelocity - 1); |
235 EXPECT_TRUE(system_tray->HasSystemBubble()); | 266 EXPECT_TRUE(system_tray->HasSystemBubble()); |
236 system_tray->CloseSystemBubble(); | 267 system_tray->CloseSystemBubble(); |
237 | 268 |
238 // Fling down on the system tray should close the bubble if the |velocity_y| | 269 // Fling down on the system tray should close the bubble if the |velocity_y| |
239 // is less than |kFlingVelocity| and the dragging amount is less than one | 270 // is less than |kFlingVelocity| and the dragging amount is less than one |
240 // third of the height of the bubble. | 271 // third of the height of the bubble. |
241 delta /= 4; | 272 delta /= 4; |
242 SendGestureEvent(start, delta, true, SystemTray::kFlingVelocity - 1); | 273 SendGestureEvent(start, delta, true, TrayDragController::kFlingVelocity - 1); |
243 EXPECT_FALSE(system_tray->HasSystemBubble()); | 274 EXPECT_FALSE(system_tray->HasSystemBubble()); |
244 } | 275 } |
245 | 276 |
246 // Touch outside the system tray bubble during swiping should close the bubble. | 277 // Touch outside the system tray bubble during swiping should close the bubble. |
247 TEST_F(SystemTrayTest, TapOutsideCloseBubble) { | 278 TEST_F(SystemTrayTest, TapOutsideCloseBubble) { |
248 Shelf* shelf = GetPrimaryShelf(); | 279 Shelf* shelf = GetPrimaryShelf(); |
249 SystemTray* system_tray = GetPrimarySystemTray(); | 280 SystemTray* system_tray = GetPrimarySystemTray(); |
250 gfx::Point start = system_tray->GetLocalBounds().CenterPoint(); | 281 gfx::Point start = system_tray->GetLocalBounds().CenterPoint(); |
251 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 282 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
252 | 283 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); | 337 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); |
307 SendGestureEvent(start, delta, false, 0); | 338 SendGestureEvent(start, delta, false, 0); |
308 EXPECT_FALSE(system_tray->HasSystemBubble()); | 339 EXPECT_FALSE(system_tray->HasSystemBubble()); |
309 | 340 |
310 // Swiping up on system tray should not show the system tray bubble if the | 341 // Swiping up on system tray should not show the system tray bubble if the |
311 // shelf is right alignment. | 342 // shelf is right alignment. |
312 shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT); | 343 shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT); |
313 SendGestureEvent(start, delta, false, 0); | 344 SendGestureEvent(start, delta, false, 0); |
314 EXPECT_FALSE(system_tray->HasSystemBubble()); | 345 EXPECT_FALSE(system_tray->HasSystemBubble()); |
315 | 346 |
316 // Swiping down on the shelf should not show the system tray bubble. | 347 // Begins to scroll downward on the shelf should not show the system tray |
msw
2017/07/12 05:04:51
nit: s/Begins/Beginning/, isn't this scrolling up
minch1
2017/07/13 19:10:35
Yes, but it starts with scroll downward, so should
msw
2017/07/14 02:00:45
Hmm, it seems like Android's top system menu/shade
minch1
2017/07/14 19:45:17
Scroll down first then scroll up will drag the she
| |
348 // bubble. | |
317 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 349 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
318 delta = -delta; | 350 set_scroll_y_hint(1.0); |
319 SendGestureEvent(start, delta, false, 0); | 351 SendGestureEvent(start, delta, false, 0); |
320 EXPECT_FALSE(system_tray->HasSystemBubble()); | 352 EXPECT_FALSE(system_tray->HasSystemBubble()); |
321 } | 353 } |
354 | |
355 // Swiping on opened system tray bubble. | |
356 TEST_F(SystemTrayTest, SwipingOnSystemTrayBubble) { | |
msw
2017/07/12 05:04:51
Should this or another new fixture test swiping on
minch1
2017/07/13 19:10:35
Acknowledged.
| |
357 Shelf* shelf = GetPrimaryShelf(); | |
358 SystemTray* system_tray = GetPrimarySystemTray(); | |
359 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | |
msw
2017/07/12 05:04:51
q: Is this necessary? (it might already have this
minch1
2017/07/13 19:10:35
I am sorry I didn't find the place that show the s
msw
2017/07/14 02:00:45
I suggest checking that's the case, via EXPECT_EQ(
minch1
2017/07/14 19:45:17
Done.
| |
360 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | |
msw
2017/07/12 05:04:51
q: Is this necessary? If so, maybe add a comment?
minch1
2017/07/13 19:10:35
Added one more test case to explain this.
| |
361 true); | |
362 set_is_on_bubble(true); | |
363 | |
364 // Begins to scroll downward and swiping down more than one third of the | |
msw
2017/07/12 05:04:51
nit: s/Begins/Beginning/
minch1
2017/07/13 19:10:35
Done.
| |
365 // bubble's height should close the bubble. | |
366 system_tray->ShowDefaultView(BUBBLE_CREATE_NEW); | |
367 gfx::Rect bounds = | |
368 system_tray->GetSystemBubble()->bubble_view()->GetLocalBounds(); | |
369 float delta = bounds.height() / 2; | |
370 gfx::Point start(bounds.x() + 5, bounds.y() + 5); | |
371 set_scroll_y_hint(1.0); | |
372 SendGestureEvent(start, delta, false, 0); | |
373 EXPECT_FALSE(system_tray->HasSystemBubble()); | |
374 | |
375 // Begins to scroll upward and swiping down more than one third of the | |
msw
2017/07/12 05:04:51
nit: s/Begins/Beginning/, also "and then swiping"
minch1
2017/07/13 19:10:36
Done.
| |
376 // bubble's height should also close the bubble. | |
377 system_tray->ShowDefaultView(BUBBLE_CREATE_NEW); | |
378 set_scroll_y_hint(-1.0); | |
379 SendGestureEvent(start, delta, false, 0); | |
380 EXPECT_FALSE(system_tray->HasSystemBubble()); | |
381 } | |
322 | 382 |
323 // Verifies only the visible default views are recorded in the | 383 // Verifies only the visible default views are recorded in the |
324 // "Ash.SystemMenu.DefaultView.VisibleItems" histogram. | 384 // "Ash.SystemMenu.DefaultView.VisibleItems" histogram. |
325 TEST_F(SystemTrayTest, OnlyVisibleItemsRecorded) { | 385 TEST_F(SystemTrayTest, OnlyVisibleItemsRecorded) { |
326 SystemTray* tray = GetPrimarySystemTray(); | 386 SystemTray* tray = GetPrimarySystemTray(); |
327 ASSERT_TRUE(tray->GetWidget()); | 387 ASSERT_TRUE(tray->GetWidget()); |
328 | 388 |
329 TestSystemTrayItem* test_item = new TestSystemTrayItem(); | 389 TestSystemTrayItem* test_item = new TestSystemTrayItem(); |
330 tray->AddTrayItem(base::WrapUnique(test_item)); | 390 tray->AddTrayItem(base::WrapUnique(test_item)); |
331 | 391 |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
848 | 908 |
849 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); | 909 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); |
850 } | 910 } |
851 | 911 |
852 TEST_F(SystemTrayTest, SeparatorThickness) { | 912 TEST_F(SystemTrayTest, SeparatorThickness) { |
853 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness); | 913 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness); |
854 } | 914 } |
855 | 915 |
856 } // namespace test | 916 } // namespace test |
857 } // namespace ash | 917 } // namespace ash |
OLD | NEW |