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

Side by Side Diff: ui/aura/gestures/gesture_recognizer_unittest.cc

Issue 9773024: This patch implements Chromium's Aura gesture recognizer in terms of utouch-grail and utouch-frame … (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 8 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 unified diff | Download patch
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 "base/timer.h" 5 #include "base/timer.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/aura/event.h" 7 #include "ui/aura/event.h"
8 #include "ui/aura/gestures/gesture_recognizer_aura.h" 8 #include "ui/aura/gestures/gesture_recognizer_aura.h"
9 #include "ui/aura/gestures/gesture_sequence.h" 9 #include "ui/aura/gestures/gesture_sequence.h"
10 #include "ui/aura/root_window.h" 10 #include "ui/aura/root_window.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 pinch_begin_ = true; 112 pinch_begin_ = true;
113 break; 113 break;
114 case ui::ET_GESTURE_PINCH_UPDATE: 114 case ui::ET_GESTURE_PINCH_UPDATE:
115 pinch_update_ = true; 115 pinch_update_ = true;
116 break; 116 break;
117 case ui::ET_GESTURE_PINCH_END: 117 case ui::ET_GESTURE_PINCH_END:
118 pinch_end_ = true; 118 pinch_end_ = true;
119 break; 119 break;
120 case ui::ET_GESTURE_LONG_PRESS: 120 case ui::ET_GESTURE_LONG_PRESS:
121 long_press_ = true; 121 long_press_ = true;
122 touch_id_ = gesture->delta_x(); 122 touch_id_ = gesture->point_id();
123 break; 123 break;
124 default: 124 default:
125 NOTREACHED(); 125 NOTREACHED();
126 } 126 }
127 return ui::GESTURE_STATUS_CONSUMED; 127 return ui::GESTURE_STATUS_CONSUMED;
128 } 128 }
129 129
130 private: 130 private:
131 bool tap_; 131 bool tap_;
132 bool tap_down_; 132 bool tap_down_;
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 837
838 // Check that unprocessed gesture events generate appropriate synthetic mouse 838 // Check that unprocessed gesture events generate appropriate synthetic mouse
839 // events. 839 // events.
840 TEST_F(GestureRecognizerTest, GestureTapSyntheticMouse) { 840 TEST_F(GestureRecognizerTest, GestureTapSyntheticMouse) {
841 scoped_ptr<GestureEventSynthDelegate> delegate( 841 scoped_ptr<GestureEventSynthDelegate> delegate(
842 new GestureEventSynthDelegate()); 842 new GestureEventSynthDelegate());
843 scoped_ptr<Window> window(CreateTestWindowWithDelegate(delegate.get(), -1234, 843 scoped_ptr<Window> window(CreateTestWindowWithDelegate(delegate.get(), -1234,
844 gfx::Rect(0, 0, 123, 45), NULL)); 844 gfx::Rect(0, 0, 123, 45), NULL));
845 845
846 delegate->Reset(); 846 delegate->Reset();
847 GestureEvent tap(ui::ET_GESTURE_TAP, 20, 20, 0, base::Time::Now(), 0, 6); 847 GestureEvent::Properties props;
848 props.delta_x = 0;
849 props.delta_y = 6;
850 GestureEvent tap(ui::ET_GESTURE_TAP, 20, 20, 0, base::Time::Now(), props);
848 root_window()->DispatchGestureEvent(&tap); 851 root_window()->DispatchGestureEvent(&tap);
849 EXPECT_TRUE(delegate->mouse_enter()); 852 EXPECT_TRUE(delegate->mouse_enter());
850 EXPECT_TRUE(delegate->mouse_press()); 853 EXPECT_TRUE(delegate->mouse_press());
851 EXPECT_TRUE(delegate->mouse_release()); 854 EXPECT_TRUE(delegate->mouse_release());
852 EXPECT_TRUE(delegate->mouse_exit()); 855 EXPECT_TRUE(delegate->mouse_exit());
853 EXPECT_FALSE(delegate->double_click()); 856 EXPECT_FALSE(delegate->double_click());
854 857
855 delegate->Reset(); 858 delegate->Reset();
859 props.delta_y = 0;
856 GestureEvent tap2(ui::ET_GESTURE_DOUBLE_TAP, 20, 20, 0, 860 GestureEvent tap2(ui::ET_GESTURE_DOUBLE_TAP, 20, 20, 0,
857 base::Time::Now(), 0, 0); 861 base::Time::Now(), props);
858 root_window()->DispatchGestureEvent(&tap2); 862 root_window()->DispatchGestureEvent(&tap2);
859 EXPECT_TRUE(delegate->mouse_enter()); 863 EXPECT_TRUE(delegate->mouse_enter());
860 EXPECT_TRUE(delegate->mouse_press()); 864 EXPECT_TRUE(delegate->mouse_press());
861 EXPECT_TRUE(delegate->mouse_release()); 865 EXPECT_TRUE(delegate->mouse_release());
862 EXPECT_TRUE(delegate->mouse_exit()); 866 EXPECT_TRUE(delegate->mouse_exit());
863 EXPECT_TRUE(delegate->double_click()); 867 EXPECT_TRUE(delegate->double_click());
864 } 868 }
865 869
866 TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { 870 TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
867 scoped_ptr<QueueTouchEventDelegate> queued_delegate( 871 scoped_ptr<QueueTouchEventDelegate> queued_delegate(
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 new GestureEventConsumeDelegate()); 1268 new GestureEventConsumeDelegate());
1265 1269
1266 TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), 6); 1270 TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), 6);
1267 root_window()->DispatchTouchEvent(&release1); 1271 root_window()->DispatchTouchEvent(&release1);
1268 EXPECT_FALSE(delegate->tap()); 1272 EXPECT_FALSE(delegate->tap());
1269 EXPECT_FALSE(delegate->tap_down()); 1273 EXPECT_FALSE(delegate->tap_down());
1270 } 1274 }
1271 1275
1272 } // namespace test 1276 } // namespace test
1273 } // namespace aura 1277 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/gestures/gesture_recognizer_grail_unittest.cc ('k') | ui/aura/gestures/gesture_sequence.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698