OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_tooltip_manager.h" | 5 #include "ash/shelf/shelf_tooltip_manager.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
9 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // Shouldn't hide if the touch happens on the tooltip. | 200 // Shouldn't hide if the touch happens on the tooltip. |
201 ShowImmediately(); | 201 ShowImmediately(); |
202 views::Widget* tooltip_widget = GetTooltipWidget(); | 202 views::Widget* tooltip_widget = GetTooltipWidget(); |
203 SetEventTarget(tooltip_widget->GetNativeWindow(), &touch_event); | 203 SetEventTarget(tooltip_widget->GetNativeWindow(), &touch_event); |
204 event_handler->OnTouchEvent(&touch_event); | 204 event_handler->OnTouchEvent(&touch_event); |
205 EXPECT_FALSE(touch_event.handled()); | 205 EXPECT_FALSE(touch_event.handled()); |
206 EXPECT_TRUE(TooltipIsVisible()); | 206 EXPECT_TRUE(TooltipIsVisible()); |
207 | 207 |
208 // Should hide for gesture events. | 208 // Should hide for gesture events. |
209 ui::GestureEvent gesture_event( | 209 ui::GestureEvent gesture_event( |
210 0, 0, ui::EF_NONE, | 210 0, |
| 211 0, |
| 212 ui::EF_NONE, |
211 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), | 213 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), |
212 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f)); | 214 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN)); |
213 SetEventTarget(tooltip_widget->GetNativeWindow(), &gesture_event); | 215 SetEventTarget(tooltip_widget->GetNativeWindow(), &gesture_event); |
214 event_handler->OnGestureEvent(&gesture_event); | 216 event_handler->OnGestureEvent(&gesture_event); |
215 EXPECT_FALSE(gesture_event.handled()); | 217 EXPECT_FALSE(gesture_event.handled()); |
216 RunAllPendingInMessageLoop(); | 218 RunAllPendingInMessageLoop(); |
217 EXPECT_FALSE(TooltipIsVisible()); | 219 EXPECT_FALSE(TooltipIsVisible()); |
218 } | 220 } |
219 | 221 |
220 TEST_F(ShelfTooltipManagerTest, HideForMouseMoveEvent) { | 222 TEST_F(ShelfTooltipManagerTest, HideForMouseMoveEvent) { |
221 ShowImmediately(); | 223 ShowImmediately(); |
222 ASSERT_TRUE(TooltipIsVisible()); | 224 ASSERT_TRUE(TooltipIsVisible()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 279 |
278 SetEventTarget(root_window, &mouse_event); | 280 SetEventTarget(root_window, &mouse_event); |
279 event_handler->OnMouseEvent(&mouse_event); | 281 event_handler->OnMouseEvent(&mouse_event); |
280 EXPECT_FALSE(mouse_event.handled()); | 282 EXPECT_FALSE(mouse_event.handled()); |
281 RunAllPendingInMessageLoop(); | 283 RunAllPendingInMessageLoop(); |
282 EXPECT_FALSE(TooltipIsVisible()); | 284 EXPECT_FALSE(TooltipIsVisible()); |
283 } | 285 } |
284 | 286 |
285 } // namespace test | 287 } // namespace test |
286 } // namespace ash | 288 } // namespace ash |
OLD | NEW |