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

Unified Diff: views/view_unittest.cc

Issue 6253005: touch: Gesture manager receives the touch-sequence status. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update unittest for gesture manager. Created 9 years, 11 months 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 | « views/touchui/gesture_manager.cc ('k') | views/widget/root_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/view_unittest.cc
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index 87f9e6ae04f5535f31dd71cf28b839c4c6c4e7b3..9035b9e7f9863dae89f045291d9efc803c34590c 100644
--- a/views/view_unittest.cc
+++ b/views/view_unittest.cc
@@ -178,6 +178,7 @@ class TestView : public View {
// TouchEvent
int last_touch_event_type_;
bool last_touch_event_was_handled_;
+ bool in_touch_sequence_;
#endif
// Painting
@@ -201,7 +202,7 @@ class MockGestureManager : public GestureManager {
bool ProcessTouchEventForGesture(const TouchEvent& event,
View* source,
- bool previouslyHandled);
+ View::TouchStatus status);
MockGestureManager();
bool previously_handled_flag_;
@@ -414,14 +415,14 @@ TEST_F(ViewTest, MouseEvent) {
bool MockGestureManager::ProcessTouchEventForGesture(
const TouchEvent& event,
View* source,
- bool previouslyHandled) {
- if (previouslyHandled) {
+ View::TouchStatus status) {
+ if (status != View::TOUCH_STATUS_UNKNOWN) {
dispatched_synthetic_event_ = false;
return false;
}
last_touch_event_ = event.GetType();
last_view_ = source;
- previously_handled_flag_ = previouslyHandled;
+ previously_handled_flag_ = status != View::TOUCH_STATUS_UNKNOWN;
dispatched_synthetic_event_ = true;
return true;
}
@@ -432,6 +433,18 @@ MockGestureManager::MockGestureManager() {
View::TouchStatus TestView::OnTouchEvent(const TouchEvent& event) {
last_touch_event_type_ = event.GetType();
location_.SetPoint(event.x(), event.y());
+ if (!in_touch_sequence_) {
+ if (event.GetType() == Event::ET_TOUCH_PRESSED) {
+ in_touch_sequence_ = true;
+ return TOUCH_STATUS_START;
+ }
+ } else {
+ if (event.GetType() == Event::ET_TOUCH_RELEASED) {
+ in_touch_sequence_ = false;
+ return TOUCH_STATUS_END;
+ }
+ return TOUCH_STATUS_CONTINUE;
+ }
return last_touch_event_was_handled_ ? TOUCH_STATUS_CONTINUE :
TOUCH_STATUS_UNKNOWN;
}
« no previous file with comments | « views/touchui/gesture_manager.cc ('k') | views/widget/root_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698