Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Side by Side Diff: ash/launcher/launcher_tooltip_manager_unittest.cc

Issue 11568006: events: Update scroll and touch handlers to not return EventResult. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: self-nit Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/launcher/launcher_tooltip_manager.cc ('k') | ash/launcher/overflow_bubble.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 EXPECT_EQ(ui::ER_UNHANDLED,
160 event_handler->OnKeyEvent(&key_event)); 160 event_handler->OnKeyEvent(&key_event));
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 EXPECT_EQ(ui::ER_UNHANDLED, 167 event_handler->OnTouchEvent(&touch_event);
168 event_handler->OnTouchEvent(&touch_event)); 168 EXPECT_FALSE(touch_event.handled());
169 EXPECT_FALSE(TooltipIsVisible()); 169 EXPECT_FALSE(TooltipIsVisible());
170 170
171 // Shouldn't hide if the touch happens on the tooltip. 171 // Shouldn't hide if the touch happens on the tooltip.
172 ShowImmediately(); 172 ShowImmediately();
173 views::Widget* tooltip_widget = GetTooltipWidget(); 173 views::Widget* tooltip_widget = GetTooltipWidget();
174 SetEventTarget(tooltip_widget->GetNativeWindow(), &touch_event); 174 SetEventTarget(tooltip_widget->GetNativeWindow(), &touch_event);
175 EXPECT_EQ(ui::ER_UNHANDLED, 175 event_handler->OnTouchEvent(&touch_event);
176 event_handler->OnTouchEvent(&touch_event)); 176 EXPECT_FALSE(touch_event.handled());
177 EXPECT_TRUE(TooltipIsVisible()); 177 EXPECT_TRUE(TooltipIsVisible());
178 178
179 // Should hide for gesture events. 179 // Should hide for gesture events.
180 ui::GestureEvent gesture_event( 180 ui::GestureEvent gesture_event(
181 ui::ET_GESTURE_BEGIN, 0, 0, ui::EF_NONE, 181 ui::ET_GESTURE_BEGIN, 0, 0, ui::EF_NONE,
182 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), 182 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000),
183 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0); 183 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0);
184 SetEventTarget(tooltip_widget->GetNativeWindow(), &gesture_event); 184 SetEventTarget(tooltip_widget->GetNativeWindow(), &gesture_event);
185 event_handler->OnGestureEvent(&gesture_event); 185 event_handler->OnGestureEvent(&gesture_event);
186 EXPECT_FALSE(gesture_event.handled()); 186 EXPECT_FALSE(gesture_event.handled());
(...skipping 24 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « ash/launcher/launcher_tooltip_manager.cc ('k') | ash/launcher/overflow_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698