| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 TEST_F(LauncherTooltipManagerTest, ShouldHideForEvents) { | 149 TEST_F(LauncherTooltipManagerTest, ShouldHideForEvents) { |
| 150 ShowImmediately(); | 150 ShowImmediately(); |
| 151 ASSERT_TRUE(TooltipIsVisible()); | 151 ASSERT_TRUE(TooltipIsVisible()); |
| 152 | 152 |
| 153 aura::RootWindow* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); | 153 aura::RootWindow* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); |
| 154 ui::EventHandler* event_handler = GetEventHandler(); | 154 ui::EventHandler* event_handler = GetEventHandler(); |
| 155 | 155 |
| 156 // Should not hide for key events. | 156 // Should not hide for key events. |
| 157 ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE, false); | 157 ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE, false); |
| 158 SetEventTarget(root_window, &key_event); | 158 SetEventTarget(root_window, &key_event); |
| 159 EXPECT_EQ(ui::ER_UNHANDLED, | 159 event_handler->OnKeyEvent(&key_event); |
| 160 event_handler->OnKeyEvent(&key_event)); | 160 EXPECT_FALSE(key_event.handled()); |
| 161 EXPECT_TRUE(TooltipIsVisible()); | 161 EXPECT_TRUE(TooltipIsVisible()); |
| 162 | 162 |
| 163 // Should hide for touch events. | 163 // Should hide for touch events. |
| 164 ui::TouchEvent touch_event( | 164 ui::TouchEvent touch_event( |
| 165 ui::ET_TOUCH_PRESSED, gfx::Point(), 0, base::TimeDelta()); | 165 ui::ET_TOUCH_PRESSED, gfx::Point(), 0, base::TimeDelta()); |
| 166 SetEventTarget(root_window, &touch_event); | 166 SetEventTarget(root_window, &touch_event); |
| 167 event_handler->OnTouchEvent(&touch_event); | 167 event_handler->OnTouchEvent(&touch_event); |
| 168 EXPECT_FALSE(touch_event.handled()); | 168 EXPECT_FALSE(touch_event.handled()); |
| 169 EXPECT_FALSE(TooltipIsVisible()); | 169 EXPECT_FALSE(TooltipIsVisible()); |
| 170 | 170 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // Should hide if the mouse is out of the tooltip. | 211 // Should hide if the mouse is out of the tooltip. |
| 212 test_api.set_location(tooltip_rect.origin() + gfx::Vector2d(-1, -1)); | 212 test_api.set_location(tooltip_rect.origin() + gfx::Vector2d(-1, -1)); |
| 213 EXPECT_EQ(ui::ER_UNHANDLED, | 213 EXPECT_EQ(ui::ER_UNHANDLED, |
| 214 event_handler->OnMouseEvent(&mouse_event)); | 214 event_handler->OnMouseEvent(&mouse_event)); |
| 215 RunAllPendingInMessageLoop(); | 215 RunAllPendingInMessageLoop(); |
| 216 EXPECT_FALSE(TooltipIsVisible()); | 216 EXPECT_FALSE(TooltipIsVisible()); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace test | 219 } // namespace test |
| 220 } // namespace ash | 220 } // namespace ash |
| OLD | NEW |