| 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/launcher/launcher_tooltip_manager.h" | 5 #include "ash/launcher/launcher_tooltip_manager.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "ash/wm/shelf_layout_manager.h" | 10 #include "ash/wm/shelf_layout_manager.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 aura::EventFilter* event_filter = GetEventFilter(); | 146 aura::EventFilter* event_filter = GetEventFilter(); |
| 147 | 147 |
| 148 // Should not hide for key events. | 148 // Should not hide for key events. |
| 149 ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE, false); | 149 ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE, false); |
| 150 EXPECT_FALSE(event_filter->PreHandleKeyEvent(root_window, &key_event)); | 150 EXPECT_FALSE(event_filter->PreHandleKeyEvent(root_window, &key_event)); |
| 151 EXPECT_TRUE(TooltipIsVisible()); | 151 EXPECT_TRUE(TooltipIsVisible()); |
| 152 | 152 |
| 153 // Should hide for touch events. | 153 // Should hide for touch events. |
| 154 ui::TouchEvent touch_event( | 154 ui::TouchEvent touch_event( |
| 155 ui::ET_TOUCH_PRESSED, gfx::Point(), 0, base::TimeDelta()); | 155 ui::ET_TOUCH_PRESSED, gfx::Point(), 0, base::TimeDelta()); |
| 156 EXPECT_EQ(ui::TOUCH_STATUS_UNKNOWN, | 156 EXPECT_EQ(ui::ER_UNHANDLED, |
| 157 event_filter->PreHandleTouchEvent(root_window, &touch_event)); | 157 event_filter->PreHandleTouchEvent(root_window, &touch_event)); |
| 158 EXPECT_FALSE(TooltipIsVisible()); | 158 EXPECT_FALSE(TooltipIsVisible()); |
| 159 | 159 |
| 160 // Shouldn't hide if the touch happens on the tooltip. | 160 // Shouldn't hide if the touch happens on the tooltip. |
| 161 ShowImmediately(); | 161 ShowImmediately(); |
| 162 views::Widget* tooltip_widget = GetTooltipWidget(); | 162 views::Widget* tooltip_widget = GetTooltipWidget(); |
| 163 EXPECT_EQ(ui::TOUCH_STATUS_UNKNOWN, | 163 EXPECT_EQ(ui::ER_UNHANDLED, |
| 164 event_filter->PreHandleTouchEvent( | 164 event_filter->PreHandleTouchEvent( |
| 165 tooltip_widget->GetNativeWindow(), &touch_event)); | 165 tooltip_widget->GetNativeWindow(), &touch_event)); |
| 166 EXPECT_TRUE(TooltipIsVisible()); | 166 EXPECT_TRUE(TooltipIsVisible()); |
| 167 | 167 |
| 168 // Should hide for gesture events. | 168 // Should hide for gesture events. |
| 169 ui::GestureEvent gesture_event( | 169 ui::GestureEvent gesture_event( |
| 170 ui::ET_GESTURE_BEGIN, 0, 0, ui::EF_NONE, | 170 ui::ET_GESTURE_BEGIN, 0, 0, ui::EF_NONE, |
| 171 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), | 171 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), |
| 172 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0); | 172 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0); |
| 173 EXPECT_EQ(ui::ER_UNHANDLED, | 173 EXPECT_EQ(ui::ER_UNHANDLED, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 196 | 196 |
| 197 // Should hide if the mouse is out of the tooltip. | 197 // Should hide if the mouse is out of the tooltip. |
| 198 test_api.set_location(tooltip_rect.origin().Add(gfx::Vector2d(-1, -1))); | 198 test_api.set_location(tooltip_rect.origin().Add(gfx::Vector2d(-1, -1))); |
| 199 EXPECT_FALSE(event_filter->PreHandleMouseEvent(root_window, &mouse_event)); | 199 EXPECT_FALSE(event_filter->PreHandleMouseEvent(root_window, &mouse_event)); |
| 200 RunAllPendingInMessageLoop(); | 200 RunAllPendingInMessageLoop(); |
| 201 EXPECT_FALSE(TooltipIsVisible()); | 201 EXPECT_FALSE(TooltipIsVisible()); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace test | 204 } // namespace test |
| 205 } // namespace ash | 205 } // namespace ash |
| OLD | NEW |