| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 EXPECT_EQ(ui::ER_UNHANDLED, | 177 EXPECT_EQ(ui::ER_UNHANDLED, |
| 178 event_handler->OnTouchEvent(&touch_event)); | 178 event_handler->OnTouchEvent(&touch_event)); |
| 179 EXPECT_TRUE(TooltipIsVisible()); | 179 EXPECT_TRUE(TooltipIsVisible()); |
| 180 | 180 |
| 181 // Should hide for gesture events. | 181 // Should hide for gesture events. |
| 182 ui::GestureEvent gesture_event( | 182 ui::GestureEvent gesture_event( |
| 183 ui::ET_GESTURE_BEGIN, 0, 0, ui::EF_NONE, | 183 ui::ET_GESTURE_BEGIN, 0, 0, ui::EF_NONE, |
| 184 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), | 184 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), |
| 185 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0); | 185 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0); |
| 186 SetEventTarget(tooltip_widget->GetNativeWindow(), &gesture_event); | 186 SetEventTarget(tooltip_widget->GetNativeWindow(), &gesture_event); |
| 187 EXPECT_EQ(ui::ER_UNHANDLED, | 187 event_handler->OnGestureEvent(&gesture_event); |
| 188 event_handler->OnGestureEvent(&gesture_event)); | 188 EXPECT_FALSE(gesture_event.handled()); |
| 189 RunAllPendingInMessageLoop(); | 189 RunAllPendingInMessageLoop(); |
| 190 EXPECT_FALSE(TooltipIsVisible()); | 190 EXPECT_FALSE(TooltipIsVisible()); |
| 191 } | 191 } |
| 192 | 192 |
| 193 TEST_F(LauncherTooltipManagerTest, HideForMouseEvent) { | 193 TEST_F(LauncherTooltipManagerTest, HideForMouseEvent) { |
| 194 ShowImmediately(); | 194 ShowImmediately(); |
| 195 ASSERT_TRUE(TooltipIsVisible()); | 195 ASSERT_TRUE(TooltipIsVisible()); |
| 196 | 196 |
| 197 aura::RootWindow* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); | 197 aura::RootWindow* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); |
| 198 ui::EventHandler* event_handler = GetEventHandler(); | 198 ui::EventHandler* event_handler = GetEventHandler(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 213 // Should hide if the mouse is out of the tooltip. | 213 // Should hide if the mouse is out of the tooltip. |
| 214 test_api.set_location(tooltip_rect.origin() + gfx::Vector2d(-1, -1)); | 214 test_api.set_location(tooltip_rect.origin() + gfx::Vector2d(-1, -1)); |
| 215 EXPECT_EQ(ui::ER_UNHANDLED, | 215 EXPECT_EQ(ui::ER_UNHANDLED, |
| 216 event_handler->OnMouseEvent(&mouse_event)); | 216 event_handler->OnMouseEvent(&mouse_event)); |
| 217 RunAllPendingInMessageLoop(); | 217 RunAllPendingInMessageLoop(); |
| 218 EXPECT_FALSE(TooltipIsVisible()); | 218 EXPECT_FALSE(TooltipIsVisible()); |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace test | 221 } // namespace test |
| 222 } // namespace ash | 222 } // namespace ash |
| OLD | NEW |