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, | 210 0, 0, ui::EF_NONE, |
211 0, | |
212 ui::EF_NONE, | |
213 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), | 211 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), |
214 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN)); | 212 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f)); |
215 SetEventTarget(tooltip_widget->GetNativeWindow(), &gesture_event); | 213 SetEventTarget(tooltip_widget->GetNativeWindow(), &gesture_event); |
216 event_handler->OnGestureEvent(&gesture_event); | 214 event_handler->OnGestureEvent(&gesture_event); |
217 EXPECT_FALSE(gesture_event.handled()); | 215 EXPECT_FALSE(gesture_event.handled()); |
218 RunAllPendingInMessageLoop(); | 216 RunAllPendingInMessageLoop(); |
219 EXPECT_FALSE(TooltipIsVisible()); | 217 EXPECT_FALSE(TooltipIsVisible()); |
220 } | 218 } |
221 | 219 |
222 TEST_F(ShelfTooltipManagerTest, HideForMouseMoveEvent) { | 220 TEST_F(ShelfTooltipManagerTest, HideForMouseMoveEvent) { |
223 ShowImmediately(); | 221 ShowImmediately(); |
224 ASSERT_TRUE(TooltipIsVisible()); | 222 ASSERT_TRUE(TooltipIsVisible()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 277 |
280 SetEventTarget(root_window, &mouse_event); | 278 SetEventTarget(root_window, &mouse_event); |
281 event_handler->OnMouseEvent(&mouse_event); | 279 event_handler->OnMouseEvent(&mouse_event); |
282 EXPECT_FALSE(mouse_event.handled()); | 280 EXPECT_FALSE(mouse_event.handled()); |
283 RunAllPendingInMessageLoop(); | 281 RunAllPendingInMessageLoop(); |
284 EXPECT_FALSE(TooltipIsVisible()); | 282 EXPECT_FALSE(TooltipIsVisible()); |
285 } | 283 } |
286 | 284 |
287 } // namespace test | 285 } // namespace test |
288 } // namespace ash | 286 } // namespace ash |
OLD | NEW |