summaryrefslogtreecommitdiffstats
path: root/views/view_unittest.cc
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 19:29:47 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 19:29:47 +0000
commitda77c28d914f2bde774beaf1a60fb05750836d56 (patch)
treea5bec75353350201711dd63d742c378e94ad7772 /views/view_unittest.cc
parent46db5eaeb15f0fbc9a24e43315c902f3038cc0fe (diff)
downloadchromium_src-da77c28d914f2bde774beaf1a60fb05750836d56.zip
chromium_src-da77c28d914f2bde774beaf1a60fb05750836d56.tar.gz
chromium_src-da77c28d914f2bde774beaf1a60fb05750836d56.tar.bz2
touch: Gesture manager receives the touch-sequence status.
OnTouchEvent now returns the status of the touch sequence, instead of a simple bool. The gesture manager can presumably make a better decision if this information is available to it. For more details: http://codereview.chromium.org/6347002/ BUG=none TEST=ViewTest.TouchEvent Review URL: http://codereview.chromium.org/6253005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71824 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/view_unittest.cc')
-rw-r--r--views/view_unittest.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index 87f9e6a..9035b9e 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;
}