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

Unified Diff: ui/views/view_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/view.cc ('k') | ui/views/widget/desktop_aura/desktop_activation_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view_unittest.cc
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc
index b5165eb527d0221c3d8bcc3c8f10a90573217c10..e819d149f30773d3739247a88c253e4315ae212f 100644
--- a/ui/views/view_unittest.cc
+++ b/ui/views/view_unittest.cc
@@ -232,7 +232,7 @@ class TestView : public View {
virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
// Ignores GestureEvent by default.
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
@@ -277,7 +277,7 @@ class TestViewIgnoreTouch : public TestView {
virtual ~TestViewIgnoreTouch() {}
private:
- virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
};
// A view subclass that consumes all Gesture events for testing purposes.
@@ -474,27 +474,30 @@ TEST_F(ViewTest, DeleteOnPressed) {
////////////////////////////////////////////////////////////////////////////////
// TouchEvent
////////////////////////////////////////////////////////////////////////////////
-ui::EventResult TestView::OnTouchEvent(ui::TouchEvent* event) {
+void TestView::OnTouchEvent(ui::TouchEvent* event) {
last_touch_event_type_ = event->type();
location_.SetPoint(event->x(), event->y());
if (!in_touch_sequence_) {
if (event->type() == ui::ET_TOUCH_PRESSED) {
in_touch_sequence_ = true;
- return ui::ER_CONSUMED;
+ event->StopPropagation();
+ return;
}
} else {
if (event->type() == ui::ET_TOUCH_RELEASED) {
in_touch_sequence_ = false;
- return ui::ER_HANDLED;
+ event->SetHandled();
+ return;
}
- return ui::ER_CONSUMED;
+ event->StopPropagation();
+ return;
}
- return last_touch_event_was_handled_ ? ui::ER_CONSUMED :
- ui::ER_UNHANDLED;
+
+ if (last_touch_event_was_handled_)
+ event->StopPropagation();
}
-ui::EventResult TestViewIgnoreTouch::OnTouchEvent(ui::TouchEvent* event) {
- return ui::ER_UNHANDLED;
+void TestViewIgnoreTouch::OnTouchEvent(ui::TouchEvent* event) {
}
TEST_F(ViewTest, TouchEvent) {
« no previous file with comments | « ui/views/view.cc ('k') | ui/views/widget/desktop_aura/desktop_activation_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698