OLD | NEW |
---|---|
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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 velocity_y_(0), | 95 velocity_y_(0), |
96 scroll_x_ordinal_(0), | 96 scroll_x_ordinal_(0), |
97 scroll_y_ordinal_(0), | 97 scroll_y_ordinal_(0), |
98 scroll_velocity_x_ordinal_(0), | 98 scroll_velocity_x_ordinal_(0), |
99 scroll_velocity_y_ordinal_(0), | 99 scroll_velocity_y_ordinal_(0), |
100 velocity_x_ordinal_(0), | 100 velocity_x_ordinal_(0), |
101 velocity_y_ordinal_(0), | 101 velocity_y_ordinal_(0), |
102 scroll_x_hint_(0), | 102 scroll_x_hint_(0), |
103 scroll_y_hint_(0), | 103 scroll_y_hint_(0), |
104 tap_count_(0), | 104 tap_count_(0), |
105 wait_until_event_(ui::ET_UNKNOWN) { | 105 wait_until_event_(ui::ET_UNKNOWN), |
106 } | 106 flags_(0) {} |
107 | 107 |
108 virtual ~GestureEventConsumeDelegate() {} | 108 virtual ~GestureEventConsumeDelegate() {} |
109 | 109 |
110 void Reset() { | 110 void Reset() { |
111 events_.clear(); | 111 events_.clear(); |
112 tap_ = false; | 112 tap_ = false; |
113 tap_down_ = false; | 113 tap_down_ = false; |
114 tap_cancel_ = false; | 114 tap_cancel_ = false; |
115 begin_ = false; | 115 begin_ = false; |
116 end_ = false; | 116 end_ = false; |
(...skipping 25 matching lines...) Expand all Loading... | |
142 scroll_x_ordinal_ = 0; | 142 scroll_x_ordinal_ = 0; |
143 scroll_y_ordinal_ = 0; | 143 scroll_y_ordinal_ = 0; |
144 scroll_velocity_x_ordinal_ = 0; | 144 scroll_velocity_x_ordinal_ = 0; |
145 scroll_velocity_y_ordinal_ = 0; | 145 scroll_velocity_y_ordinal_ = 0; |
146 velocity_x_ordinal_ = 0; | 146 velocity_x_ordinal_ = 0; |
147 velocity_y_ordinal_ = 0; | 147 velocity_y_ordinal_ = 0; |
148 scroll_x_hint_ = 0; | 148 scroll_x_hint_ = 0; |
149 scroll_y_hint_ = 0; | 149 scroll_y_hint_ = 0; |
150 tap_count_ = 0; | 150 tap_count_ = 0; |
151 scale_ = 0; | 151 scale_ = 0; |
152 flags_ = 0; | |
152 } | 153 } |
153 | 154 |
154 const std::vector<ui::EventType>& events() const { return events_; }; | 155 const std::vector<ui::EventType>& events() const { return events_; }; |
155 | 156 |
156 bool tap() const { return tap_; } | 157 bool tap() const { return tap_; } |
157 bool tap_down() const { return tap_down_; } | 158 bool tap_down() const { return tap_down_; } |
158 bool tap_cancel() const { return tap_cancel_; } | 159 bool tap_cancel() const { return tap_cancel_; } |
159 bool begin() const { return begin_; } | 160 bool begin() const { return begin_; } |
160 bool end() const { return end_; } | 161 bool end() const { return end_; } |
161 bool scroll_begin() const { return scroll_begin_; } | 162 bool scroll_begin() const { return scroll_begin_; } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 float scroll_y_ordinal() const { return scroll_y_ordinal_; } | 197 float scroll_y_ordinal() const { return scroll_y_ordinal_; } |
197 float scroll_velocity_x_ordinal() const { return scroll_velocity_x_ordinal_; } | 198 float scroll_velocity_x_ordinal() const { return scroll_velocity_x_ordinal_; } |
198 float scroll_velocity_y_ordinal() const { return scroll_velocity_y_ordinal_; } | 199 float scroll_velocity_y_ordinal() const { return scroll_velocity_y_ordinal_; } |
199 float velocity_x_ordinal() const { return velocity_x_ordinal_; } | 200 float velocity_x_ordinal() const { return velocity_x_ordinal_; } |
200 float velocity_y_ordinal() const { return velocity_y_ordinal_; } | 201 float velocity_y_ordinal() const { return velocity_y_ordinal_; } |
201 float scroll_x_hint() const { return scroll_x_hint_; } | 202 float scroll_x_hint() const { return scroll_x_hint_; } |
202 float scroll_y_hint() const { return scroll_y_hint_; } | 203 float scroll_y_hint() const { return scroll_y_hint_; } |
203 float scale() const { return scale_; } | 204 float scale() const { return scale_; } |
204 const gfx::Rect& bounding_box() const { return bounding_box_; } | 205 const gfx::Rect& bounding_box() const { return bounding_box_; } |
205 int tap_count() const { return tap_count_; } | 206 int tap_count() const { return tap_count_; } |
207 int flags() const { return flags_; } | |
206 | 208 |
207 void WaitUntilReceivedGesture(ui::EventType type) { | 209 void WaitUntilReceivedGesture(ui::EventType type) { |
208 wait_until_event_ = type; | 210 wait_until_event_ = type; |
209 run_loop_.reset(new base::RunLoop()); | 211 run_loop_.reset(new base::RunLoop()); |
210 run_loop_->Run(); | 212 run_loop_->Run(); |
211 } | 213 } |
212 | 214 |
213 virtual void OnGestureEvent(ui::GestureEvent* gesture) OVERRIDE { | 215 virtual void OnGestureEvent(ui::GestureEvent* gesture) OVERRIDE { |
214 events_.push_back(gesture->type()); | 216 events_.push_back(gesture->type()); |
215 bounding_box_ = gesture->details().bounding_box(); | 217 bounding_box_ = gesture->details().bounding_box(); |
218 flags_ = gesture->flags(); | |
216 switch (gesture->type()) { | 219 switch (gesture->type()) { |
217 case ui::ET_GESTURE_TAP: | 220 case ui::ET_GESTURE_TAP: |
218 tap_location_ = gesture->location(); | 221 tap_location_ = gesture->location(); |
219 tap_count_ = gesture->details().tap_count(); | 222 tap_count_ = gesture->details().tap_count(); |
220 tap_ = true; | 223 tap_ = true; |
221 break; | 224 break; |
222 case ui::ET_GESTURE_TAP_DOWN: | 225 case ui::ET_GESTURE_TAP_DOWN: |
223 tap_down_ = true; | 226 tap_down_ = true; |
224 break; | 227 break; |
225 case ui::ET_GESTURE_TAP_CANCEL: | 228 case ui::ET_GESTURE_TAP_CANCEL: |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 break; | 283 break; |
281 case ui::ET_GESTURE_SHOW_PRESS: | 284 case ui::ET_GESTURE_SHOW_PRESS: |
282 show_press_ = true; | 285 show_press_ = true; |
283 break; | 286 break; |
284 case ui::ET_GESTURE_MULTIFINGER_SWIPE: | 287 case ui::ET_GESTURE_MULTIFINGER_SWIPE: |
285 swipe_left_ = gesture->details().swipe_left(); | 288 swipe_left_ = gesture->details().swipe_left(); |
286 swipe_right_ = gesture->details().swipe_right(); | 289 swipe_right_ = gesture->details().swipe_right(); |
287 swipe_up_ = gesture->details().swipe_up(); | 290 swipe_up_ = gesture->details().swipe_up(); |
288 swipe_down_ = gesture->details().swipe_down(); | 291 swipe_down_ = gesture->details().swipe_down(); |
289 break; | 292 break; |
293 case ui::ET_SCROLL_FLING_CANCEL: | |
294 // Only used in unified gesture detection. | |
295 break; | |
290 default: | 296 default: |
291 NOTREACHED(); | 297 NOTREACHED(); |
292 } | 298 } |
293 if (wait_until_event_ == gesture->type() && run_loop_) { | 299 if (wait_until_event_ == gesture->type() && run_loop_) { |
294 run_loop_->Quit(); | 300 run_loop_->Quit(); |
295 wait_until_event_ = ui::ET_UNKNOWN; | 301 wait_until_event_ = ui::ET_UNKNOWN; |
296 } | 302 } |
297 gesture->StopPropagation(); | 303 gesture->StopPropagation(); |
298 } | 304 } |
299 | 305 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 float scroll_y_ordinal_; | 342 float scroll_y_ordinal_; |
337 float scroll_velocity_x_ordinal_; | 343 float scroll_velocity_x_ordinal_; |
338 float scroll_velocity_y_ordinal_; | 344 float scroll_velocity_y_ordinal_; |
339 float velocity_x_ordinal_; | 345 float velocity_x_ordinal_; |
340 float velocity_y_ordinal_; | 346 float velocity_y_ordinal_; |
341 float scroll_x_hint_; | 347 float scroll_x_hint_; |
342 float scroll_y_hint_; | 348 float scroll_y_hint_; |
343 float scale_; | 349 float scale_; |
344 gfx::Rect bounding_box_; | 350 gfx::Rect bounding_box_; |
345 int tap_count_; | 351 int tap_count_; |
352 int flags_; | |
346 | 353 |
347 ui::EventType wait_until_event_; | 354 ui::EventType wait_until_event_; |
348 | 355 |
349 DISALLOW_COPY_AND_ASSIGN(GestureEventConsumeDelegate); | 356 DISALLOW_COPY_AND_ASSIGN(GestureEventConsumeDelegate); |
350 }; | 357 }; |
351 | 358 |
352 class QueueTouchEventDelegate : public GestureEventConsumeDelegate { | 359 class QueueTouchEventDelegate : public GestureEventConsumeDelegate { |
353 public: | 360 public: |
354 explicit QueueTouchEventDelegate(WindowEventDispatcher* dispatcher) | 361 explicit QueueTouchEventDelegate(WindowEventDispatcher* dispatcher) |
355 : window_(NULL), | 362 : window_(NULL), |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 scoped_ptr<ui::GestureRecognizer> new_gr_; | 556 scoped_ptr<ui::GestureRecognizer> new_gr_; |
550 | 557 |
551 DISALLOW_COPY_AND_ASSIGN(ScopedGestureRecognizerSetter); | 558 DISALLOW_COPY_AND_ASSIGN(ScopedGestureRecognizerSetter); |
552 }; | 559 }; |
553 | 560 |
554 class TimedEvents { | 561 class TimedEvents { |
555 private: | 562 private: |
556 int simulated_now_; | 563 int simulated_now_; |
557 | 564 |
558 public: | 565 public: |
559 TimedEvents() : simulated_now_(0) { | 566 // Use a non-zero start time to pass DCHECKs which ensure events have had a |
567 // time assigned. | |
568 TimedEvents() : simulated_now_(1) { | |
560 } | 569 } |
561 | 570 |
562 base::TimeDelta Now() { | 571 base::TimeDelta Now() { |
563 base::TimeDelta t = base::TimeDelta::FromMilliseconds(simulated_now_); | 572 base::TimeDelta t = base::TimeDelta::FromMilliseconds(simulated_now_); |
564 simulated_now_++; | 573 simulated_now_++; |
565 return t; | 574 return t; |
566 } | 575 } |
567 | 576 |
568 base::TimeDelta LeapForward(int time_in_millis) { | 577 base::TimeDelta LeapForward(int time_in_millis) { |
569 simulated_now_ += time_in_millis; | 578 simulated_now_ += time_in_millis; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
687 target->RemovePreTargetHandler(this); | 696 target->RemovePreTargetHandler(this); |
688 target->parent()->RemoveChild(target); | 697 target->parent()->RemoveChild(target); |
689 } | 698 } |
690 } | 699 } |
691 | 700 |
692 DISALLOW_COPY_AND_ASSIGN(RemoveOnTouchCancelHandler); | 701 DISALLOW_COPY_AND_ASSIGN(RemoveOnTouchCancelHandler); |
693 }; | 702 }; |
694 | 703 |
695 } // namespace | 704 } // namespace |
696 | 705 |
697 class GestureRecognizerTest : public AuraTestBase { | 706 class GestureRecognizerTest : public AuraTestBase, |
707 public ::testing::WithParamInterface<bool> { | |
698 public: | 708 public: |
699 GestureRecognizerTest() {} | 709 GestureRecognizerTest() {} |
700 | 710 |
711 bool UsingUnifiedGR() { | |
712 return GetParam(); | |
713 } | |
714 | |
701 virtual void SetUp() OVERRIDE { | 715 virtual void SetUp() OVERRIDE { |
702 CommandLine::ForCurrentProcess()->AppendSwitch( | 716 // TODO(tdresser): Once unified GR has landed, only run these tests once. |
703 switches::kEnableScrollPrediction); | 717 if (UsingUnifiedGR()) { |
718 // TODO(tdresser): use unified GR once it's available. | |
719 // CommandLine::ForCurrentProcess()->AppendSwitch( | |
720 // switches::kUseUnifiedGestureDetector); | |
721 } | |
722 | |
704 AuraTestBase::SetUp(); | 723 AuraTestBase::SetUp(); |
705 } | 724 } |
706 | 725 |
707 DISALLOW_COPY_AND_ASSIGN(GestureRecognizerTest); | 726 DISALLOW_COPY_AND_ASSIGN(GestureRecognizerTest); |
708 }; | 727 }; |
709 | 728 |
710 // Check that appropriate touch events generate tap gesture events. | 729 // Check that appropriate touch events generate tap gesture events. |
711 TEST_F(GestureRecognizerTest, GestureEventTap) { | 730 TEST_P(GestureRecognizerTest, GestureEventTap) { |
712 scoped_ptr<GestureEventConsumeDelegate> delegate( | 731 scoped_ptr<GestureEventConsumeDelegate> delegate( |
713 new GestureEventConsumeDelegate()); | 732 new GestureEventConsumeDelegate()); |
714 TimedEvents tes; | 733 TimedEvents tes; |
715 const int kWindowWidth = 123; | 734 const int kWindowWidth = 123; |
716 const int kWindowHeight = 45; | 735 const int kWindowHeight = 45; |
717 const int kTouchId = 2; | 736 const int kTouchId = 2; |
718 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 737 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
719 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 738 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
720 delegate.get(), -1234, bounds, root_window())); | 739 delegate.get(), -1234, bounds, root_window())); |
721 | 740 |
(...skipping 30 matching lines...) Expand all Loading... | |
752 EXPECT_TRUE(delegate->end()); | 771 EXPECT_TRUE(delegate->end()); |
753 EXPECT_FALSE(delegate->scroll_begin()); | 772 EXPECT_FALSE(delegate->scroll_begin()); |
754 EXPECT_FALSE(delegate->scroll_update()); | 773 EXPECT_FALSE(delegate->scroll_update()); |
755 EXPECT_FALSE(delegate->scroll_end()); | 774 EXPECT_FALSE(delegate->scroll_end()); |
756 | 775 |
757 EXPECT_EQ(1, delegate->tap_count()); | 776 EXPECT_EQ(1, delegate->tap_count()); |
758 } | 777 } |
759 | 778 |
760 // Check that appropriate touch events generate tap gesture events | 779 // Check that appropriate touch events generate tap gesture events |
761 // when information about the touch radii are provided. | 780 // when information about the touch radii are provided. |
762 TEST_F(GestureRecognizerTest, GestureEventTapRegion) { | 781 TEST_P(GestureRecognizerTest, GestureEventTapRegion) { |
763 scoped_ptr<GestureEventConsumeDelegate> delegate( | 782 scoped_ptr<GestureEventConsumeDelegate> delegate( |
764 new GestureEventConsumeDelegate()); | 783 new GestureEventConsumeDelegate()); |
765 TimedEvents tes; | 784 TimedEvents tes; |
766 const int kWindowWidth = 800; | 785 const int kWindowWidth = 800; |
767 const int kWindowHeight = 600; | 786 const int kWindowHeight = 600; |
768 const int kTouchId = 2; | 787 const int kTouchId = 2; |
769 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); | 788 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); |
770 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 789 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
771 delegate.get(), -1234, bounds, root_window())); | 790 delegate.get(), -1234, bounds, root_window())); |
772 | 791 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
992 EXPECT_EQ(1, delegate->tap_count()); | 1011 EXPECT_EQ(1, delegate->tap_count()); |
993 gfx::Point actual_point(delegate->tap_location()); | 1012 gfx::Point actual_point(delegate->tap_location()); |
994 EXPECT_EQ(33, delegate->bounding_box().width()); | 1013 EXPECT_EQ(33, delegate->bounding_box().width()); |
995 EXPECT_EQ(32, delegate->bounding_box().height()); | 1014 EXPECT_EQ(32, delegate->bounding_box().height()); |
996 EXPECT_EQ(397, actual_point.x()); | 1015 EXPECT_EQ(397, actual_point.x()); |
997 EXPECT_EQ(149, actual_point.y()); | 1016 EXPECT_EQ(149, actual_point.y()); |
998 } | 1017 } |
999 } | 1018 } |
1000 | 1019 |
1001 // Check that appropriate touch events generate scroll gesture events. | 1020 // Check that appropriate touch events generate scroll gesture events. |
1002 TEST_F(GestureRecognizerTest, GestureEventScroll) { | 1021 TEST_P(GestureRecognizerTest, GestureEventScroll) { |
1003 // We'll start by moving the touch point by (10.5, 10.5). We want 5 dips of | 1022 // We'll start by moving the touch point by (10.5, 10.5). We want 5 dips of |
1004 // that distance to be consumed by the slop, so we set the slop radius to | 1023 // that distance to be consumed by the slop, so we set the slop radius to |
1005 // sqrt(5 * 5 + 5 * 5). | 1024 // sqrt(5 * 5 + 5 * 5). |
1006 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click( | 1025 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click( |
1007 sqrt(static_cast<double>(5 * 5 + 5 * 5))); | 1026 sqrt(static_cast<double>(5 * 5 + 5 * 5))); |
1008 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1027 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1009 new GestureEventConsumeDelegate()); | 1028 new GestureEventConsumeDelegate()); |
1010 TimedEvents tes; | 1029 TimedEvents tes; |
1011 const int kWindowWidth = 123; | 1030 const int kWindowWidth = 123; |
1012 const int kWindowHeight = 45; | 1031 const int kWindowHeight = 45; |
(...skipping 23 matching lines...) Expand all Loading... | |
1036 // The slop consumed 5 dips | 1055 // The slop consumed 5 dips |
1037 EXPECT_FLOAT_EQ(5.5, delegate->scroll_x()); | 1056 EXPECT_FLOAT_EQ(5.5, delegate->scroll_x()); |
1038 EXPECT_FLOAT_EQ(5.5, delegate->scroll_y()); | 1057 EXPECT_FLOAT_EQ(5.5, delegate->scroll_y()); |
1039 EXPECT_EQ(gfx::Point(1, 1).ToString(), | 1058 EXPECT_EQ(gfx::Point(1, 1).ToString(), |
1040 delegate->scroll_begin_position().ToString()); | 1059 delegate->scroll_begin_position().ToString()); |
1041 | 1060 |
1042 // When scrolling with a single finger, the bounding box of the gesture should | 1061 // When scrolling with a single finger, the bounding box of the gesture should |
1043 // be empty, since it's a single point and the radius for testing is zero. | 1062 // be empty, since it's a single point and the radius for testing is zero. |
1044 EXPECT_TRUE(delegate->bounding_box().IsEmpty()); | 1063 EXPECT_TRUE(delegate->bounding_box().IsEmpty()); |
1045 | 1064 |
1046 // Move some more to generate a few more scroll updates. | 1065 // Move some more to generate a few more scroll updates. Make sure that we get |
1047 tes.SendScrollEvent(event_processor(), 91, 192, kTouchId, delegate.get()); | 1066 // out of the snap channel for the unified GR. |
1067 tes.SendScrollEvent(event_processor(), 20, 120, kTouchId, delegate.get()); | |
1048 EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); | 1068 EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); |
1049 EXPECT_FLOAT_EQ(-20.5, delegate->scroll_x()); | 1069 EXPECT_FLOAT_EQ(-91.5, delegate->scroll_x()); |
1050 EXPECT_FLOAT_EQ(-19.5, delegate->scroll_y()); | 1070 EXPECT_FLOAT_EQ(-91.5, delegate->scroll_y()); |
1051 EXPECT_TRUE(delegate->bounding_box().IsEmpty()); | 1071 EXPECT_TRUE(delegate->bounding_box().IsEmpty()); |
1052 | 1072 |
1053 tes.SendScrollEvent(event_processor(), 121, 196, kTouchId, delegate.get()); | 1073 tes.SendScrollEvent(event_processor(), 50, 124, kTouchId, delegate.get()); |
1054 EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); | 1074 EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); |
1055 EXPECT_EQ(30, delegate->scroll_x()); | 1075 EXPECT_EQ(30, delegate->scroll_x()); |
1056 EXPECT_EQ(4, delegate->scroll_y()); | 1076 EXPECT_EQ(4, delegate->scroll_y()); |
1057 EXPECT_TRUE(delegate->bounding_box().IsEmpty()); | 1077 EXPECT_TRUE(delegate->bounding_box().IsEmpty()); |
1058 | 1078 |
1059 // Release the touch. This should end the scroll. | 1079 // Release the touch. This should end the scroll. |
1060 delegate->Reset(); | 1080 delegate->Reset(); |
1061 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 1081 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
1062 kTouchId, | 1082 kTouchId, |
1063 tes.LeapForward(50)); | 1083 tes.LeapForward(50)); |
1064 DispatchEventUsingWindowDispatcher(&release); | 1084 DispatchEventUsingWindowDispatcher(&release); |
1065 EXPECT_2_EVENTS(delegate->events(), | 1085 EXPECT_2_EVENTS(delegate->events(), |
1066 ui::ET_SCROLL_FLING_START, | 1086 ui::ET_SCROLL_FLING_START, |
1067 ui::ET_GESTURE_END); | 1087 ui::ET_GESTURE_END); |
1068 EXPECT_TRUE(delegate->bounding_box().IsEmpty()); | 1088 EXPECT_TRUE(delegate->bounding_box().IsEmpty()); |
1069 } | 1089 } |
1070 | 1090 |
1071 // Check that predicted scroll update positions are correct. | 1091 // Check that predicted scroll update positions are correct. |
1072 TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) { | 1092 TEST_P(GestureRecognizerTest, GestureEventScrollPrediction) { |
1073 const double prediction_interval = 0.03; | 1093 const double prediction_interval = 0.03; |
1074 ui::GestureConfiguration::set_scroll_prediction_seconds(prediction_interval); | 1094 ui::GestureConfiguration::set_scroll_prediction_seconds(prediction_interval); |
1075 // We'll start by moving the touch point by (5, 5). We want all of that | 1095 // We'll start by moving the touch point by (5, 5). We want all of that |
1076 // distance to be consumed by the slop, so we set the slop radius to | 1096 // distance to be consumed by the slop, so we set the slop radius to |
1077 // sqrt(5 * 5 + 5 * 5). | 1097 // sqrt(5 * 5 + 5 * 5). |
1078 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click( | 1098 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click( |
1079 sqrt(static_cast<double>(5 * 5 + 5 * 5))); | 1099 sqrt(static_cast<double>(5 * 5 + 5 * 5))); |
1080 | 1100 |
1081 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1101 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1082 new GestureEventConsumeDelegate()); | 1102 new GestureEventConsumeDelegate()); |
(...skipping 11 matching lines...) Expand all Loading... | |
1094 gfx::Vector2dF total_scroll; | 1114 gfx::Vector2dF total_scroll; |
1095 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(96, 196), | 1115 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(96, 196), |
1096 kTouchId, tes.Now()); | 1116 kTouchId, tes.Now()); |
1097 DispatchEventUsingWindowDispatcher(&press); | 1117 DispatchEventUsingWindowDispatcher(&press); |
1098 EXPECT_2_EVENTS(delegate->events(), | 1118 EXPECT_2_EVENTS(delegate->events(), |
1099 ui::ET_GESTURE_BEGIN, | 1119 ui::ET_GESTURE_BEGIN, |
1100 ui::ET_GESTURE_TAP_DOWN); | 1120 ui::ET_GESTURE_TAP_DOWN); |
1101 delegate->Reset(); | 1121 delegate->Reset(); |
1102 | 1122 |
1103 // Get rid of touch slop. | 1123 // Get rid of touch slop. |
1104 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(101, 201), | 1124 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(111, 211), |
1105 kTouchId, tes.Now()); | 1125 kTouchId, tes.Now()); |
1106 DispatchEventUsingWindowDispatcher(&move); | 1126 DispatchEventUsingWindowDispatcher(&move); |
1107 EXPECT_3_EVENTS(delegate->events(), | 1127 EXPECT_3_EVENTS(delegate->events(), |
1108 ui::ET_GESTURE_TAP_CANCEL, | 1128 ui::ET_GESTURE_TAP_CANCEL, |
1109 ui::ET_GESTURE_SCROLL_BEGIN, | 1129 ui::ET_GESTURE_SCROLL_BEGIN, |
1110 ui::ET_GESTURE_SCROLL_UPDATE); | 1130 ui::ET_GESTURE_SCROLL_UPDATE); |
1111 total_scroll.set_x(total_scroll.x() + delegate->scroll_x()); | 1131 total_scroll.set_x(total_scroll.x() + delegate->scroll_x()); |
1112 total_scroll.set_y(total_scroll.y() + delegate->scroll_y()); | 1132 total_scroll.set_y(total_scroll.y() + delegate->scroll_y()); |
1113 | 1133 |
1114 // Move the touch-point enough so that it is considered as a scroll. This | 1134 // Move the touch-point enough so that it is considered as a scroll. This |
(...skipping 22 matching lines...) Expand all Loading... | |
1137 | 1157 |
1138 // Release the touch. This should end the scroll. | 1158 // Release the touch. This should end the scroll. |
1139 delegate->Reset(); | 1159 delegate->Reset(); |
1140 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 1160 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
1141 kTouchId, | 1161 kTouchId, |
1142 tes.LeapForward(50)); | 1162 tes.LeapForward(50)); |
1143 DispatchEventUsingWindowDispatcher(&release); | 1163 DispatchEventUsingWindowDispatcher(&release); |
1144 } | 1164 } |
1145 | 1165 |
1146 // Check that the bounding box during a scroll event is correct. | 1166 // Check that the bounding box during a scroll event is correct. |
1147 TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) { | 1167 TEST_P(GestureRecognizerTest, GestureEventScrollBoundingBox) { |
1148 TimedEvents tes; | 1168 TimedEvents tes; |
1149 for (int radius = 1; radius <= 10; ++radius) { | 1169 for (int radius = 1; radius <= 10; ++radius) { |
1150 ui::GestureConfiguration::set_default_radius(radius); | 1170 ui::GestureConfiguration::set_default_radius(radius); |
1151 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1171 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1152 new GestureEventConsumeDelegate()); | 1172 new GestureEventConsumeDelegate()); |
1153 const int kWindowWidth = 123; | 1173 const int kWindowWidth = 123; |
1154 const int kWindowHeight = 45; | 1174 const int kWindowHeight = 45; |
1155 const int kTouchId = 5; | 1175 const int kTouchId = 5; |
1156 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 1176 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
1157 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1177 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1194 kPositionY + kScrollAmount - radius, | 1214 kPositionY + kScrollAmount - radius, |
1195 radius * 2, | 1215 radius * 2, |
1196 radius * 2).ToString(), | 1216 radius * 2).ToString(), |
1197 delegate->bounding_box().ToString()); | 1217 delegate->bounding_box().ToString()); |
1198 } | 1218 } |
1199 ui::GestureConfiguration::set_default_radius(0); | 1219 ui::GestureConfiguration::set_default_radius(0); |
1200 } | 1220 } |
1201 | 1221 |
1202 // Check Scroll End Events report correct velocities | 1222 // Check Scroll End Events report correct velocities |
1203 // if the user was on a horizontal rail | 1223 // if the user was on a horizontal rail |
1204 TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) { | 1224 TEST_P(GestureRecognizerTest, GestureEventHorizontalRailFling) { |
1205 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1225 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1206 new GestureEventConsumeDelegate()); | 1226 new GestureEventConsumeDelegate()); |
1207 TimedEvents tes; | 1227 TimedEvents tes; |
1208 const int kTouchId = 7; | 1228 const int kTouchId = 7; |
1209 gfx::Rect bounds(0, 0, 1000, 1000); | 1229 gfx::Rect bounds(0, 0, 1000, 1000); |
1210 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1230 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1211 delegate.get(), -1234, bounds, root_window())); | 1231 delegate.get(), -1234, bounds, root_window())); |
1212 | 1232 |
1213 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), | 1233 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), |
1214 kTouchId, tes.Now()); | 1234 kTouchId, tes.Now()); |
1215 DispatchEventUsingWindowDispatcher(&press); | 1235 DispatchEventUsingWindowDispatcher(&press); |
1216 | 1236 |
1217 // Get rid of touch slop. | 1237 // Get rid of touch slop. |
1218 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(5, 0), | 1238 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 0), |
1219 kTouchId, tes.Now()); | 1239 kTouchId, tes.Now()); |
1220 DispatchEventUsingWindowDispatcher(&move); | 1240 DispatchEventUsingWindowDispatcher(&move); |
1221 delegate->Reset(); | 1241 delegate->Reset(); |
1222 | 1242 |
1223 | 1243 |
1224 // Move the touch-point horizontally enough that it is considered a | 1244 // Move the touch-point horizontally enough that it is considered a |
1225 // horizontal scroll. | 1245 // horizontal scroll. |
1226 tes.SendScrollEvent(event_processor(), 25, 1, kTouchId, delegate.get()); | 1246 tes.SendScrollEvent(event_processor(), 30, 1, kTouchId, delegate.get()); |
1227 EXPECT_EQ(0, delegate->scroll_y()); | 1247 EXPECT_FLOAT_EQ(0, delegate->scroll_y()); |
1228 EXPECT_EQ(1, delegate->scroll_y_ordinal()); | 1248 EXPECT_FLOAT_EQ(1, delegate->scroll_y_ordinal()); |
1229 EXPECT_EQ(20, delegate->scroll_x()); | 1249 EXPECT_FLOAT_EQ(20, delegate->scroll_x()); |
1230 EXPECT_EQ(20, delegate->scroll_x_ordinal()); | 1250 EXPECT_FLOAT_EQ(20, delegate->scroll_x_ordinal()); |
1231 | 1251 |
1232 // Get a high x velocity, while still staying on the rail | 1252 // Get a high x velocity, while still staying on the rail |
1233 tes.SendScrollEvents(event_processor(), 1, 1, | 1253 tes.SendScrollEvents(event_processor(), 1, 1, |
1234 100, 10, kTouchId, 1, | 1254 100, 10, kTouchId, 1, |
1235 ui::GestureConfiguration::points_buffered_for_velocity(), | 1255 ui::GestureConfiguration::points_buffered_for_velocity(), |
1236 delegate.get()); | 1256 delegate.get()); |
1237 | 1257 |
1238 delegate->Reset(); | 1258 delegate->Reset(); |
1239 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 1259 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
1240 kTouchId, tes.Now()); | 1260 kTouchId, tes.Now()); |
1241 DispatchEventUsingWindowDispatcher(&release); | 1261 DispatchEventUsingWindowDispatcher(&release); |
1242 | 1262 |
1243 EXPECT_TRUE(delegate->fling()); | 1263 EXPECT_TRUE(delegate->fling()); |
1244 EXPECT_FALSE(delegate->scroll_end()); | 1264 EXPECT_FALSE(delegate->scroll_end()); |
1245 EXPECT_GT(delegate->velocity_x(), 0); | 1265 EXPECT_GT(delegate->velocity_x(), 0); |
1246 EXPECT_EQ(0, delegate->velocity_y()); | 1266 EXPECT_EQ(0, delegate->velocity_y()); |
1247 } | 1267 } |
1248 | 1268 |
1249 // Check Scroll End Events report correct velocities | 1269 // Check Scroll End Events report correct velocities |
1250 // if the user was on a vertical rail | 1270 // if the user was on a vertical rail |
1251 TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) { | 1271 TEST_P(GestureRecognizerTest, GestureEventVerticalRailFling) { |
1252 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1272 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1253 new GestureEventConsumeDelegate()); | 1273 new GestureEventConsumeDelegate()); |
1254 TimedEvents tes; | 1274 TimedEvents tes; |
1255 const int kTouchId = 7; | 1275 const int kTouchId = 7; |
1256 gfx::Rect bounds(0, 0, 1000, 1000); | 1276 gfx::Rect bounds(0, 0, 1000, 1000); |
1257 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1277 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1258 delegate.get(), -1234, bounds, root_window())); | 1278 delegate.get(), -1234, bounds, root_window())); |
1259 | 1279 |
1260 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), | 1280 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), |
1261 kTouchId, tes.Now()); | 1281 kTouchId, tes.Now()); |
1262 DispatchEventUsingWindowDispatcher(&press); | 1282 DispatchEventUsingWindowDispatcher(&press); |
1263 | 1283 |
1264 // Get rid of touch slop. | 1284 // Get rid of touch slop. |
1265 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(0, 5), | 1285 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(0, 10), |
1266 kTouchId, tes.Now()); | 1286 kTouchId, tes.Now()); |
1267 DispatchEventUsingWindowDispatcher(&move); | 1287 DispatchEventUsingWindowDispatcher(&move); |
1268 delegate->Reset(); | 1288 delegate->Reset(); |
1269 | 1289 |
1270 // Move the touch-point vertically enough that it is considered a | 1290 // Move the touch-point vertically enough that it is considered a |
1271 // vertical scroll. | 1291 // vertical scroll. |
1272 tes.SendScrollEvent(event_processor(), 1, 25, kTouchId, delegate.get()); | 1292 tes.SendScrollEvent(event_processor(), 1, 30, kTouchId, delegate.get()); |
1273 EXPECT_EQ(20, delegate->scroll_y()); | 1293 EXPECT_EQ(20, delegate->scroll_y()); |
1274 EXPECT_EQ(20, delegate->scroll_y_ordinal()); | 1294 EXPECT_EQ(20, delegate->scroll_y_ordinal()); |
1275 EXPECT_EQ(0, delegate->scroll_x()); | 1295 EXPECT_EQ(0, delegate->scroll_x()); |
1276 EXPECT_EQ(1, delegate->scroll_x_ordinal()); | 1296 EXPECT_EQ(1, delegate->scroll_x_ordinal()); |
1277 EXPECT_EQ(0, delegate->scroll_velocity_x()); | 1297 EXPECT_EQ(0, delegate->scroll_velocity_x()); |
1278 | 1298 |
1279 // Get a high y velocity, while still staying on the rail | 1299 // Get a high y velocity, while still staying on the rail |
1280 tes.SendScrollEvents(event_processor(), 1, 6, | 1300 tes.SendScrollEvents(event_processor(), 1, 6, |
1281 10, 100, kTouchId, 1, | 1301 10, 100, kTouchId, 1, |
1282 ui::GestureConfiguration::points_buffered_for_velocity(), | 1302 ui::GestureConfiguration::points_buffered_for_velocity(), |
1283 delegate.get()); | 1303 delegate.get()); |
1284 EXPECT_EQ(0, delegate->scroll_velocity_x()); | 1304 EXPECT_EQ(0, delegate->scroll_velocity_x()); |
1285 | 1305 |
1286 delegate->Reset(); | 1306 delegate->Reset(); |
1287 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 206), | 1307 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 206), |
1288 kTouchId, tes.Now()); | 1308 kTouchId, tes.Now()); |
1289 DispatchEventUsingWindowDispatcher(&release); | 1309 DispatchEventUsingWindowDispatcher(&release); |
1290 | 1310 |
1291 EXPECT_TRUE(delegate->fling()); | 1311 EXPECT_TRUE(delegate->fling()); |
1292 EXPECT_FALSE(delegate->scroll_end()); | 1312 EXPECT_FALSE(delegate->scroll_end()); |
1293 EXPECT_EQ(0, delegate->velocity_x()); | 1313 EXPECT_EQ(0, delegate->velocity_x()); |
1294 EXPECT_GT(delegate->velocity_y(), 0); | 1314 EXPECT_GT(delegate->velocity_y(), 0); |
1295 } | 1315 } |
1296 | 1316 |
1297 // Check Scroll End Events reports zero velocities | 1317 // Check Scroll End Events report non-zero velocities if the user is not on a |
1298 // if the user is not on a rail | 1318 // rail |
1299 TEST_F(GestureRecognizerTest, GestureEventNonRailFling) { | 1319 TEST_P(GestureRecognizerTest, GestureEventNonRailFling) { |
1300 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(0); | 1320 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(0); |
1301 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1321 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1302 new GestureEventConsumeDelegate()); | 1322 new GestureEventConsumeDelegate()); |
1303 TimedEvents tes; | 1323 TimedEvents tes; |
1304 const int kTouchId = 7; | 1324 const int kTouchId = 7; |
1305 gfx::Rect bounds(0, 0, 1000, 1000); | 1325 gfx::Rect bounds(0, 0, 1000, 1000); |
1306 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1326 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1307 delegate.get(), -1234, bounds, root_window())); | 1327 delegate.get(), -1234, bounds, root_window())); |
1308 | 1328 |
1309 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), | 1329 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), |
1310 kTouchId, tes.Now()); | 1330 kTouchId, tes.Now()); |
1311 DispatchEventUsingWindowDispatcher(&press); | 1331 DispatchEventUsingWindowDispatcher(&press); |
1312 | 1332 |
1313 // Move the touch-point such that a non-rail scroll begins | 1333 // Move the touch-point such that a non-rail scroll begins, and we're outside |
1314 tes.SendScrollEvent(event_processor(), 20, 20, kTouchId, delegate.get()); | 1334 // the snap channel for the unified GR. |
1315 EXPECT_EQ(20, delegate->scroll_y()); | 1335 tes.SendScrollEvent(event_processor(), 50, 50, kTouchId, delegate.get()); |
1316 EXPECT_EQ(20, delegate->scroll_x()); | 1336 EXPECT_EQ(50, delegate->scroll_y()); |
1337 EXPECT_EQ(50, delegate->scroll_x()); | |
1317 | 1338 |
1318 tes.SendScrollEvents(event_processor(), 1, 1, | 1339 tes.SendScrollEvents(event_processor(), 1, 1, |
1319 10, 100, kTouchId, 1, | 1340 10, 100, kTouchId, 1, |
1320 ui::GestureConfiguration::points_buffered_for_velocity(), | 1341 ui::GestureConfiguration::points_buffered_for_velocity(), |
1321 delegate.get()); | 1342 delegate.get()); |
1322 | 1343 |
1323 delegate->Reset(); | 1344 delegate->Reset(); |
1324 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 1345 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
1325 kTouchId, tes.Now()); | 1346 kTouchId, tes.Now()); |
1326 DispatchEventUsingWindowDispatcher(&release); | 1347 DispatchEventUsingWindowDispatcher(&release); |
1327 | 1348 |
1328 EXPECT_TRUE(delegate->fling()); | 1349 EXPECT_TRUE(delegate->fling()); |
1329 EXPECT_FALSE(delegate->scroll_end()); | 1350 EXPECT_FALSE(delegate->scroll_end()); |
1330 EXPECT_GT(delegate->velocity_x(), 0); | 1351 EXPECT_GT(delegate->velocity_x(), 0); |
1331 EXPECT_GT(delegate->velocity_y(), 0); | 1352 EXPECT_GT(delegate->velocity_y(), 0); |
1332 } | 1353 } |
1333 | 1354 |
1334 // Check that appropriate touch events generate long press events | 1355 // Check that appropriate touch events generate long press events |
1335 TEST_F(GestureRecognizerTest, GestureEventLongPress) { | 1356 TEST_P(GestureRecognizerTest, GestureEventLongPress) { |
1336 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1357 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1337 new GestureEventConsumeDelegate()); | 1358 new GestureEventConsumeDelegate()); |
1338 TimedEvents tes; | |
1339 const int kWindowWidth = 123; | 1359 const int kWindowWidth = 123; |
1340 const int kWindowHeight = 45; | 1360 const int kWindowHeight = 45; |
1341 const int kTouchId = 2; | 1361 const int kTouchId = 2; |
1342 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 1362 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
1343 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1363 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1344 delegate.get(), -1234, bounds, root_window())); | 1364 delegate.get(), -1234, bounds, root_window())); |
1345 | 1365 |
1346 delegate->Reset(); | 1366 delegate->Reset(); |
1347 | 1367 |
1348 TimerTestGestureRecognizer* gesture_recognizer = | 1368 TimerTestGestureRecognizer* gesture_recognizer = |
1349 new TimerTestGestureRecognizer(); | 1369 new TimerTestGestureRecognizer(); |
1350 | 1370 |
1351 ScopedGestureRecognizerSetter gr_setter(gesture_recognizer); | 1371 ScopedGestureRecognizerSetter gr_setter(gesture_recognizer); |
1352 | 1372 |
1353 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), | 1373 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, |
1354 kTouchId, tes.Now()); | 1374 gfx::Point(101, 201), |
1375 kTouchId, | |
1376 ui::EventTimeForNow()); | |
1355 DispatchEventUsingWindowDispatcher(&press1); | 1377 DispatchEventUsingWindowDispatcher(&press1); |
1356 EXPECT_TRUE(delegate->tap_down()); | 1378 EXPECT_TRUE(delegate->tap_down()); |
1357 EXPECT_TRUE(delegate->begin()); | 1379 EXPECT_TRUE(delegate->begin()); |
1358 EXPECT_FALSE(delegate->tap_cancel()); | 1380 EXPECT_FALSE(delegate->tap_cancel()); |
1359 | 1381 |
1360 // We haven't pressed long enough for a long press to occur | 1382 // We haven't pressed long enough for a long press to occur |
1361 EXPECT_FALSE(delegate->long_press()); | 1383 EXPECT_FALSE(delegate->long_press()); |
1362 | 1384 |
1363 // Wait until the timer runs out | 1385 // Wait until the timer runs out |
1364 delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_LONG_PRESS); | 1386 delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_LONG_PRESS); |
1365 EXPECT_TRUE(delegate->long_press()); | 1387 EXPECT_TRUE(delegate->long_press()); |
1366 EXPECT_FALSE(delegate->tap_cancel()); | 1388 EXPECT_FALSE(delegate->tap_cancel()); |
1367 | 1389 |
1368 delegate->Reset(); | 1390 delegate->Reset(); |
1369 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 1391 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, |
1370 kTouchId, tes.Now()); | 1392 gfx::Point(101, 201), |
1393 kTouchId, | |
1394 ui::EventTimeForNow()); | |
1371 DispatchEventUsingWindowDispatcher(&release1); | 1395 DispatchEventUsingWindowDispatcher(&release1); |
1372 EXPECT_FALSE(delegate->long_press()); | 1396 EXPECT_FALSE(delegate->long_press()); |
1373 | 1397 |
1374 // Note the tap down isn't cancelled until the release | 1398 // Note the tap cancel isn't dispatched until the release |
1375 EXPECT_TRUE(delegate->tap_cancel()); | 1399 EXPECT_TRUE(delegate->tap_cancel()); |
1400 EXPECT_FALSE(delegate->tap()); | |
1376 } | 1401 } |
1377 | 1402 |
1378 // Check that scrolling cancels a long press | 1403 // Check that scrolling cancels a long press |
1379 TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) { | 1404 TEST_P(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) { |
1380 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1405 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1381 new GestureEventConsumeDelegate()); | 1406 new GestureEventConsumeDelegate()); |
1382 TimedEvents tes; | 1407 TimedEvents tes; |
1383 ui::GestureConfiguration::set_long_press_time_in_seconds(.01); | 1408 ui::GestureConfiguration::set_long_press_time_in_seconds(.01); |
1384 const int kWindowWidth = 123; | 1409 const int kWindowWidth = 123; |
1385 const int kWindowHeight = 45; | 1410 const int kWindowHeight = 45; |
1386 const int kTouchId = 6; | 1411 const int kTouchId = 6; |
1387 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 1412 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
1388 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1413 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1389 delegate.get(), -1234, bounds, root_window())); | 1414 delegate.get(), -1234, bounds, root_window())); |
(...skipping 26 matching lines...) Expand all Loading... | |
1416 | 1441 |
1417 delegate->Reset(); | 1442 delegate->Reset(); |
1418 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 1443 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
1419 kTouchId, tes.LeapForward(10)); | 1444 kTouchId, tes.LeapForward(10)); |
1420 DispatchEventUsingWindowDispatcher(&release1); | 1445 DispatchEventUsingWindowDispatcher(&release1); |
1421 EXPECT_FALSE(delegate->long_press()); | 1446 EXPECT_FALSE(delegate->long_press()); |
1422 EXPECT_FALSE(delegate->tap_cancel()); | 1447 EXPECT_FALSE(delegate->tap_cancel()); |
1423 } | 1448 } |
1424 | 1449 |
1425 // Check that appropriate touch events generate long tap events | 1450 // Check that appropriate touch events generate long tap events |
1426 TEST_F(GestureRecognizerTest, GestureEventLongTap) { | 1451 TEST_P(GestureRecognizerTest, GestureEventLongTap) { |
1427 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1452 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1428 new GestureEventConsumeDelegate()); | 1453 new GestureEventConsumeDelegate()); |
1429 TimedEvents tes; | |
1430 const int kWindowWidth = 123; | 1454 const int kWindowWidth = 123; |
1431 const int kWindowHeight = 45; | 1455 const int kWindowHeight = 45; |
1432 const int kTouchId = 2; | 1456 const int kTouchId = 2; |
1433 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 1457 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
1434 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1458 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1435 delegate.get(), -1234, bounds, root_window())); | 1459 delegate.get(), -1234, bounds, root_window())); |
1436 | 1460 |
1437 delegate->Reset(); | 1461 delegate->Reset(); |
1438 | 1462 |
1439 TimerTestGestureRecognizer* gesture_recognizer = | 1463 TimerTestGestureRecognizer* gesture_recognizer = |
1440 new TimerTestGestureRecognizer(); | 1464 new TimerTestGestureRecognizer(); |
1441 | 1465 |
1442 ScopedGestureRecognizerSetter gr_setter(gesture_recognizer); | 1466 ScopedGestureRecognizerSetter gr_setter(gesture_recognizer); |
1443 | 1467 |
1444 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), | 1468 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, |
1445 kTouchId, tes.Now()); | 1469 gfx::Point(101, 201), |
1470 kTouchId, | |
1471 ui::EventTimeForNow()); | |
1446 DispatchEventUsingWindowDispatcher(&press1); | 1472 DispatchEventUsingWindowDispatcher(&press1); |
1447 EXPECT_TRUE(delegate->tap_down()); | 1473 EXPECT_TRUE(delegate->tap_down()); |
1448 EXPECT_TRUE(delegate->begin()); | 1474 EXPECT_TRUE(delegate->begin()); |
1449 EXPECT_FALSE(delegate->tap_cancel()); | 1475 EXPECT_FALSE(delegate->tap_cancel()); |
1450 | 1476 |
1451 // We haven't pressed long enough for a long press to occur | 1477 // We haven't pressed long enough for a long press to occur |
1452 EXPECT_FALSE(delegate->long_press()); | 1478 EXPECT_FALSE(delegate->long_press()); |
1453 | 1479 |
1454 // Wait until the timer runs out | 1480 // Wait until the timer runs out |
1455 delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_LONG_PRESS); | 1481 delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_LONG_PRESS); |
1456 EXPECT_TRUE(delegate->long_press()); | 1482 EXPECT_TRUE(delegate->long_press()); |
1457 EXPECT_FALSE(delegate->tap_cancel()); | 1483 EXPECT_FALSE(delegate->tap_cancel()); |
1458 | 1484 |
1459 delegate->Reset(); | 1485 delegate->Reset(); |
1460 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 1486 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, |
1461 kTouchId, tes.Now()); | 1487 gfx::Point(101, 201), |
1488 kTouchId, | |
1489 ui::EventTimeForNow()); | |
1462 DispatchEventUsingWindowDispatcher(&release1); | 1490 DispatchEventUsingWindowDispatcher(&release1); |
1463 EXPECT_FALSE(delegate->long_press()); | 1491 EXPECT_FALSE(delegate->long_press()); |
1464 EXPECT_TRUE(delegate->long_tap()); | 1492 EXPECT_TRUE(delegate->long_tap()); |
1465 | 1493 |
1466 // Note the tap down isn't cancelled until the release | 1494 // Note the tap cancel isn't dispatched until the release |
1467 EXPECT_TRUE(delegate->tap_cancel()); | 1495 EXPECT_TRUE(delegate->tap_cancel()); |
1496 EXPECT_FALSE(delegate->tap()); | |
1468 } | 1497 } |
1469 | 1498 |
1470 // Check that second tap cancels a long press | 1499 // Check that second tap cancels a long press |
1471 TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) { | 1500 TEST_P(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) { |
1501 // TODO(tdresser): enable this test with unified GR once two finger tap is | |
1502 // supported. See crbug.com/354396. | |
1503 if (UsingUnifiedGR()) | |
1504 return; | |
1505 | |
1472 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1506 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1473 new GestureEventConsumeDelegate()); | 1507 new GestureEventConsumeDelegate()); |
1474 TimedEvents tes; | 1508 TimedEvents tes; |
1475 ui::GestureConfiguration::set_long_press_time_in_seconds(.01); | 1509 ui::GestureConfiguration::set_long_press_time_in_seconds(.01); |
1476 const int kWindowWidth = 300; | 1510 const int kWindowWidth = 300; |
1477 const int kWindowHeight = 400; | 1511 const int kWindowHeight = 400; |
1478 const int kTouchId1 = 8; | 1512 const int kTouchId1 = 8; |
1479 const int kTouchId2 = 2; | 1513 const int kTouchId2 = 2; |
1480 gfx::Rect bounds(5, 5, kWindowWidth, kWindowHeight); | 1514 gfx::Rect bounds(5, 5, kWindowWidth, kWindowHeight); |
1481 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1515 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1518 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 1552 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
1519 kTouchId1, tes.Now()); | 1553 kTouchId1, tes.Now()); |
1520 DispatchEventUsingWindowDispatcher(&release1); | 1554 DispatchEventUsingWindowDispatcher(&release1); |
1521 EXPECT_FALSE(delegate->long_press()); | 1555 EXPECT_FALSE(delegate->long_press()); |
1522 EXPECT_TRUE(delegate->two_finger_tap()); | 1556 EXPECT_TRUE(delegate->two_finger_tap()); |
1523 EXPECT_FALSE(delegate->tap_cancel()); | 1557 EXPECT_FALSE(delegate->tap_cancel()); |
1524 } | 1558 } |
1525 | 1559 |
1526 // Check that horizontal scroll gestures cause scrolls on horizontal rails. | 1560 // Check that horizontal scroll gestures cause scrolls on horizontal rails. |
1527 // Also tests that horizontal rails can be broken. | 1561 // Also tests that horizontal rails can be broken. |
1528 TEST_F(GestureRecognizerTest, GestureEventHorizontalRailScroll) { | 1562 TEST_P(GestureRecognizerTest, GestureEventHorizontalRailScroll) { |
1529 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1563 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1530 new GestureEventConsumeDelegate()); | 1564 new GestureEventConsumeDelegate()); |
1531 TimedEvents tes; | 1565 TimedEvents tes; |
1532 const int kTouchId = 7; | 1566 const int kTouchId = 7; |
1533 gfx::Rect bounds(0, 0, 1000, 1000); | 1567 gfx::Rect bounds(0, 0, 1000, 1000); |
1534 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1568 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1535 delegate.get(), -1234, bounds, root_window())); | 1569 delegate.get(), -1234, bounds, root_window())); |
1536 | 1570 |
1537 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), | 1571 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), |
1538 kTouchId, tes.Now()); | 1572 kTouchId, tes.Now()); |
1539 DispatchEventUsingWindowDispatcher(&press); | 1573 DispatchEventUsingWindowDispatcher(&press); |
1540 | 1574 |
1541 // Get rid of touch slop. | 1575 // Get rid of touch slop. |
1542 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(5, 0), | 1576 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(5, 0), |
1543 kTouchId, tes.Now()); | 1577 kTouchId, tes.Now()); |
1544 | 1578 |
1545 DispatchEventUsingWindowDispatcher(&move); | 1579 DispatchEventUsingWindowDispatcher(&move); |
1546 delegate->Reset(); | 1580 delegate->Reset(); |
1547 | 1581 |
1548 // Move the touch-point horizontally enough that it is considered a | 1582 // Move the touch-point horizontally enough that it is considered a |
1549 // horizontal scroll. | 1583 // horizontal scroll. |
1550 tes.SendScrollEvent(event_processor(), 25, 1, kTouchId, delegate.get()); | 1584 tes.SendScrollEvent(event_processor(), 25, 0, kTouchId, delegate.get()); |
1551 EXPECT_EQ(0, delegate->scroll_y()); | 1585 EXPECT_EQ(0, delegate->scroll_y()); |
1552 EXPECT_EQ(20, delegate->scroll_x()); | 1586 EXPECT_EQ(20, delegate->scroll_x()); |
1553 | 1587 |
1554 tes.SendScrollEvent(event_processor(), 30, 6, kTouchId, delegate.get()); | 1588 tes.SendScrollEvent(event_processor(), 30, 6, kTouchId, delegate.get()); |
1555 EXPECT_TRUE(delegate->scroll_update()); | 1589 EXPECT_TRUE(delegate->scroll_update()); |
1556 EXPECT_EQ(5, delegate->scroll_x()); | 1590 EXPECT_EQ(5, delegate->scroll_x()); |
1557 // y shouldn't change, as we're on a horizontal rail. | 1591 // y shouldn't change, as we're on a horizontal rail. |
1558 EXPECT_EQ(0, delegate->scroll_y()); | 1592 EXPECT_EQ(0, delegate->scroll_y()); |
1559 | 1593 |
1560 // Send enough information that a velocity can be calculated for the gesture, | 1594 // Send enough information that a velocity can be calculated for the gesture, |
1561 // and we can break the rail | 1595 // and we can break the rail |
1562 tes.SendScrollEvents(event_processor(), 1, 1, | 1596 tes.SendScrollEvents(event_processor(), 1, 1, |
1563 6, 100, kTouchId, 1, | 1597 6, 100, kTouchId, 1, |
1564 ui::GestureConfiguration::points_buffered_for_velocity(), | 1598 ui::GestureConfiguration::points_buffered_for_velocity(), |
1565 delegate.get()); | 1599 delegate.get()); |
1566 | 1600 |
1567 tes.SendScrollEvent(event_processor(), 5, 0, kTouchId, delegate.get()); | 1601 tes.SendScrollEvent(event_processor(), 5, 0, kTouchId, delegate.get()); |
1568 tes.SendScrollEvent(event_processor(), 10, 5, kTouchId, delegate.get()); | 1602 tes.SendScrollEvent(event_processor(), 10, 5, kTouchId, delegate.get()); |
1569 | 1603 |
1570 // The rail should be broken | 1604 // The rail should be broken |
1571 EXPECT_TRUE(delegate->scroll_update()); | 1605 EXPECT_TRUE(delegate->scroll_update()); |
1572 EXPECT_EQ(5, delegate->scroll_x()); | 1606 EXPECT_EQ(5, delegate->scroll_x()); |
1573 EXPECT_EQ(5, delegate->scroll_y()); | 1607 EXPECT_EQ(5, delegate->scroll_y()); |
1574 } | 1608 } |
1575 | 1609 |
1576 // Check that vertical scroll gestures cause scrolls on vertical rails. | 1610 // Check that vertical scroll gestures cause scrolls on vertical rails. |
1577 // Also tests that vertical rails can be broken. | 1611 // Also tests that vertical rails can be broken. |
1578 TEST_F(GestureRecognizerTest, GestureEventVerticalRailScroll) { | 1612 TEST_P(GestureRecognizerTest, GestureEventVerticalRailScroll) { |
1579 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1613 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1580 new GestureEventConsumeDelegate()); | 1614 new GestureEventConsumeDelegate()); |
1581 TimedEvents tes; | 1615 TimedEvents tes; |
1582 const int kTouchId = 7; | 1616 const int kTouchId = 7; |
1583 gfx::Rect bounds(0, 0, 1000, 1000); | 1617 gfx::Rect bounds(0, 0, 1000, 1000); |
1584 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1618 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1585 delegate.get(), -1234, bounds, root_window())); | 1619 delegate.get(), -1234, bounds, root_window())); |
1586 | 1620 |
1587 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), | 1621 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), |
1588 kTouchId, tes.Now()); | 1622 kTouchId, tes.Now()); |
1589 DispatchEventUsingWindowDispatcher(&press); | 1623 DispatchEventUsingWindowDispatcher(&press); |
1590 | 1624 |
1591 // Get rid of touch slop. | 1625 // Get rid of touch slop. |
1592 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(0, 5), | 1626 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(0, 5), |
1593 kTouchId, tes.Now()); | 1627 kTouchId, tes.Now()); |
1594 DispatchEventUsingWindowDispatcher(&move); | 1628 DispatchEventUsingWindowDispatcher(&move); |
1595 delegate->Reset(); | 1629 delegate->Reset(); |
1596 | 1630 |
1597 // Move the touch-point vertically enough that it is considered a | 1631 // Move the touch-point vertically enough that it is considered a |
1598 // vertical scroll. | 1632 // vertical scroll. |
1599 tes.SendScrollEvent(event_processor(), 1, 25, kTouchId, delegate.get()); | 1633 tes.SendScrollEvent(event_processor(), 0, 25, kTouchId, delegate.get()); |
1600 EXPECT_EQ(0, delegate->scroll_x()); | 1634 EXPECT_EQ(0, delegate->scroll_x()); |
1601 EXPECT_EQ(20, delegate->scroll_y()); | 1635 EXPECT_EQ(20, delegate->scroll_y()); |
1602 | 1636 |
1603 tes.SendScrollEvent(event_processor(), 6, 30, kTouchId, delegate.get()); | 1637 tes.SendScrollEvent(event_processor(), 6, 30, kTouchId, delegate.get()); |
1604 EXPECT_TRUE(delegate->scroll_update()); | 1638 EXPECT_TRUE(delegate->scroll_update()); |
1605 EXPECT_EQ(5, delegate->scroll_y()); | 1639 EXPECT_EQ(5, delegate->scroll_y()); |
1606 // x shouldn't change, as we're on a vertical rail. | 1640 // x shouldn't change, as we're on a vertical rail. |
1607 EXPECT_EQ(0, delegate->scroll_x()); | 1641 EXPECT_EQ(0, delegate->scroll_x()); |
1608 EXPECT_EQ(0, delegate->scroll_velocity_x()); | 1642 EXPECT_EQ(0, delegate->scroll_velocity_x()); |
1609 | 1643 |
1610 // Send enough information that a velocity can be calculated for the gesture, | 1644 // Send enough information that a velocity can be calculated for the gesture, |
1611 // and we can break the rail | 1645 // and we can break the rail |
1612 tes.SendScrollEvents(event_processor(), 1, 6, | 1646 tes.SendScrollEvents(event_processor(), 1, 6, |
1613 100, 1, kTouchId, 1, | 1647 100, 1, kTouchId, 1, |
1614 ui::GestureConfiguration::points_buffered_for_velocity(), | 1648 ui::GestureConfiguration::points_buffered_for_velocity(), |
1615 delegate.get()); | 1649 delegate.get()); |
1616 | 1650 |
1617 tes.SendScrollEvent(event_processor(), 0, 5, kTouchId, delegate.get()); | 1651 tes.SendScrollEvent(event_processor(), 0, 5, kTouchId, delegate.get()); |
1618 tes.SendScrollEvent(event_processor(), 5, 10, kTouchId, delegate.get()); | 1652 tes.SendScrollEvent(event_processor(), 5, 10, kTouchId, delegate.get()); |
1619 | 1653 |
1620 // The rail should be broken | 1654 // The rail should be broken |
1621 EXPECT_TRUE(delegate->scroll_update()); | 1655 EXPECT_TRUE(delegate->scroll_update()); |
1622 EXPECT_EQ(5, delegate->scroll_x()); | 1656 EXPECT_EQ(5, delegate->scroll_x()); |
1623 EXPECT_EQ(5, delegate->scroll_y()); | 1657 EXPECT_EQ(5, delegate->scroll_y()); |
1624 } | 1658 } |
1625 | 1659 |
1626 TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) { | 1660 TEST_P(GestureRecognizerTest, GestureTapFollowedByScroll) { |
1627 // We'll start by moving the touch point by (5, 5). We want all of that | 1661 // We'll start by moving the touch point by (5, 5). We want all of that |
1628 // distance to be consumed by the slop, so we set the slop radius to | 1662 // distance to be consumed by the slop, so we set the slop radius to |
1629 // sqrt(5 * 5 + 5 * 5). | 1663 // sqrt(5 * 5 + 5 * 5). |
1630 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click( | 1664 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click( |
1631 sqrt(static_cast<double>(5 * 5 + 5 * 5))); | 1665 sqrt(static_cast<double>(5 * 5 + 5 * 5))); |
1632 | 1666 |
1633 // First, tap. Then, do a scroll using the same touch-id. | 1667 // First, tap. Then, do a scroll using the same touch-id. |
1634 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1668 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1635 new GestureEventConsumeDelegate()); | 1669 new GestureEventConsumeDelegate()); |
1636 TimedEvents tes; | 1670 TimedEvents tes; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1672 kTouchId, tes.LeapForward(1000)); | 1706 kTouchId, tes.LeapForward(1000)); |
1673 DispatchEventUsingWindowDispatcher(&press1); | 1707 DispatchEventUsingWindowDispatcher(&press1); |
1674 EXPECT_FALSE(delegate->tap()); | 1708 EXPECT_FALSE(delegate->tap()); |
1675 EXPECT_TRUE(delegate->tap_down()); | 1709 EXPECT_TRUE(delegate->tap_down()); |
1676 EXPECT_FALSE(delegate->tap_cancel()); | 1710 EXPECT_FALSE(delegate->tap_cancel()); |
1677 EXPECT_FALSE(delegate->scroll_begin()); | 1711 EXPECT_FALSE(delegate->scroll_begin()); |
1678 EXPECT_FALSE(delegate->scroll_update()); | 1712 EXPECT_FALSE(delegate->scroll_update()); |
1679 EXPECT_FALSE(delegate->scroll_end()); | 1713 EXPECT_FALSE(delegate->scroll_end()); |
1680 | 1714 |
1681 // Get rid of touch slop. | 1715 // Get rid of touch slop. |
1682 ui::TouchEvent move_remove_slop(ui::ET_TOUCH_MOVED, gfx::Point(106, 206), | 1716 ui::TouchEvent move_remove_slop(ui::ET_TOUCH_MOVED, gfx::Point(116, 216), |
1683 kTouchId, tes.Now()); | 1717 kTouchId, tes.Now()); |
1684 DispatchEventUsingWindowDispatcher(&move_remove_slop); | 1718 DispatchEventUsingWindowDispatcher(&move_remove_slop); |
1685 EXPECT_TRUE(delegate->tap_cancel()); | 1719 EXPECT_TRUE(delegate->tap_cancel()); |
1686 EXPECT_TRUE(delegate->scroll_begin()); | 1720 EXPECT_TRUE(delegate->scroll_begin()); |
1687 EXPECT_FALSE(delegate->scroll_update()); | 1721 EXPECT_TRUE(delegate->scroll_update()); |
1688 EXPECT_EQ(5, delegate->scroll_x_hint()); | 1722 EXPECT_EQ(15, delegate->scroll_x_hint()); |
1689 EXPECT_EQ(5, delegate->scroll_y_hint()); | 1723 EXPECT_EQ(15, delegate->scroll_y_hint()); |
1690 | 1724 |
1691 delegate->Reset(); | 1725 delegate->Reset(); |
1692 | 1726 |
1693 // Move the touch-point enough so that it is considered as a scroll. This | 1727 // Move the touch-point enough so that it is considered as a scroll. This |
1694 // should generate both SCROLL_BEGIN and SCROLL_UPDATE gestures. | 1728 // should generate both SCROLL_BEGIN and SCROLL_UPDATE gestures. |
1695 // The first movement is diagonal, to ensure that we have a free scroll, | 1729 // The first movement is diagonal, to ensure that we have a free scroll, |
1696 // and not a rail scroll. | 1730 // and not a rail scroll. |
1697 delegate->Reset(); | 1731 delegate->Reset(); |
1698 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(135, 235), | 1732 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(135, 235), |
1699 kTouchId, tes.Now()); | 1733 kTouchId, tes.Now()); |
1700 DispatchEventUsingWindowDispatcher(&move); | 1734 DispatchEventUsingWindowDispatcher(&move); |
1701 EXPECT_FALSE(delegate->tap()); | 1735 EXPECT_FALSE(delegate->tap()); |
1702 EXPECT_FALSE(delegate->tap_down()); | 1736 EXPECT_FALSE(delegate->tap_down()); |
1703 EXPECT_FALSE(delegate->tap_cancel()); | 1737 EXPECT_FALSE(delegate->tap_cancel()); |
1704 EXPECT_FALSE(delegate->scroll_begin()); | 1738 EXPECT_FALSE(delegate->scroll_begin()); |
1705 EXPECT_TRUE(delegate->scroll_update()); | 1739 EXPECT_TRUE(delegate->scroll_update()); |
1706 EXPECT_FALSE(delegate->scroll_end()); | 1740 EXPECT_FALSE(delegate->scroll_end()); |
1707 EXPECT_EQ(29, delegate->scroll_x()); | 1741 EXPECT_EQ(19, delegate->scroll_x()); |
1708 EXPECT_EQ(29, delegate->scroll_y()); | 1742 EXPECT_EQ(19, delegate->scroll_y()); |
1709 | 1743 |
1710 // Move some more to generate a few more scroll updates. | 1744 // Move some more to generate a few more scroll updates. |
1711 delegate->Reset(); | 1745 delegate->Reset(); |
1712 ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(115, 216), | 1746 ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(115, 216), |
1713 kTouchId, tes.Now()); | 1747 kTouchId, tes.Now()); |
1714 DispatchEventUsingWindowDispatcher(&move1); | 1748 DispatchEventUsingWindowDispatcher(&move1); |
1715 EXPECT_FALSE(delegate->tap()); | 1749 EXPECT_FALSE(delegate->tap()); |
1716 EXPECT_FALSE(delegate->tap_down()); | 1750 EXPECT_FALSE(delegate->tap_down()); |
1717 EXPECT_FALSE(delegate->tap_cancel()); | 1751 EXPECT_FALSE(delegate->tap_cancel()); |
1718 EXPECT_FALSE(delegate->scroll_begin()); | 1752 EXPECT_FALSE(delegate->scroll_begin()); |
(...skipping 24 matching lines...) Expand all Loading... | |
1743 DispatchEventUsingWindowDispatcher(&release1); | 1777 DispatchEventUsingWindowDispatcher(&release1); |
1744 EXPECT_FALSE(delegate->tap()); | 1778 EXPECT_FALSE(delegate->tap()); |
1745 EXPECT_FALSE(delegate->tap_down()); | 1779 EXPECT_FALSE(delegate->tap_down()); |
1746 EXPECT_FALSE(delegate->tap_cancel()); | 1780 EXPECT_FALSE(delegate->tap_cancel()); |
1747 EXPECT_FALSE(delegate->scroll_begin()); | 1781 EXPECT_FALSE(delegate->scroll_begin()); |
1748 EXPECT_FALSE(delegate->scroll_update()); | 1782 EXPECT_FALSE(delegate->scroll_update()); |
1749 EXPECT_FALSE(delegate->scroll_end()); | 1783 EXPECT_FALSE(delegate->scroll_end()); |
1750 EXPECT_TRUE(delegate->fling()); | 1784 EXPECT_TRUE(delegate->fling()); |
1751 } | 1785 } |
1752 | 1786 |
1753 TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { | 1787 TEST_P(GestureRecognizerTest, AsynchronousGestureRecognition) { |
1788 // TODO(tdresser): enable this test with unified GR once two finger tap is | |
1789 // supported. See crbug.com/354396. | |
1790 if (UsingUnifiedGR()) | |
1791 return; | |
1754 scoped_ptr<QueueTouchEventDelegate> queued_delegate( | 1792 scoped_ptr<QueueTouchEventDelegate> queued_delegate( |
1755 new QueueTouchEventDelegate(host()->dispatcher())); | 1793 new QueueTouchEventDelegate(host()->dispatcher())); |
1756 const int kWindowWidth = 123; | 1794 const int kWindowWidth = 123; |
1757 const int kWindowHeight = 45; | 1795 const int kWindowHeight = 45; |
1758 const int kTouchId1 = 6; | 1796 const int kTouchId1 = 6; |
1759 const int kTouchId2 = 4; | 1797 const int kTouchId2 = 4; |
1760 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 1798 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
1761 scoped_ptr<aura::Window> queue(CreateTestWindowWithDelegate( | 1799 scoped_ptr<aura::Window> queue(CreateTestWindowWithDelegate( |
1762 queued_delegate.get(), -1234, bounds, root_window())); | 1800 queued_delegate.get(), -1234, bounds, root_window())); |
1763 | 1801 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1935 EXPECT_FALSE(queued_delegate->end()); | 1973 EXPECT_FALSE(queued_delegate->end()); |
1936 EXPECT_TRUE(queued_delegate->scroll_begin()); | 1974 EXPECT_TRUE(queued_delegate->scroll_begin()); |
1937 EXPECT_FALSE(queued_delegate->scroll_update()); | 1975 EXPECT_FALSE(queued_delegate->scroll_update()); |
1938 EXPECT_FALSE(queued_delegate->scroll_end()); | 1976 EXPECT_FALSE(queued_delegate->scroll_end()); |
1939 EXPECT_TRUE(queued_delegate->pinch_begin()); | 1977 EXPECT_TRUE(queued_delegate->pinch_begin()); |
1940 EXPECT_FALSE(queued_delegate->pinch_update()); | 1978 EXPECT_FALSE(queued_delegate->pinch_update()); |
1941 EXPECT_FALSE(queued_delegate->pinch_end()); | 1979 EXPECT_FALSE(queued_delegate->pinch_end()); |
1942 } | 1980 } |
1943 | 1981 |
1944 // Check that appropriate touch events generate pinch gesture events. | 1982 // Check that appropriate touch events generate pinch gesture events. |
1945 TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) { | 1983 TEST_P(GestureRecognizerTest, GestureEventPinchFromScroll) { |
1984 // Disabled for unified GR due to differences in when pinch begin is sent. The | |
1985 // Aura GR sends it earlier than is necessary. | |
1986 if (UsingUnifiedGR()) | |
1987 return; | |
1988 | |
1946 scoped_ptr<GestureEventConsumeDelegate> delegate( | 1989 scoped_ptr<GestureEventConsumeDelegate> delegate( |
1947 new GestureEventConsumeDelegate()); | 1990 new GestureEventConsumeDelegate()); |
1948 TimedEvents tes; | 1991 TimedEvents tes; |
1949 const int kWindowWidth = 300; | 1992 const int kWindowWidth = 300; |
1950 const int kWindowHeight = 400; | 1993 const int kWindowHeight = 400; |
1951 const int kTouchId1 = 5; | 1994 const int kTouchId1 = 5; |
1952 const int kTouchId2 = 3; | 1995 const int kTouchId2 = 3; |
1953 gfx::Rect bounds(5, 5, kWindowWidth, kWindowHeight); | 1996 gfx::Rect bounds(5, 5, kWindowWidth, kWindowHeight); |
1954 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1997 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1955 delegate.get(), -1234, bounds, root_window())); | 1998 delegate.get(), -1234, bounds, root_window())); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2020 | 2063 |
2021 // Move the second finger. This should still generate a scroll. | 2064 // Move the second finger. This should still generate a scroll. |
2022 delegate->Reset(); | 2065 delegate->Reset(); |
2023 ui::TouchEvent move5(ui::ET_TOUCH_MOVED, gfx::Point(25, 10), | 2066 ui::TouchEvent move5(ui::ET_TOUCH_MOVED, gfx::Point(25, 10), |
2024 kTouchId2, tes.Now()); | 2067 kTouchId2, tes.Now()); |
2025 DispatchEventUsingWindowDispatcher(&move5); | 2068 DispatchEventUsingWindowDispatcher(&move5); |
2026 EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); | 2069 EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); |
2027 EXPECT_TRUE(delegate->bounding_box().IsEmpty()); | 2070 EXPECT_TRUE(delegate->bounding_box().IsEmpty()); |
2028 } | 2071 } |
2029 | 2072 |
2030 TEST_F(GestureRecognizerTest, GestureEventPinchFromScrollFromPinch) { | 2073 TEST_P(GestureRecognizerTest, GestureEventPinchFromScrollFromPinch) { |
2031 scoped_ptr<GestureEventConsumeDelegate> delegate( | 2074 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2032 new GestureEventConsumeDelegate()); | 2075 new GestureEventConsumeDelegate()); |
2033 TimedEvents tes; | 2076 TimedEvents tes; |
2034 const int kWindowWidth = 300; | 2077 const int kWindowWidth = 300; |
2035 const int kWindowHeight = 400; | 2078 const int kWindowHeight = 400; |
2036 const int kTouchId1 = 5; | 2079 const int kTouchId1 = 5; |
2037 const int kTouchId2 = 3; | 2080 const int kTouchId2 = 3; |
2038 gfx::Rect bounds(5, 5, kWindowWidth, kWindowHeight); | 2081 gfx::Rect bounds(5, 5, kWindowWidth, kWindowHeight); |
2039 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 2082 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
2040 delegate.get(), -1234, bounds, root_window())); | 2083 delegate.get(), -1234, bounds, root_window())); |
(...skipping 27 matching lines...) Expand all Loading... | |
2068 tes.SendScrollEvent(event_processor(), 130, 230, kTouchId2, delegate.get()); | 2111 tes.SendScrollEvent(event_processor(), 130, 230, kTouchId2, delegate.get()); |
2069 EXPECT_TRUE(delegate->scroll_update()); | 2112 EXPECT_TRUE(delegate->scroll_update()); |
2070 | 2113 |
2071 // Pinch again | 2114 // Pinch again |
2072 delegate->Reset(); | 2115 delegate->Reset(); |
2073 ui::TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), | 2116 ui::TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), |
2074 kTouchId1, tes.Now()); | 2117 kTouchId1, tes.Now()); |
2075 DispatchEventUsingWindowDispatcher(&press3); | 2118 DispatchEventUsingWindowDispatcher(&press3); |
2076 // Now the touch points are close. So we will go into two finger tap. | 2119 // Now the touch points are close. So we will go into two finger tap. |
2077 // Move the touch-point enough to break two-finger-tap and enter pinch. | 2120 // Move the touch-point enough to break two-finger-tap and enter pinch. |
2078 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(101, 202), | 2121 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(101, 50), |
2079 kTouchId1, tes.Now()); | 2122 kTouchId1, tes.Now()); |
2080 DispatchEventUsingWindowDispatcher(&move2); | 2123 DispatchEventUsingWindowDispatcher(&move2); |
2081 EXPECT_TRUE(delegate->pinch_begin()); | 2124 EXPECT_TRUE(delegate->pinch_begin()); |
2082 | 2125 |
2083 tes.SendScrollEvent(event_processor(), 130, 230, kTouchId1, delegate.get()); | 2126 tes.SendScrollEvent(event_processor(), 300, 300, kTouchId1, delegate.get()); |
tdresser
2014/04/25 16:46:35
This was necessary due to a change in the unified
| |
2084 EXPECT_TRUE(delegate->pinch_update()); | 2127 EXPECT_TRUE(delegate->pinch_update()); |
2085 } | 2128 } |
2086 | 2129 |
2087 TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) { | 2130 TEST_P(GestureRecognizerTest, GestureEventPinchFromTap) { |
2131 // TODO(tdresser): enable this test with unified GR once two finger tap. | |
2132 if (UsingUnifiedGR()) | |
2133 return; | |
2134 | |
2088 scoped_ptr<GestureEventConsumeDelegate> delegate( | 2135 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2089 new GestureEventConsumeDelegate()); | 2136 new GestureEventConsumeDelegate()); |
2090 TimedEvents tes; | 2137 TimedEvents tes; |
2091 const int kWindowWidth = 300; | 2138 const int kWindowWidth = 300; |
2092 const int kWindowHeight = 400; | 2139 const int kWindowHeight = 400; |
2093 const int kTouchId1 = 3; | 2140 const int kTouchId1 = 3; |
2094 const int kTouchId2 = 5; | 2141 const int kTouchId2 = 5; |
2095 gfx::Rect bounds(5, 5, kWindowWidth, kWindowHeight); | 2142 gfx::Rect bounds(5, 5, kWindowWidth, kWindowHeight); |
2096 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 2143 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
2097 delegate.get(), -1234, bounds, root_window())); | 2144 delegate.get(), -1234, bounds, root_window())); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2151 | 2198 |
2152 // Move the second finger. This should still generate a scroll. | 2199 // Move the second finger. This should still generate a scroll. |
2153 delegate->Reset(); | 2200 delegate->Reset(); |
2154 ui::TouchEvent move5(ui::ET_TOUCH_MOVED, gfx::Point(25, 10), | 2201 ui::TouchEvent move5(ui::ET_TOUCH_MOVED, gfx::Point(25, 10), |
2155 kTouchId2, tes.Now()); | 2202 kTouchId2, tes.Now()); |
2156 DispatchEventUsingWindowDispatcher(&move5); | 2203 DispatchEventUsingWindowDispatcher(&move5); |
2157 EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); | 2204 EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); |
2158 EXPECT_TRUE(delegate->bounding_box().IsEmpty()); | 2205 EXPECT_TRUE(delegate->bounding_box().IsEmpty()); |
2159 } | 2206 } |
2160 | 2207 |
2161 TEST_F(GestureRecognizerTest, GestureEventIgnoresDisconnectedEvents) { | 2208 TEST_P(GestureRecognizerTest, GestureEventIgnoresDisconnectedEvents) { |
2162 scoped_ptr<GestureEventConsumeDelegate> delegate( | 2209 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2163 new GestureEventConsumeDelegate()); | 2210 new GestureEventConsumeDelegate()); |
2164 TimedEvents tes; | 2211 TimedEvents tes; |
2165 | 2212 |
2166 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 2213 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
2167 6, tes.Now()); | 2214 6, tes.Now()); |
2168 DispatchEventUsingWindowDispatcher(&release1); | 2215 DispatchEventUsingWindowDispatcher(&release1); |
2169 EXPECT_FALSE(delegate->tap()); | 2216 EXPECT_FALSE(delegate->tap()); |
2170 EXPECT_FALSE(delegate->tap_down()); | 2217 EXPECT_FALSE(delegate->tap_down()); |
2171 } | 2218 } |
2172 | 2219 |
2173 // Check that a touch is locked to the window of the closest current touch | 2220 // Check that a touch is locked to the window of the closest current touch |
2174 // within max_separation_for_gesture_touches_in_pixels | 2221 // within max_separation_for_gesture_touches_in_pixels |
2175 TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) { | 2222 TEST_P(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) { |
2176 ui::GestureRecognizer* gesture_recognizer = new ui::GestureRecognizerImpl(); | 2223 ui::GestureRecognizer* gesture_recognizer = new ui::GestureRecognizerImpl(); |
2177 TimedEvents tes; | 2224 TimedEvents tes; |
2178 ScopedGestureRecognizerSetter gr_setter(gesture_recognizer); | 2225 ScopedGestureRecognizerSetter gr_setter(gesture_recognizer); |
2179 | 2226 |
2180 ui::GestureConsumer* target; | 2227 ui::GestureConsumer* target; |
2181 const int kNumWindows = 4; | 2228 const int kNumWindows = 4; |
2182 | 2229 |
2183 scoped_ptr<GestureEventConsumeDelegate*[]> delegates( | 2230 scoped_ptr<GestureEventConsumeDelegate*[]> delegates( |
2184 new GestureEventConsumeDelegate*[kNumWindows]); | 2231 new GestureEventConsumeDelegate*[kNumWindows]); |
2185 | 2232 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2251 | 2298 |
2252 for (int i = 0; i < kNumWindows; ++i) { | 2299 for (int i = 0; i < kNumWindows; ++i) { |
2253 // Delete windows before deleting delegates. | 2300 // Delete windows before deleting delegates. |
2254 delete windows[i]; | 2301 delete windows[i]; |
2255 delete delegates[i]; | 2302 delete delegates[i]; |
2256 } | 2303 } |
2257 } | 2304 } |
2258 | 2305 |
2259 // Check that a touch's target will not be effected by a touch on a different | 2306 // Check that a touch's target will not be effected by a touch on a different |
2260 // screen. | 2307 // screen. |
2261 TEST_F(GestureRecognizerTest, GestureEventTouchLockIgnoresOtherScreens) { | 2308 TEST_P(GestureRecognizerTest, GestureEventTouchLockIgnoresOtherScreens) { |
2262 scoped_ptr<GestureEventConsumeDelegate> delegate( | 2309 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2263 new GestureEventConsumeDelegate()); | 2310 new GestureEventConsumeDelegate()); |
2264 gfx::Rect bounds(0, 0, 10, 10); | 2311 gfx::Rect bounds(0, 0, 10, 10); |
2265 scoped_ptr<aura::Window> window( | 2312 scoped_ptr<aura::Window> window( |
2266 CreateTestWindowWithDelegate(delegate.get(), 0, bounds, root_window())); | 2313 CreateTestWindowWithDelegate(delegate.get(), 0, bounds, root_window())); |
2267 | 2314 |
2268 const int kTouchId1 = 8; | 2315 const int kTouchId1 = 8; |
2269 const int kTouchId2 = 2; | 2316 const int kTouchId2 = 2; |
2270 TimedEvents tes; | 2317 TimedEvents tes; |
2271 | 2318 |
2272 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(5, 5), | 2319 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(5, 5), |
2273 kTouchId1, tes.Now()); | 2320 kTouchId1, tes.Now()); |
2274 press1.set_source_device_id(1); | 2321 press1.set_source_device_id(1); |
2275 DispatchEventUsingWindowDispatcher(&press1); | 2322 DispatchEventUsingWindowDispatcher(&press1); |
2276 | 2323 |
2277 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20), | 2324 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20), |
2278 kTouchId2, tes.Now()); | 2325 kTouchId2, tes.Now()); |
2279 press2.set_source_device_id(2); | 2326 press2.set_source_device_id(2); |
2280 DispatchEventUsingWindowDispatcher(&press2); | 2327 DispatchEventUsingWindowDispatcher(&press2); |
2281 | 2328 |
2282 // The second press should not have been locked to the same target as the | 2329 // The second press should not have been locked to the same target as the |
2283 // first, as they occured on different displays. | 2330 // first, as they occured on different displays. |
2284 EXPECT_NE( | 2331 EXPECT_NE( |
2285 ui::GestureRecognizer::Get()->GetTouchLockedTarget(press1), | 2332 ui::GestureRecognizer::Get()->GetTouchLockedTarget(press1), |
2286 ui::GestureRecognizer::Get()->GetTouchLockedTarget(press2)); | 2333 ui::GestureRecognizer::Get()->GetTouchLockedTarget(press2)); |
2287 } | 2334 } |
2288 | 2335 |
2289 // Check that touch events outside the root window are still handled | 2336 // Check that touch events outside the root window are still handled |
2290 // by the root window's gesture sequence. | 2337 // by the root window's gesture sequence. |
2291 TEST_F(GestureRecognizerTest, GestureEventOutsideRootWindowTap) { | 2338 TEST_P(GestureRecognizerTest, GestureEventOutsideRootWindowTap) { |
2339 // TODO(tdresser): write a version of this test for the unified GR. | |
2340 if (UsingUnifiedGR()) | |
2341 return; | |
2342 | |
2292 TestGestureRecognizer* gesture_recognizer = | 2343 TestGestureRecognizer* gesture_recognizer = |
2293 new TestGestureRecognizer(); | 2344 new TestGestureRecognizer(); |
2294 TimedEvents tes; | 2345 TimedEvents tes; |
2295 ScopedGestureRecognizerSetter gr_setter(gesture_recognizer); | 2346 ScopedGestureRecognizerSetter gr_setter(gesture_recognizer); |
2296 | 2347 |
2297 scoped_ptr<aura::Window> window(CreateTestWindowWithBounds( | 2348 scoped_ptr<aura::Window> window(CreateTestWindowWithBounds( |
2298 gfx::Rect(-100, -100, 2000, 2000), root_window())); | 2349 gfx::Rect(-100, -100, 2000, 2000), root_window())); |
2299 | 2350 |
2300 ui::GestureSequence* window_gesture_sequence = | 2351 ui::GestureSequence* window_gesture_sequence = |
2301 gesture_recognizer->GetGestureSequenceForTesting(window.get()); | 2352 gesture_recognizer->GetGestureSequenceForTesting(window.get()); |
2302 | 2353 |
2303 ui::GestureSequence* root_window_gesture_sequence = | 2354 ui::GestureSequence* root_window_gesture_sequence = |
2304 gesture_recognizer->GetGestureSequenceForTesting(root_window()); | 2355 gesture_recognizer->GetGestureSequenceForTesting(root_window()); |
2305 | 2356 |
2306 gfx::Point pos1(-10, -10); | 2357 gfx::Point pos1(-10, -10); |
2307 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, pos1, 0, tes.Now()); | 2358 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, pos1, 0, tes.Now()); |
2308 DispatchEventUsingWindowDispatcher(&press1); | 2359 DispatchEventUsingWindowDispatcher(&press1); |
2309 | 2360 |
2310 gfx::Point pos2(1000, 1000); | 2361 gfx::Point pos2(1000, 1000); |
2311 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, pos2, 1, tes.Now()); | 2362 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, pos2, 1, tes.Now()); |
2312 DispatchEventUsingWindowDispatcher(&press2); | 2363 DispatchEventUsingWindowDispatcher(&press2); |
2313 | 2364 |
2314 // As these presses were outside the root window, they should be | 2365 // As these presses were outside the root window, they should be |
2315 // associated with the root window. | 2366 // associated with the root window. |
2316 EXPECT_EQ(0, window_gesture_sequence->point_count()); | 2367 EXPECT_EQ(0, window_gesture_sequence->point_count()); |
2317 EXPECT_EQ(2, root_window_gesture_sequence->point_count()); | 2368 EXPECT_EQ(2, root_window_gesture_sequence->point_count()); |
2318 } | 2369 } |
2319 | 2370 |
2320 TEST_F(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) { | 2371 TEST_P(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) { |
2321 scoped_ptr<QueueTouchEventDelegate> delegate( | 2372 scoped_ptr<QueueTouchEventDelegate> delegate( |
2322 new QueueTouchEventDelegate(host()->dispatcher())); | 2373 new QueueTouchEventDelegate(host()->dispatcher())); |
2323 TimedEvents tes; | 2374 TimedEvents tes; |
2324 const int kTouchId = 2; | 2375 const int kTouchId = 2; |
2325 gfx::Rect bounds(100, 200, 100, 100); | 2376 gfx::Rect bounds(100, 200, 100, 100); |
2326 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 2377 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
2327 delegate.get(), -1234, bounds, root_window())); | 2378 delegate.get(), -1234, bounds, root_window())); |
2328 delegate->set_window(window.get()); | 2379 delegate->set_window(window.get()); |
2329 | 2380 |
2330 delegate->Reset(); | 2381 delegate->Reset(); |
2331 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), | 2382 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), |
2332 kTouchId, tes.Now()); | 2383 kTouchId, tes.Now()); |
2333 DispatchEventUsingWindowDispatcher(&press); | 2384 DispatchEventUsingWindowDispatcher(&press); |
2334 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 2385 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
2335 kTouchId, tes.LeapForward(50)); | 2386 kTouchId, tes.LeapForward(50)); |
2336 DispatchEventUsingWindowDispatcher(&release); | 2387 DispatchEventUsingWindowDispatcher(&release); |
2337 | 2388 |
2338 delegate->Reset(); | 2389 delegate->Reset(); |
2339 delegate->ReceivedAck(); | 2390 delegate->ReceivedAck(); |
2340 EXPECT_TRUE(delegate->tap_down()); | 2391 EXPECT_TRUE(delegate->tap_down()); |
2341 delegate->Reset(); | 2392 delegate->Reset(); |
2342 delegate->ReceivedAckPreventDefaulted(); | 2393 delegate->ReceivedAckPreventDefaulted(); |
2343 EXPECT_FALSE(delegate->tap()); | 2394 EXPECT_FALSE(delegate->tap()); |
2344 EXPECT_TRUE(delegate->tap_cancel()); | 2395 EXPECT_TRUE(delegate->tap_cancel()); |
2345 } | 2396 } |
2346 | 2397 |
2347 TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) { | 2398 TEST_P(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) { |
2399 // Disabled for unified GR due to differences in when pinch begin is sent. The | |
2400 // Aura GR sends it earlier than is necessary. | |
2401 if (UsingUnifiedGR()) | |
2402 return; | |
2403 | |
2348 scoped_ptr<QueueTouchEventDelegate> delegate( | 2404 scoped_ptr<QueueTouchEventDelegate> delegate( |
2349 new QueueTouchEventDelegate(host()->dispatcher())); | 2405 new QueueTouchEventDelegate(host()->dispatcher())); |
2350 TimedEvents tes; | 2406 TimedEvents tes; |
2351 const int kTouchId1 = 7; | 2407 const int kTouchId1 = 7; |
2352 const int kTouchId2 = 5; | 2408 const int kTouchId2 = 5; |
2353 gfx::Rect bounds(10, 20, 100, 100); | 2409 gfx::Rect bounds(10, 20, 100, 100); |
2354 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 2410 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
2355 delegate.get(), -1234, bounds, root_window())); | 2411 delegate.get(), -1234, bounds, root_window())); |
2356 delegate->set_window(window.get()); | 2412 delegate->set_window(window.get()); |
2357 | 2413 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2431 delegate->ReceivedAckPreventDefaulted(); | 2487 delegate->ReceivedAckPreventDefaulted(); |
2432 EXPECT_TRUE(delegate->pinch_end()); | 2488 EXPECT_TRUE(delegate->pinch_end()); |
2433 EXPECT_TRUE(delegate->end()); | 2489 EXPECT_TRUE(delegate->end()); |
2434 | 2490 |
2435 delegate->Reset(); | 2491 delegate->Reset(); |
2436 delegate->ReceivedAckPreventDefaulted(); | 2492 delegate->ReceivedAckPreventDefaulted(); |
2437 EXPECT_TRUE(delegate->scroll_end()); | 2493 EXPECT_TRUE(delegate->scroll_end()); |
2438 EXPECT_TRUE(delegate->end()); | 2494 EXPECT_TRUE(delegate->end()); |
2439 } | 2495 } |
2440 | 2496 |
2441 TEST_F(GestureRecognizerTest, GestureEndLocation) { | 2497 TEST_P(GestureRecognizerTest, GestureEndLocation) { |
2442 GestureEventConsumeDelegate delegate; | 2498 GestureEventConsumeDelegate delegate; |
2443 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 2499 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
2444 &delegate, -1234, gfx::Rect(10, 10, 300, 300), root_window())); | 2500 &delegate, -1234, gfx::Rect(10, 10, 300, 300), root_window())); |
2445 EventGenerator generator(root_window(), window.get()); | 2501 EventGenerator generator(root_window(), window.get()); |
2446 const gfx::Point begin(20, 20); | 2502 const gfx::Point begin(20, 20); |
2447 const gfx::Point end(150, 150); | 2503 const gfx::Point end(150, 150); |
2448 const gfx::Vector2d window_offset = | 2504 const gfx::Vector2d window_offset = |
2449 window->bounds().origin().OffsetFromOrigin(); | 2505 window->bounds().origin().OffsetFromOrigin(); |
2450 generator.GestureScrollSequence(begin, end, | 2506 generator.GestureScrollSequence(begin, end, |
2451 base::TimeDelta::FromMilliseconds(20), | 2507 base::TimeDelta::FromMilliseconds(20), |
2452 10); | 2508 10); |
2453 EXPECT_EQ((begin - window_offset).ToString(), | 2509 EXPECT_EQ((begin - window_offset).ToString(), |
2454 delegate.scroll_begin_position().ToString()); | 2510 delegate.scroll_begin_position().ToString()); |
2455 EXPECT_EQ((end - window_offset).ToString(), | 2511 EXPECT_EQ((end - window_offset).ToString(), |
2456 delegate.gesture_end_location().ToString()); | 2512 delegate.gesture_end_location().ToString()); |
2457 } | 2513 } |
2458 | 2514 |
2459 TEST_F(GestureRecognizerTest, CaptureSendsGestureEnd) { | 2515 TEST_P(GestureRecognizerTest, CaptureSendsGestureEnd) { |
2460 scoped_ptr<GestureEventConsumeDelegate> delegate( | 2516 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2461 new GestureEventConsumeDelegate()); | 2517 new GestureEventConsumeDelegate()); |
2462 TestGestureRecognizer* gesture_recognizer = | 2518 TestGestureRecognizer* gesture_recognizer = |
2463 new TestGestureRecognizer(); | 2519 new TestGestureRecognizer(); |
2464 ScopedGestureRecognizerSetter gr_setter(gesture_recognizer); | 2520 ScopedGestureRecognizerSetter gr_setter(gesture_recognizer); |
2465 | 2521 |
2466 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 2522 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
2467 delegate.get(), -1234, gfx::Rect(10, 10, 300, 300), root_window())); | 2523 delegate.get(), -1234, gfx::Rect(10, 10, 300, 300), root_window())); |
2468 EventGenerator generator(root_window()); | 2524 EventGenerator generator(root_window()); |
2469 | 2525 |
2470 generator.MoveMouseRelativeTo(window.get(), gfx::Point(10, 10)); | 2526 generator.MoveMouseRelativeTo(window.get(), gfx::Point(10, 10)); |
2471 generator.PressTouch(); | 2527 generator.PressTouch(); |
2472 RunAllPendingInMessageLoop(); | 2528 RunAllPendingInMessageLoop(); |
2473 | 2529 |
2474 EXPECT_TRUE(delegate->tap_down()); | 2530 EXPECT_TRUE(delegate->tap_down()); |
2475 | 2531 |
2476 scoped_ptr<aura::Window> capture(CreateTestWindowWithBounds( | 2532 scoped_ptr<aura::Window> capture(CreateTestWindowWithBounds( |
2477 gfx::Rect(10, 10, 200, 200), root_window())); | 2533 gfx::Rect(10, 10, 200, 200), root_window())); |
2478 capture->SetCapture(); | 2534 capture->SetCapture(); |
2479 RunAllPendingInMessageLoop(); | 2535 RunAllPendingInMessageLoop(); |
2480 | 2536 |
2481 EXPECT_TRUE(delegate->end()); | 2537 EXPECT_TRUE(delegate->end()); |
2482 EXPECT_TRUE(delegate->tap_cancel()); | 2538 EXPECT_TRUE(delegate->tap_cancel()); |
2483 } | 2539 } |
2484 | 2540 |
2485 // Check that previous touch actions that are completely finished (either | 2541 // Check that previous touch actions that are completely finished (either |
2486 // released or cancelled), do not receive extra synthetic cancels upon change of | 2542 // released or cancelled), do not receive extra synthetic cancels upon change of |
2487 // capture. | 2543 // capture. |
2488 TEST_F(GestureRecognizerTest, CaptureDoesNotCancelFinishedTouches) { | 2544 TEST_P(GestureRecognizerTest, CaptureDoesNotCancelFinishedTouches) { |
2489 scoped_ptr<GestureEventConsumeDelegate> delegate( | 2545 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2490 new GestureEventConsumeDelegate()); | 2546 new GestureEventConsumeDelegate()); |
2491 scoped_ptr<TestEventHandler> handler(new TestEventHandler); | 2547 scoped_ptr<TestEventHandler> handler(new TestEventHandler); |
2492 root_window()->AddPreTargetHandler(handler.get()); | 2548 root_window()->AddPreTargetHandler(handler.get()); |
2493 | 2549 |
2494 // Create a window and set it as the capture window. | 2550 // Create a window and set it as the capture window. |
2495 scoped_ptr<aura::Window> window1(CreateTestWindowWithDelegate(delegate.get(), | 2551 scoped_ptr<aura::Window> window1(CreateTestWindowWithDelegate(delegate.get(), |
2496 -1234, gfx::Rect(10, 10, 300, 300), root_window())); | 2552 -1234, gfx::Rect(10, 10, 300, 300), root_window())); |
2497 window1->SetCapture(); | 2553 window1->SetCapture(); |
2498 | 2554 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2531 gfx::Rect(100, 100, 300, 300), root_window())); | 2587 gfx::Rect(100, 100, 300, 300), root_window())); |
2532 window2->SetCapture(); | 2588 window2->SetCapture(); |
2533 RunAllPendingInMessageLoop(); | 2589 RunAllPendingInMessageLoop(); |
2534 // Check that setting capture does not generate any synthetic touch-cancels | 2590 // Check that setting capture does not generate any synthetic touch-cancels |
2535 // for the two previously finished touch actions. | 2591 // for the two previously finished touch actions. |
2536 EXPECT_EQ(1, handler->touch_cancelled_count()); | 2592 EXPECT_EQ(1, handler->touch_cancelled_count()); |
2537 | 2593 |
2538 root_window()->RemovePreTargetHandler(handler.get()); | 2594 root_window()->RemovePreTargetHandler(handler.get()); |
2539 } | 2595 } |
2540 | 2596 |
2541 TEST_F(GestureRecognizerTest, PressDoesNotCrash) { | 2597 // Tests that a press with the same touch id as an existing touch is ignored. |
2598 TEST_P(GestureRecognizerTest, PressDoesNotCrash) { | |
2542 scoped_ptr<GestureEventConsumeDelegate> delegate( | 2599 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2543 new GestureEventConsumeDelegate()); | 2600 new GestureEventConsumeDelegate()); |
2544 TestGestureRecognizer* gesture_recognizer = | 2601 TestGestureRecognizer* gesture_recognizer = |
2545 new TestGestureRecognizer(); | 2602 new TestGestureRecognizer(); |
2546 ScopedGestureRecognizerSetter gr_setter(gesture_recognizer); | 2603 ScopedGestureRecognizerSetter gr_setter(gesture_recognizer); |
2547 TimedEvents tes; | 2604 TimedEvents tes; |
2548 | 2605 |
2549 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 2606 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
2550 delegate.get(), -1234, gfx::Rect(10, 10, 300, 300), root_window())); | 2607 delegate.get(), -1234, gfx::Rect(10, 10, 300, 300), root_window())); |
2551 | 2608 |
2552 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(45, 45), 7, tes.Now()); | 2609 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(45, 45), 7, tes.Now()); |
2553 press.set_radius_x(40); | 2610 press.set_radius_x(40); |
2554 DispatchEventUsingWindowDispatcher(&press); | 2611 DispatchEventUsingWindowDispatcher(&press); |
2555 EXPECT_TRUE(delegate->tap_down()); | 2612 EXPECT_TRUE(delegate->tap_down()); |
2556 EXPECT_EQ(gfx::Rect(5, 5, 80, 80).ToString(), | 2613 EXPECT_EQ(gfx::Rect(5, 5, 80, 80).ToString(), |
2557 delegate->bounding_box().ToString()); | 2614 delegate->bounding_box().ToString()); |
2558 delegate->Reset(); | 2615 delegate->Reset(); |
2559 | 2616 |
2560 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(55, 45), 7, tes.Now()); | 2617 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(55, 45), 7, tes.Now()); |
2561 DispatchEventUsingWindowDispatcher(&press2); | 2618 DispatchEventUsingWindowDispatcher(&press2); |
2562 | 2619 |
2563 // This new press should not generate a tap-down. | 2620 // This new press should not generate a tap-down. |
2564 EXPECT_FALSE(delegate->begin()); | 2621 EXPECT_FALSE(delegate->begin()); |
2565 EXPECT_FALSE(delegate->tap_down()); | 2622 EXPECT_FALSE(delegate->tap_down()); |
2566 EXPECT_FALSE(delegate->tap_cancel()); | 2623 EXPECT_FALSE(delegate->tap_cancel()); |
2567 EXPECT_FALSE(delegate->scroll_begin()); | 2624 EXPECT_FALSE(delegate->scroll_begin()); |
2568 } | 2625 } |
2569 | 2626 |
2570 TEST_F(GestureRecognizerTest, TwoFingerTap) { | 2627 TEST_P(GestureRecognizerTest, TwoFingerTap) { |
2628 // TODO(tdresser): enable this test with unified GR once two finger tap is | |
2629 // supported. See crbug.com/354396. | |
2630 if (UsingUnifiedGR()) | |
2631 return; | |
2632 | |
2571 scoped_ptr<GestureEventConsumeDelegate> delegate( | 2633 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2572 new GestureEventConsumeDelegate()); | 2634 new GestureEventConsumeDelegate()); |
2573 const int kWindowWidth = 123; | 2635 const int kWindowWidth = 123; |
2574 const int kWindowHeight = 45; | 2636 const int kWindowHeight = 45; |
2575 const int kTouchId1 = 2; | 2637 const int kTouchId1 = 2; |
2576 const int kTouchId2 = 3; | 2638 const int kTouchId2 = 3; |
2577 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 2639 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
2578 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 2640 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
2579 delegate.get(), -1234, bounds, root_window())); | 2641 delegate.get(), -1234, bounds, root_window())); |
2580 TimedEvents tes; | 2642 TimedEvents tes; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2648 EXPECT_FALSE(delegate->tap()); | 2710 EXPECT_FALSE(delegate->tap()); |
2649 EXPECT_FALSE(delegate->tap_down()); | 2711 EXPECT_FALSE(delegate->tap_down()); |
2650 EXPECT_FALSE(delegate->tap_cancel()); | 2712 EXPECT_FALSE(delegate->tap_cancel()); |
2651 EXPECT_FALSE(delegate->scroll_begin()); | 2713 EXPECT_FALSE(delegate->scroll_begin()); |
2652 EXPECT_FALSE(delegate->scroll_update()); | 2714 EXPECT_FALSE(delegate->scroll_update()); |
2653 EXPECT_FALSE(delegate->scroll_end()); | 2715 EXPECT_FALSE(delegate->scroll_end()); |
2654 EXPECT_TRUE(delegate->fling()); | 2716 EXPECT_TRUE(delegate->fling()); |
2655 EXPECT_FALSE(delegate->two_finger_tap()); | 2717 EXPECT_FALSE(delegate->two_finger_tap()); |
2656 } | 2718 } |
2657 | 2719 |
2658 TEST_F(GestureRecognizerTest, TwoFingerTapExpired) { | 2720 TEST_P(GestureRecognizerTest, TwoFingerTapExpired) { |
2659 scoped_ptr<GestureEventConsumeDelegate> delegate( | 2721 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2660 new GestureEventConsumeDelegate()); | 2722 new GestureEventConsumeDelegate()); |
2661 const int kWindowWidth = 123; | 2723 const int kWindowWidth = 123; |
2662 const int kWindowHeight = 45; | 2724 const int kWindowHeight = 45; |
2663 const int kTouchId1 = 2; | 2725 const int kTouchId1 = 2; |
2664 const int kTouchId2 = 3; | 2726 const int kTouchId2 = 3; |
2665 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 2727 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
2666 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 2728 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
2667 delegate.get(), -1234, bounds, root_window())); | 2729 delegate.get(), -1234, bounds, root_window())); |
2668 TimedEvents tes; | 2730 TimedEvents tes; |
(...skipping 20 matching lines...) Expand all Loading... | |
2689 // Make sure there is enough delay before the touch is released so that it is | 2751 // Make sure there is enough delay before the touch is released so that it is |
2690 // recognized as a tap. | 2752 // recognized as a tap. |
2691 delegate->Reset(); | 2753 delegate->Reset(); |
2692 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201), | 2754 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201), |
2693 kTouchId2, tes.LeapForward(50)); | 2755 kTouchId2, tes.LeapForward(50)); |
2694 | 2756 |
2695 DispatchEventUsingWindowDispatcher(&release2); | 2757 DispatchEventUsingWindowDispatcher(&release2); |
2696 EXPECT_FALSE(delegate->two_finger_tap()); | 2758 EXPECT_FALSE(delegate->two_finger_tap()); |
2697 } | 2759 } |
2698 | 2760 |
2699 TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) { | 2761 TEST_P(GestureRecognizerTest, TwoFingerTapChangesToPinch) { |
2762 // TODO(tdresser): enable this test with unified GR once two finger tap is | |
2763 // supported. See crbug.com/354396. | |
2764 if (UsingUnifiedGR()) | |
2765 return; | |
2766 | |
2700 scoped_ptr<GestureEventConsumeDelegate> delegate( | 2767 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2701 new GestureEventConsumeDelegate()); | 2768 new GestureEventConsumeDelegate()); |
2702 const int kWindowWidth = 123; | 2769 const int kWindowWidth = 123; |
2703 const int kWindowHeight = 45; | 2770 const int kWindowHeight = 45; |
2704 const int kTouchId1 = 2; | 2771 const int kTouchId1 = 2; |
2705 const int kTouchId2 = 3; | 2772 const int kTouchId2 = 3; |
2706 TimedEvents tes; | 2773 TimedEvents tes; |
2707 | 2774 |
2708 // Test moving first finger | 2775 // Test moving first finger |
2709 { | 2776 { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2761 delegate->Reset(); | 2828 delegate->Reset(); |
2762 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 2829 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
2763 kTouchId1, tes.LeapForward(50)); | 2830 kTouchId1, tes.LeapForward(50)); |
2764 | 2831 |
2765 DispatchEventUsingWindowDispatcher(&release); | 2832 DispatchEventUsingWindowDispatcher(&release); |
2766 EXPECT_FALSE(delegate->two_finger_tap()); | 2833 EXPECT_FALSE(delegate->two_finger_tap()); |
2767 EXPECT_TRUE(delegate->pinch_end()); | 2834 EXPECT_TRUE(delegate->pinch_end()); |
2768 } | 2835 } |
2769 } | 2836 } |
2770 | 2837 |
2771 TEST_F(GestureRecognizerTest, NoTwoFingerTapWhenFirstFingerHasScrolled) { | 2838 TEST_P(GestureRecognizerTest, NoTwoFingerTapWhenFirstFingerHasScrolled) { |
2839 // Disabled for unified GR due to differences in when pinch begin is sent. The | |
2840 // Aura GR sends it earlier than is necessary. | |
2841 if (UsingUnifiedGR()) | |
2842 return; | |
2843 | |
2772 scoped_ptr<GestureEventConsumeDelegate> delegate( | 2844 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2773 new GestureEventConsumeDelegate()); | 2845 new GestureEventConsumeDelegate()); |
2774 const int kWindowWidth = 123; | 2846 const int kWindowWidth = 123; |
2775 const int kWindowHeight = 45; | 2847 const int kWindowHeight = 45; |
2776 const int kTouchId1 = 2; | 2848 const int kTouchId1 = 2; |
2777 const int kTouchId2 = 3; | 2849 const int kTouchId2 = 3; |
2778 TimedEvents tes; | 2850 TimedEvents tes; |
2779 | 2851 |
2780 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 2852 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
2781 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 2853 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
(...skipping 16 matching lines...) Expand all Loading... | |
2798 // is recognized as a tap. | 2870 // is recognized as a tap. |
2799 delegate->Reset(); | 2871 delegate->Reset(); |
2800 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 2872 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
2801 kTouchId2, tes.LeapForward(50)); | 2873 kTouchId2, tes.LeapForward(50)); |
2802 | 2874 |
2803 DispatchEventUsingWindowDispatcher(&release); | 2875 DispatchEventUsingWindowDispatcher(&release); |
2804 EXPECT_FALSE(delegate->two_finger_tap()); | 2876 EXPECT_FALSE(delegate->two_finger_tap()); |
2805 EXPECT_TRUE(delegate->pinch_end()); | 2877 EXPECT_TRUE(delegate->pinch_end()); |
2806 } | 2878 } |
2807 | 2879 |
2808 TEST_F(GestureRecognizerTest, MultiFingerSwipe) { | 2880 TEST_P(GestureRecognizerTest, MultiFingerSwipe) { |
2809 scoped_ptr<GestureEventConsumeDelegate> delegate( | 2881 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2810 new GestureEventConsumeDelegate()); | 2882 new GestureEventConsumeDelegate()); |
2811 const int kWindowWidth = 123; | 2883 const int kWindowWidth = 123; |
2812 const int kWindowHeight = 45; | 2884 const int kWindowHeight = 45; |
2813 | 2885 |
2814 gfx::Rect bounds(5, 10, kWindowWidth, kWindowHeight); | 2886 gfx::Rect bounds(5, 10, kWindowWidth, kWindowHeight); |
2815 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 2887 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
2816 delegate.get(), -1234, bounds, root_window())); | 2888 delegate.get(), -1234, bounds, root_window())); |
2817 | 2889 |
2818 const int kSteps = 15; | 2890 const int kSteps = 15; |
2819 const int kTouchPoints = 4; | 2891 const int kTouchPoints = 4; |
2820 gfx::Point points[kTouchPoints] = { | 2892 gfx::Point points[kTouchPoints] = { |
2821 gfx::Point(10, 30), | 2893 gfx::Point(10, 30), |
2822 gfx::Point(30, 20), | 2894 gfx::Point(30, 20), |
2823 gfx::Point(50, 30), | 2895 gfx::Point(50, 30), |
2824 gfx::Point(80, 50) | 2896 gfx::Point(80, 50) |
2825 }; | 2897 }; |
2826 | 2898 |
2827 aura::test::EventGenerator generator(root_window(), window.get()); | 2899 aura::test::EventGenerator generator(root_window(), window.get()); |
2828 | 2900 |
2901 // The unified gesture recognizer assumes a finger has stopped if it hasn't | |
2902 // moved for too long. See ui/events/gesture_detection/velocity_tracker.cc's | |
2903 // kAssumePointerStoppedTimeMs. | |
2829 for (int count = 2; count <= kTouchPoints; ++count) { | 2904 for (int count = 2; count <= kTouchPoints; ++count) { |
2830 generator.GestureMultiFingerScroll( | 2905 generator.GestureMultiFingerScroll( |
2831 count, points, 1000, kSteps, 0, -11 * kSteps); | 2906 count, points, 10, kSteps, 0, -11 * kSteps); |
2832 EXPECT_TRUE(delegate->swipe_up()); | 2907 EXPECT_TRUE(delegate->swipe_up()); |
2833 delegate->Reset(); | 2908 delegate->Reset(); |
2834 | 2909 |
2835 generator.GestureMultiFingerScroll( | 2910 generator.GestureMultiFingerScroll( |
2836 count, points, 1000, kSteps, 0, 11 * kSteps); | 2911 count, points, 10, kSteps, 0, 11 * kSteps); |
2837 EXPECT_TRUE(delegate->swipe_down()); | 2912 EXPECT_TRUE(delegate->swipe_down()); |
2838 delegate->Reset(); | 2913 delegate->Reset(); |
2839 | 2914 |
2840 generator.GestureMultiFingerScroll( | 2915 generator.GestureMultiFingerScroll( |
2841 count, points, 1000, kSteps, -11 * kSteps, 0); | 2916 count, points, 10, kSteps, -11 * kSteps, 0); |
2842 EXPECT_TRUE(delegate->swipe_left()); | 2917 EXPECT_TRUE(delegate->swipe_left()); |
2843 delegate->Reset(); | 2918 delegate->Reset(); |
2844 | 2919 |
2845 generator.GestureMultiFingerScroll( | 2920 generator.GestureMultiFingerScroll( |
2846 count, points, 1000, kSteps, 11 * kSteps, 0); | 2921 count, points, 10, kSteps, 11 * kSteps, 0); |
2847 EXPECT_TRUE(delegate->swipe_right()); | 2922 EXPECT_TRUE(delegate->swipe_right()); |
2848 delegate->Reset(); | 2923 delegate->Reset(); |
2849 } | 2924 } |
2850 } | 2925 } |
2851 | 2926 |
2852 TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) { | 2927 TEST_P(GestureRecognizerTest, TwoFingerTapCancelled) { |
2853 scoped_ptr<GestureEventConsumeDelegate> delegate( | 2928 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2854 new GestureEventConsumeDelegate()); | 2929 new GestureEventConsumeDelegate()); |
2855 const int kWindowWidth = 123; | 2930 const int kWindowWidth = 123; |
2856 const int kWindowHeight = 45; | 2931 const int kWindowHeight = 45; |
2857 const int kTouchId1 = 2; | 2932 const int kTouchId1 = 2; |
2858 const int kTouchId2 = 3; | 2933 const int kTouchId2 = 3; |
2859 TimedEvents tes; | 2934 TimedEvents tes; |
2860 | 2935 |
2861 // Test canceling first finger. | 2936 // Test canceling first finger. |
2862 { | 2937 { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2916 // is recognized as a tap. | 2991 // is recognized as a tap. |
2917 delegate->Reset(); | 2992 delegate->Reset(); |
2918 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 2993 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
2919 kTouchId1, tes.LeapForward(50)); | 2994 kTouchId1, tes.LeapForward(50)); |
2920 | 2995 |
2921 DispatchEventUsingWindowDispatcher(&release); | 2996 DispatchEventUsingWindowDispatcher(&release); |
2922 EXPECT_FALSE(delegate->two_finger_tap()); | 2997 EXPECT_FALSE(delegate->two_finger_tap()); |
2923 } | 2998 } |
2924 } | 2999 } |
2925 | 3000 |
2926 TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) { | 3001 TEST_P(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) { |
3002 // Disabled for unified GR due to differences in when scroll update is | |
3003 // sent. The Aura GR will never send a ScrollUpdate with a ScrollBegin, but | |
3004 // the unified GR will. | |
3005 if (UsingUnifiedGR()) | |
3006 return; | |
3007 | |
2927 scoped_ptr<GestureEventConsumeDelegate> delegate( | 3008 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2928 new GestureEventConsumeDelegate()); | 3009 new GestureEventConsumeDelegate()); |
2929 const int kWindowWidth = 523; | 3010 const int kWindowWidth = 523; |
2930 const int kWindowHeight = 45; | 3011 const int kWindowHeight = 45; |
2931 const int kTouchId1 = 2; | 3012 const int kTouchId1 = 2; |
2932 const int kTouchId2 = 3; | 3013 const int kTouchId2 = 3; |
2933 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 3014 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
2934 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3015 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
2935 delegate.get(), -1234, bounds, root_window())); | 3016 delegate.get(), -1234, bounds, root_window())); |
2936 TimedEvents tes; | 3017 TimedEvents tes; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2973 EXPECT_TRUE(delegate->scroll_begin()); | 3054 EXPECT_TRUE(delegate->scroll_begin()); |
2974 EXPECT_FALSE(delegate->scroll_update()); | 3055 EXPECT_FALSE(delegate->scroll_update()); |
2975 EXPECT_FALSE(delegate->scroll_end()); | 3056 EXPECT_FALSE(delegate->scroll_end()); |
2976 EXPECT_FALSE(delegate->long_press()); | 3057 EXPECT_FALSE(delegate->long_press()); |
2977 EXPECT_FALSE(delegate->two_finger_tap()); | 3058 EXPECT_FALSE(delegate->two_finger_tap()); |
2978 EXPECT_TRUE(delegate->pinch_begin()); | 3059 EXPECT_TRUE(delegate->pinch_begin()); |
2979 } | 3060 } |
2980 | 3061 |
2981 // Verifies if a window is the target of multiple touch-ids and we hide the | 3062 // Verifies if a window is the target of multiple touch-ids and we hide the |
2982 // window everything is cleaned up correctly. | 3063 // window everything is cleaned up correctly. |
2983 TEST_F(GestureRecognizerTest, FlushAllOnHide) { | 3064 TEST_P(GestureRecognizerTest, FlushAllOnHide) { |
2984 scoped_ptr<GestureEventConsumeDelegate> delegate( | 3065 scoped_ptr<GestureEventConsumeDelegate> delegate( |
2985 new GestureEventConsumeDelegate()); | 3066 new GestureEventConsumeDelegate()); |
2986 gfx::Rect bounds(0, 0, 200, 200); | 3067 gfx::Rect bounds(0, 0, 200, 200); |
2987 scoped_ptr<aura::Window> window( | 3068 scoped_ptr<aura::Window> window( |
2988 CreateTestWindowWithDelegate(delegate.get(), 0, bounds, root_window())); | 3069 CreateTestWindowWithDelegate(delegate.get(), 0, bounds, root_window())); |
2989 const int kTouchId1 = 8; | 3070 const int kTouchId1 = 8; |
2990 const int kTouchId2 = 2; | 3071 const int kTouchId2 = 2; |
2991 TimedEvents tes; | 3072 TimedEvents tes; |
2992 | 3073 |
2993 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), | 3074 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), |
2994 kTouchId1, tes.Now()); | 3075 kTouchId1, tes.Now()); |
2995 DispatchEventUsingWindowDispatcher(&press1); | 3076 DispatchEventUsingWindowDispatcher(&press1); |
2996 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20), | 3077 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20), |
2997 kTouchId2, tes.Now()); | 3078 kTouchId2, tes.Now()); |
2998 DispatchEventUsingWindowDispatcher(&press2); | 3079 DispatchEventUsingWindowDispatcher(&press2); |
2999 window->Hide(); | 3080 window->Hide(); |
3000 EXPECT_EQ(NULL, | 3081 EXPECT_EQ(NULL, |
3001 ui::GestureRecognizer::Get()->GetTouchLockedTarget(press1)); | 3082 ui::GestureRecognizer::Get()->GetTouchLockedTarget(press1)); |
3002 EXPECT_EQ(NULL, | 3083 EXPECT_EQ(NULL, |
3003 ui::GestureRecognizer::Get()->GetTouchLockedTarget(press2)); | 3084 ui::GestureRecognizer::Get()->GetTouchLockedTarget(press2)); |
3004 } | 3085 } |
3005 | 3086 |
3006 TEST_F(GestureRecognizerTest, LongPressTimerStopsOnPreventDefaultedTouchMoves) { | 3087 TEST_P(GestureRecognizerTest, LongPressTimerStopsOnPreventDefaultedTouchMoves) { |
3088 // TODO(tdresser): write a version of this test for the unified GR. | |
3089 if (UsingUnifiedGR()) | |
3090 return; | |
3091 | |
3007 scoped_ptr<QueueTouchEventDelegate> delegate( | 3092 scoped_ptr<QueueTouchEventDelegate> delegate( |
3008 new QueueTouchEventDelegate(host()->dispatcher())); | 3093 new QueueTouchEventDelegate(host()->dispatcher())); |
3009 const int kTouchId = 2; | 3094 const int kTouchId = 2; |
3010 gfx::Rect bounds(100, 200, 100, 100); | 3095 gfx::Rect bounds(100, 200, 100, 100); |
3011 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3096 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3012 delegate.get(), -1234, bounds, root_window())); | 3097 delegate.get(), -1234, bounds, root_window())); |
3013 delegate->set_window(window.get()); | 3098 delegate->set_window(window.get()); |
3014 TimedEvents tes; | 3099 TimedEvents tes; |
3015 | 3100 |
3016 TimerTestGestureRecognizer* gesture_recognizer = | 3101 TimerTestGestureRecognizer* gesture_recognizer = |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3056 GestureEventConsumeDelegate::OnTouchEvent(touch); | 3141 GestureEventConsumeDelegate::OnTouchEvent(touch); |
3057 } | 3142 } |
3058 | 3143 |
3059 bool consume_touch_move_; | 3144 bool consume_touch_move_; |
3060 | 3145 |
3061 DISALLOW_COPY_AND_ASSIGN(ConsumesTouchMovesDelegate); | 3146 DISALLOW_COPY_AND_ASSIGN(ConsumesTouchMovesDelegate); |
3062 }; | 3147 }; |
3063 | 3148 |
3064 // Same as GestureEventScroll, but tests that the behavior is the same | 3149 // Same as GestureEventScroll, but tests that the behavior is the same |
3065 // even if all the touch-move events are consumed. | 3150 // even if all the touch-move events are consumed. |
3066 TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) { | 3151 TEST_P(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) { |
3067 scoped_ptr<ConsumesTouchMovesDelegate> delegate( | 3152 scoped_ptr<ConsumesTouchMovesDelegate> delegate( |
3068 new ConsumesTouchMovesDelegate()); | 3153 new ConsumesTouchMovesDelegate()); |
3069 const int kWindowWidth = 123; | 3154 const int kWindowWidth = 123; |
3070 const int kWindowHeight = 45; | 3155 const int kWindowHeight = 45; |
3071 const int kTouchId = 5; | 3156 const int kTouchId = 5; |
3072 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 3157 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
3073 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3158 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3074 delegate.get(), -1234, bounds, root_window())); | 3159 delegate.get(), -1234, bounds, root_window())); |
3075 TimedEvents tes; | 3160 TimedEvents tes; |
3076 | 3161 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3108 EXPECT_FALSE(delegate->tap_down()); | 3193 EXPECT_FALSE(delegate->tap_down()); |
3109 EXPECT_FALSE(delegate->tap_cancel()); | 3194 EXPECT_FALSE(delegate->tap_cancel()); |
3110 EXPECT_FALSE(delegate->begin()); | 3195 EXPECT_FALSE(delegate->begin()); |
3111 EXPECT_TRUE(delegate->end()); | 3196 EXPECT_TRUE(delegate->end()); |
3112 EXPECT_FALSE(delegate->scroll_begin()); | 3197 EXPECT_FALSE(delegate->scroll_begin()); |
3113 EXPECT_FALSE(delegate->scroll_update()); | 3198 EXPECT_FALSE(delegate->scroll_update()); |
3114 EXPECT_FALSE(delegate->scroll_end()); | 3199 EXPECT_FALSE(delegate->scroll_end()); |
3115 } | 3200 } |
3116 | 3201 |
3117 // Tests the behavior of 2F scroll when all the touch-move events are consumed. | 3202 // Tests the behavior of 2F scroll when all the touch-move events are consumed. |
3118 TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) { | 3203 TEST_P(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) { |
3204 // TODO(tdresser): enable this test with unified GR once two finger tap is | |
3205 // supported. See crbug.com/354396. | |
3206 if (UsingUnifiedGR()) | |
3207 return; | |
3208 | |
3119 scoped_ptr<ConsumesTouchMovesDelegate> delegate( | 3209 scoped_ptr<ConsumesTouchMovesDelegate> delegate( |
3120 new ConsumesTouchMovesDelegate()); | 3210 new ConsumesTouchMovesDelegate()); |
3121 const int kWindowWidth = 123; | 3211 const int kWindowWidth = 123; |
3122 const int kWindowHeight = 100; | 3212 const int kWindowHeight = 100; |
3123 const int kTouchId1 = 2; | 3213 const int kTouchId1 = 2; |
3124 const int kTouchId2 = 3; | 3214 const int kTouchId2 = 3; |
3125 TimedEvents tes; | 3215 TimedEvents tes; |
3126 | 3216 |
3127 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 3217 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
3128 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3218 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3215 EXPECT_TRUE(delegate->fling()); | 3305 EXPECT_TRUE(delegate->fling()); |
3216 | 3306 |
3217 EXPECT_FALSE(delegate->pinch_begin()); | 3307 EXPECT_FALSE(delegate->pinch_begin()); |
3218 EXPECT_FALSE(delegate->pinch_update()); | 3308 EXPECT_FALSE(delegate->pinch_update()); |
3219 EXPECT_FALSE(delegate->pinch_end()); | 3309 EXPECT_FALSE(delegate->pinch_end()); |
3220 } | 3310 } |
3221 | 3311 |
3222 // Like as GestureEventTouchMoveConsumed but tests the different behavior | 3312 // Like as GestureEventTouchMoveConsumed but tests the different behavior |
3223 // depending on whether the events were consumed before or after the scroll | 3313 // depending on whether the events were consumed before or after the scroll |
3224 // started. | 3314 // started. |
3225 TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) { | 3315 TEST_P(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) { |
3226 scoped_ptr<ConsumesTouchMovesDelegate> delegate( | 3316 scoped_ptr<ConsumesTouchMovesDelegate> delegate( |
3227 new ConsumesTouchMovesDelegate()); | 3317 new ConsumesTouchMovesDelegate()); |
3228 const int kWindowWidth = 123; | 3318 const int kWindowWidth = 123; |
3229 const int kWindowHeight = 45; | 3319 const int kWindowHeight = 45; |
3230 const int kTouchId = 5; | 3320 const int kTouchId = 5; |
3231 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 3321 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
3232 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3322 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3233 delegate.get(), -1234, bounds, root_window())); | 3323 delegate.get(), -1234, bounds, root_window())); |
3234 TimedEvents tes; | 3324 TimedEvents tes; |
3235 | 3325 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3309 EXPECT_FALSE(delegate->tap_cancel()); | 3399 EXPECT_FALSE(delegate->tap_cancel()); |
3310 EXPECT_FALSE(delegate->begin()); | 3400 EXPECT_FALSE(delegate->begin()); |
3311 EXPECT_TRUE(delegate->end()); | 3401 EXPECT_TRUE(delegate->end()); |
3312 EXPECT_FALSE(delegate->scroll_begin()); | 3402 EXPECT_FALSE(delegate->scroll_begin()); |
3313 EXPECT_FALSE(delegate->scroll_update()); | 3403 EXPECT_FALSE(delegate->scroll_update()); |
3314 EXPECT_FALSE(delegate->scroll_end()); | 3404 EXPECT_FALSE(delegate->scroll_end()); |
3315 EXPECT_FALSE(delegate->fling()); | 3405 EXPECT_FALSE(delegate->fling()); |
3316 } | 3406 } |
3317 | 3407 |
3318 // Check that appropriate touch events generate double tap gesture events. | 3408 // Check that appropriate touch events generate double tap gesture events. |
3319 TEST_F(GestureRecognizerTest, GestureEventDoubleTap) { | 3409 TEST_P(GestureRecognizerTest, GestureEventDoubleTap) { |
3410 // TODO(tdresser): enable this test with unified GR once double / triple tap | |
3411 // gestures work. See crbug.com/357270. | |
3412 if (UsingUnifiedGR()) | |
3413 return; | |
3414 | |
3320 scoped_ptr<GestureEventConsumeDelegate> delegate( | 3415 scoped_ptr<GestureEventConsumeDelegate> delegate( |
3321 new GestureEventConsumeDelegate()); | 3416 new GestureEventConsumeDelegate()); |
3322 const int kWindowWidth = 123; | 3417 const int kWindowWidth = 123; |
3323 const int kWindowHeight = 45; | 3418 const int kWindowHeight = 45; |
3324 const int kTouchId = 2; | 3419 const int kTouchId = 2; |
3325 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 3420 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
3326 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3421 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3327 delegate.get(), -1234, bounds, root_window())); | 3422 delegate.get(), -1234, bounds, root_window())); |
3328 TimedEvents tes; | 3423 TimedEvents tes; |
3329 | 3424 |
(...skipping 20 matching lines...) Expand all Loading... | |
3350 EXPECT_TRUE(delegate->begin()); | 3445 EXPECT_TRUE(delegate->begin()); |
3351 EXPECT_TRUE(delegate->end()); | 3446 EXPECT_TRUE(delegate->end()); |
3352 EXPECT_FALSE(delegate->scroll_begin()); | 3447 EXPECT_FALSE(delegate->scroll_begin()); |
3353 EXPECT_FALSE(delegate->scroll_update()); | 3448 EXPECT_FALSE(delegate->scroll_update()); |
3354 EXPECT_FALSE(delegate->scroll_end()); | 3449 EXPECT_FALSE(delegate->scroll_end()); |
3355 | 3450 |
3356 EXPECT_EQ(2, delegate->tap_count()); | 3451 EXPECT_EQ(2, delegate->tap_count()); |
3357 } | 3452 } |
3358 | 3453 |
3359 // Check that appropriate touch events generate triple tap gesture events. | 3454 // Check that appropriate touch events generate triple tap gesture events. |
3360 TEST_F(GestureRecognizerTest, GestureEventTripleTap) { | 3455 TEST_P(GestureRecognizerTest, GestureEventTripleTap) { |
3456 // TODO(tdresser): enable this test with unified GR once double / triple tap | |
3457 // gestures work. See crbug.com/357270. | |
3458 if (UsingUnifiedGR()) | |
3459 return; | |
3460 | |
3361 scoped_ptr<GestureEventConsumeDelegate> delegate( | 3461 scoped_ptr<GestureEventConsumeDelegate> delegate( |
3362 new GestureEventConsumeDelegate()); | 3462 new GestureEventConsumeDelegate()); |
3363 const int kWindowWidth = 123; | 3463 const int kWindowWidth = 123; |
3364 const int kWindowHeight = 45; | 3464 const int kWindowHeight = 45; |
3365 const int kTouchId = 2; | 3465 const int kTouchId = 2; |
3366 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 3466 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
3367 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3467 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3368 delegate.get(), -1234, bounds, root_window())); | 3468 delegate.get(), -1234, bounds, root_window())); |
3369 TimedEvents tes; | 3469 TimedEvents tes; |
3370 | 3470 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3405 EXPECT_TRUE(delegate->begin()); | 3505 EXPECT_TRUE(delegate->begin()); |
3406 EXPECT_TRUE(delegate->end()); | 3506 EXPECT_TRUE(delegate->end()); |
3407 EXPECT_FALSE(delegate->scroll_begin()); | 3507 EXPECT_FALSE(delegate->scroll_begin()); |
3408 EXPECT_FALSE(delegate->scroll_update()); | 3508 EXPECT_FALSE(delegate->scroll_update()); |
3409 EXPECT_FALSE(delegate->scroll_end()); | 3509 EXPECT_FALSE(delegate->scroll_end()); |
3410 | 3510 |
3411 EXPECT_EQ(3, delegate->tap_count()); | 3511 EXPECT_EQ(3, delegate->tap_count()); |
3412 } | 3512 } |
3413 | 3513 |
3414 // Check that we don't get a double tap when the two taps are far apart. | 3514 // Check that we don't get a double tap when the two taps are far apart. |
3415 TEST_F(GestureRecognizerTest, TwoTapsFarApart) { | 3515 TEST_P(GestureRecognizerTest, TwoTapsFarApart) { |
3416 scoped_ptr<GestureEventConsumeDelegate> delegate( | 3516 scoped_ptr<GestureEventConsumeDelegate> delegate( |
3417 new GestureEventConsumeDelegate()); | 3517 new GestureEventConsumeDelegate()); |
3418 const int kWindowWidth = 123; | 3518 const int kWindowWidth = 123; |
3419 const int kWindowHeight = 45; | 3519 const int kWindowHeight = 45; |
3420 const int kTouchId = 2; | 3520 const int kTouchId = 2; |
3421 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 3521 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
3422 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3522 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3423 delegate.get(), -1234, bounds, root_window())); | 3523 delegate.get(), -1234, bounds, root_window())); |
3424 TimedEvents tes; | 3524 TimedEvents tes; |
3425 | 3525 |
(...skipping 21 matching lines...) Expand all Loading... | |
3447 EXPECT_TRUE(delegate->end()); | 3547 EXPECT_TRUE(delegate->end()); |
3448 EXPECT_FALSE(delegate->scroll_begin()); | 3548 EXPECT_FALSE(delegate->scroll_begin()); |
3449 EXPECT_FALSE(delegate->scroll_update()); | 3549 EXPECT_FALSE(delegate->scroll_update()); |
3450 EXPECT_FALSE(delegate->scroll_end()); | 3550 EXPECT_FALSE(delegate->scroll_end()); |
3451 | 3551 |
3452 EXPECT_EQ(1, delegate->tap_count()); | 3552 EXPECT_EQ(1, delegate->tap_count()); |
3453 } | 3553 } |
3454 | 3554 |
3455 // Check that we don't get a double tap when the two taps have a long enough | 3555 // Check that we don't get a double tap when the two taps have a long enough |
3456 // delay in between. | 3556 // delay in between. |
3457 TEST_F(GestureRecognizerTest, TwoTapsWithDelayBetween) { | 3557 TEST_P(GestureRecognizerTest, TwoTapsWithDelayBetween) { |
3458 scoped_ptr<GestureEventConsumeDelegate> delegate( | 3558 scoped_ptr<GestureEventConsumeDelegate> delegate( |
3459 new GestureEventConsumeDelegate()); | 3559 new GestureEventConsumeDelegate()); |
3460 const int kWindowWidth = 123; | 3560 const int kWindowWidth = 123; |
3461 const int kWindowHeight = 45; | 3561 const int kWindowHeight = 45; |
3462 const int kTouchId = 2; | 3562 const int kTouchId = 2; |
3463 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 3563 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
3464 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3564 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3465 delegate.get(), -1234, bounds, root_window())); | 3565 delegate.get(), -1234, bounds, root_window())); |
3466 TimedEvents tes; | 3566 TimedEvents tes; |
3467 | 3567 |
(...skipping 22 matching lines...) Expand all Loading... | |
3490 EXPECT_FALSE(delegate->scroll_begin()); | 3590 EXPECT_FALSE(delegate->scroll_begin()); |
3491 EXPECT_FALSE(delegate->scroll_update()); | 3591 EXPECT_FALSE(delegate->scroll_update()); |
3492 EXPECT_FALSE(delegate->scroll_end()); | 3592 EXPECT_FALSE(delegate->scroll_end()); |
3493 | 3593 |
3494 EXPECT_EQ(1, delegate->tap_count()); | 3594 EXPECT_EQ(1, delegate->tap_count()); |
3495 } | 3595 } |
3496 | 3596 |
3497 // Checks that if the bounding-box of a gesture changes because of change in | 3597 // Checks that if the bounding-box of a gesture changes because of change in |
3498 // radius of a touch-point, and not because of change in position, then there | 3598 // radius of a touch-point, and not because of change in position, then there |
3499 // are not gesture events from that. | 3599 // are not gesture events from that. |
3500 TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) { | 3600 TEST_P(GestureRecognizerTest, BoundingBoxRadiusChange) { |
3601 // TODO(tdresser): enable this test with unified GR when (if?) bounding box | |
3602 // behavior is unified. | |
3603 if (UsingUnifiedGR()) | |
3604 return; | |
3605 | |
3501 scoped_ptr<GestureEventConsumeDelegate> delegate( | 3606 scoped_ptr<GestureEventConsumeDelegate> delegate( |
3502 new GestureEventConsumeDelegate()); | 3607 new GestureEventConsumeDelegate()); |
3503 const int kWindowWidth = 234; | 3608 const int kWindowWidth = 234; |
3504 const int kWindowHeight = 345; | 3609 const int kWindowHeight = 345; |
3505 const int kTouchId = 5, kTouchId2 = 7; | 3610 const int kTouchId = 5, kTouchId2 = 7; |
3506 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 3611 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
3507 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3612 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3508 delegate.get(), -1234, bounds, root_window())); | 3613 delegate.get(), -1234, bounds, root_window())); |
3509 TimedEvents tes; | 3614 TimedEvents tes; |
3510 | 3615 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3544 EXPECT_FALSE(delegate->tap()); | 3649 EXPECT_FALSE(delegate->tap()); |
3545 EXPECT_FALSE(delegate->tap_cancel()); | 3650 EXPECT_FALSE(delegate->tap_cancel()); |
3546 EXPECT_FALSE(delegate->scroll_update()); | 3651 EXPECT_FALSE(delegate->scroll_update()); |
3547 EXPECT_FALSE(delegate->pinch_update()); | 3652 EXPECT_FALSE(delegate->pinch_update()); |
3548 | 3653 |
3549 delegate->Reset(); | 3654 delegate->Reset(); |
3550 } | 3655 } |
3551 | 3656 |
3552 // Checks that slow scrolls deliver the correct deltas. | 3657 // Checks that slow scrolls deliver the correct deltas. |
3553 // In particular, fix for http;//crbug.com/150573. | 3658 // In particular, fix for http;//crbug.com/150573. |
3554 TEST_F(GestureRecognizerTest, NoDriftInScroll) { | 3659 TEST_P(GestureRecognizerTest, NoDriftInScroll) { |
3555 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(3); | 3660 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(3); |
3556 ui::GestureConfiguration::set_min_scroll_delta_squared(9); | 3661 ui::GestureConfiguration::set_min_scroll_delta_squared(9); |
3557 scoped_ptr<GestureEventConsumeDelegate> delegate( | 3662 scoped_ptr<GestureEventConsumeDelegate> delegate( |
3558 new GestureEventConsumeDelegate()); | 3663 new GestureEventConsumeDelegate()); |
3559 const int kWindowWidth = 234; | 3664 const int kWindowWidth = 234; |
3560 const int kWindowHeight = 345; | 3665 const int kWindowHeight = 345; |
3561 const int kTouchId = 5; | 3666 const int kTouchId = 5; |
3562 TimedEvents tes; | 3667 TimedEvents tes; |
3563 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 3668 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
3564 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3669 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3602 DispatchEventUsingWindowDispatcher(&move4); | 3707 DispatchEventUsingWindowDispatcher(&move4); |
3603 EXPECT_TRUE(delegate->scroll_update()); | 3708 EXPECT_TRUE(delegate->scroll_update()); |
3604 EXPECT_EQ(-1, delegate->scroll_y()); | 3709 EXPECT_EQ(-1, delegate->scroll_y()); |
3605 | 3710 |
3606 delegate->Reset(); | 3711 delegate->Reset(); |
3607 } | 3712 } |
3608 | 3713 |
3609 // Ensure that move events which are preventDefaulted will cause a tap | 3714 // Ensure that move events which are preventDefaulted will cause a tap |
3610 // cancel gesture event to be fired if the move would normally cause a | 3715 // cancel gesture event to be fired if the move would normally cause a |
3611 // scroll. See bug http://crbug.com/146397. | 3716 // scroll. See bug http://crbug.com/146397. |
3612 TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveCanFireTapCancel) { | 3717 TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMoveCanFireTapCancel) { |
3613 scoped_ptr<ConsumesTouchMovesDelegate> delegate( | 3718 scoped_ptr<ConsumesTouchMovesDelegate> delegate( |
3614 new ConsumesTouchMovesDelegate()); | 3719 new ConsumesTouchMovesDelegate()); |
3615 const int kTouchId = 5; | 3720 const int kTouchId = 5; |
3616 gfx::Rect bounds(100, 200, 123, 45); | 3721 gfx::Rect bounds(100, 200, 123, 45); |
3617 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3722 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3618 delegate.get(), -1234, bounds, root_window())); | 3723 delegate.get(), -1234, bounds, root_window())); |
3619 TimedEvents tes; | 3724 TimedEvents tes; |
3620 | 3725 |
3621 delegate->Reset(); | 3726 delegate->Reset(); |
3622 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), | 3727 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), |
3623 kTouchId, tes.Now()); | 3728 kTouchId, tes.Now()); |
3624 | 3729 |
3625 delegate->set_consume_touch_move(false); | 3730 delegate->set_consume_touch_move(false); |
3626 DispatchEventUsingWindowDispatcher(&press); | 3731 DispatchEventUsingWindowDispatcher(&press); |
3627 delegate->set_consume_touch_move(true); | 3732 delegate->set_consume_touch_move(true); |
3628 delegate->Reset(); | 3733 delegate->Reset(); |
3629 // Move the touch-point enough so that it would normally be considered a | 3734 // Move the touch-point enough so that it would normally be considered a |
3630 // scroll. But since the touch-moves will be consumed, the scroll should not | 3735 // scroll. But since the touch-moves will be consumed, the scroll should not |
3631 // start. | 3736 // start. |
3632 tes.SendScrollEvent(event_processor(), 130, 230, kTouchId, delegate.get()); | 3737 tes.SendScrollEvent(event_processor(), 130, 230, kTouchId, delegate.get()); |
3633 EXPECT_FALSE(delegate->tap()); | 3738 EXPECT_FALSE(delegate->tap()); |
3634 EXPECT_FALSE(delegate->tap_down()); | 3739 EXPECT_FALSE(delegate->tap_down()); |
3635 EXPECT_TRUE(delegate->tap_cancel()); | 3740 EXPECT_TRUE(delegate->tap_cancel()); |
3636 EXPECT_FALSE(delegate->begin()); | 3741 EXPECT_FALSE(delegate->begin()); |
3637 EXPECT_FALSE(delegate->scroll_begin()); | 3742 EXPECT_FALSE(delegate->scroll_begin()); |
3638 EXPECT_FALSE(delegate->scroll_update()); | 3743 EXPECT_FALSE(delegate->scroll_update()); |
3639 EXPECT_FALSE(delegate->scroll_end()); | 3744 EXPECT_FALSE(delegate->scroll_end()); |
3640 } | 3745 } |
3641 | 3746 |
3642 TEST_F(GestureRecognizerTest, | 3747 TEST_P(GestureRecognizerTest, |
3643 TransferEventDispatchesTouchCancel) { | 3748 TransferEventDispatchesTouchCancel) { |
3644 scoped_ptr<GestureEventConsumeDelegate> delegate( | 3749 scoped_ptr<GestureEventConsumeDelegate> delegate( |
3645 new GestureEventConsumeDelegate()); | 3750 new GestureEventConsumeDelegate()); |
3646 TimedEvents tes; | 3751 TimedEvents tes; |
3647 const int kWindowWidth = 800; | 3752 const int kWindowWidth = 800; |
3648 const int kWindowHeight = 600; | 3753 const int kWindowHeight = 600; |
3649 const int kTouchId = 2; | 3754 const int kTouchId = 2; |
3650 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); | 3755 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); |
3651 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3756 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3652 delegate.get(), -1234, bounds, root_window())); | 3757 delegate.get(), -1234, bounds, root_window())); |
(...skipping 22 matching lines...) Expand all Loading... | |
3675 gesture_recognizer->GetTouchLockedTarget(press)); | 3780 gesture_recognizer->GetTouchLockedTarget(press)); |
3676 gesture_recognizer->TransferEventsTo(window.get(), NULL); | 3781 gesture_recognizer->TransferEventsTo(window.get(), NULL); |
3677 EXPECT_EQ(NULL, | 3782 EXPECT_EQ(NULL, |
3678 gesture_recognizer->GetTouchLockedTarget(press)); | 3783 gesture_recognizer->GetTouchLockedTarget(press)); |
3679 // The event-handler removes |window| from its parent on the first | 3784 // The event-handler removes |window| from its parent on the first |
3680 // touch-cancel event, so it won't receive the second touch-cancel event. | 3785 // touch-cancel event, so it won't receive the second touch-cancel event. |
3681 EXPECT_EQ(1, handler->touch_cancelled_count()); | 3786 EXPECT_EQ(1, handler->touch_cancelled_count()); |
3682 } | 3787 } |
3683 | 3788 |
3684 // Check that appropriate touch events generate show press events | 3789 // Check that appropriate touch events generate show press events |
3685 TEST_F(GestureRecognizerTest, GestureEventShowPress) { | 3790 TEST_P(GestureRecognizerTest, GestureEventShowPress) { |
3686 scoped_ptr<GestureEventConsumeDelegate> delegate( | 3791 scoped_ptr<GestureEventConsumeDelegate> delegate( |
3687 new GestureEventConsumeDelegate()); | 3792 new GestureEventConsumeDelegate()); |
3688 TimedEvents tes; | 3793 TimedEvents tes; |
3689 const int kWindowWidth = 123; | 3794 const int kWindowWidth = 123; |
3690 const int kWindowHeight = 45; | 3795 const int kWindowHeight = 45; |
3691 const int kTouchId = 2; | 3796 const int kTouchId = 2; |
3692 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 3797 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
3693 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3798 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3694 delegate.get(), -1234, bounds, root_window())); | 3799 delegate.get(), -1234, bounds, root_window())); |
3695 | 3800 |
(...skipping 18 matching lines...) Expand all Loading... | |
3714 delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_SHOW_PRESS); | 3819 delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_SHOW_PRESS); |
3715 EXPECT_TRUE(delegate->show_press()); | 3820 EXPECT_TRUE(delegate->show_press()); |
3716 EXPECT_FALSE(delegate->tap_cancel()); | 3821 EXPECT_FALSE(delegate->tap_cancel()); |
3717 | 3822 |
3718 delegate->Reset(); | 3823 delegate->Reset(); |
3719 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 3824 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
3720 kTouchId, tes.Now()); | 3825 kTouchId, tes.Now()); |
3721 DispatchEventUsingWindowDispatcher(&release1); | 3826 DispatchEventUsingWindowDispatcher(&release1); |
3722 EXPECT_FALSE(delegate->long_press()); | 3827 EXPECT_FALSE(delegate->long_press()); |
3723 | 3828 |
3724 // Note the tap down isn't cancelled until the release | 3829 // Note the tap isn't dispatched until the release |
3725 EXPECT_TRUE(delegate->tap_cancel()); | 3830 EXPECT_FALSE(delegate->tap_cancel()); |
3831 EXPECT_TRUE(delegate->tap()); | |
3726 } | 3832 } |
3727 | 3833 |
3728 // Check that scrolling cancels a show press | 3834 // Check that scrolling cancels a show press |
3729 TEST_F(GestureRecognizerTest, GestureEventShowPressCancelledByScroll) { | 3835 TEST_P(GestureRecognizerTest, GestureEventShowPressCancelledByScroll) { |
3730 scoped_ptr<GestureEventConsumeDelegate> delegate( | 3836 scoped_ptr<GestureEventConsumeDelegate> delegate( |
3731 new GestureEventConsumeDelegate()); | 3837 new GestureEventConsumeDelegate()); |
3732 TimedEvents tes; | 3838 TimedEvents tes; |
3733 const int kWindowWidth = 123; | 3839 const int kWindowWidth = 123; |
3734 const int kWindowHeight = 45; | 3840 const int kWindowHeight = 45; |
3735 const int kTouchId = 6; | 3841 const int kTouchId = 6; |
3736 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 3842 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
3737 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3843 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3738 delegate.get(), -1234, bounds, root_window())); | 3844 delegate.get(), -1234, bounds, root_window())); |
3739 | 3845 |
(...skipping 26 matching lines...) Expand all Loading... | |
3766 | 3872 |
3767 delegate->Reset(); | 3873 delegate->Reset(); |
3768 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 3874 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
3769 kTouchId, tes.LeapForward(10)); | 3875 kTouchId, tes.LeapForward(10)); |
3770 DispatchEventUsingWindowDispatcher(&release1); | 3876 DispatchEventUsingWindowDispatcher(&release1); |
3771 EXPECT_FALSE(delegate->show_press()); | 3877 EXPECT_FALSE(delegate->show_press()); |
3772 EXPECT_FALSE(delegate->tap_cancel()); | 3878 EXPECT_FALSE(delegate->tap_cancel()); |
3773 } | 3879 } |
3774 | 3880 |
3775 // Test that show press events are sent immediately on tap | 3881 // Test that show press events are sent immediately on tap |
3776 TEST_F(GestureRecognizerTest, GestureEventShowPressSentOnTap) { | 3882 TEST_P(GestureRecognizerTest, GestureEventShowPressSentOnTap) { |
3777 scoped_ptr<GestureEventConsumeDelegate> delegate( | 3883 scoped_ptr<GestureEventConsumeDelegate> delegate( |
3778 new GestureEventConsumeDelegate()); | 3884 new GestureEventConsumeDelegate()); |
3779 TimedEvents tes; | 3885 TimedEvents tes; |
3780 const int kWindowWidth = 123; | 3886 const int kWindowWidth = 123; |
3781 const int kWindowHeight = 45; | 3887 const int kWindowHeight = 45; |
3782 const int kTouchId = 6; | 3888 const int kTouchId = 6; |
3783 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 3889 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
3784 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3890 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3785 delegate.get(), -1234, bounds, root_window())); | 3891 delegate.get(), -1234, bounds, root_window())); |
3786 | 3892 |
(...skipping 11 matching lines...) Expand all Loading... | |
3798 delegate->Reset(); | 3904 delegate->Reset(); |
3799 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), | 3905 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), |
3800 kTouchId, tes.LeapForward(50)); | 3906 kTouchId, tes.LeapForward(50)); |
3801 DispatchEventUsingWindowDispatcher(&release1); | 3907 DispatchEventUsingWindowDispatcher(&release1); |
3802 EXPECT_TRUE(delegate->show_press()); | 3908 EXPECT_TRUE(delegate->show_press()); |
3803 EXPECT_FALSE(delegate->tap_cancel()); | 3909 EXPECT_FALSE(delegate->tap_cancel()); |
3804 EXPECT_TRUE(delegate->tap()); | 3910 EXPECT_TRUE(delegate->tap()); |
3805 } | 3911 } |
3806 | 3912 |
3807 // Test that consuming the first move touch event prevents a scroll. | 3913 // Test that consuming the first move touch event prevents a scroll. |
3808 TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveScrollTest) { | 3914 TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMoveScrollTest) { |
3809 scoped_ptr<QueueTouchEventDelegate> delegate( | 3915 scoped_ptr<QueueTouchEventDelegate> delegate( |
3810 new QueueTouchEventDelegate(host()->dispatcher())); | 3916 new QueueTouchEventDelegate(host()->dispatcher())); |
3811 TimedEvents tes; | 3917 TimedEvents tes; |
3812 const int kTouchId = 7; | 3918 const int kTouchId = 7; |
3813 gfx::Rect bounds(0, 0, 1000, 1000); | 3919 gfx::Rect bounds(0, 0, 1000, 1000); |
3814 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3920 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3815 delegate.get(), -1234, bounds, root_window())); | 3921 delegate.get(), -1234, bounds, root_window())); |
3816 | 3922 |
3817 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), | 3923 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), |
3818 kTouchId, tes.Now()); | 3924 kTouchId, tes.Now()); |
3819 DispatchEventUsingWindowDispatcher(&press); | 3925 DispatchEventUsingWindowDispatcher(&press); |
3820 delegate->ReceivedAck(); | 3926 delegate->ReceivedAck(); |
3821 | 3927 |
3822 ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(2, 2), | 3928 // A touch move within the slop region is never consumed in web contents. The |
3929 // unified GR won't prevent scroll if a touch move within the slop region is | |
3930 // consumed, so make sure this touch move exceeds the slop region. | |
3931 ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(10, 10), | |
3823 kTouchId, tes.Now()); | 3932 kTouchId, tes.Now()); |
3824 DispatchEventUsingWindowDispatcher(&move1); | 3933 DispatchEventUsingWindowDispatcher(&move1); |
3825 delegate->ReceivedAckPreventDefaulted(); | 3934 delegate->ReceivedAckPreventDefaulted(); |
3826 | 3935 |
3827 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), | 3936 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), |
3828 kTouchId, tes.Now()); | 3937 kTouchId, tes.Now()); |
3829 DispatchEventUsingWindowDispatcher(&move2); | 3938 DispatchEventUsingWindowDispatcher(&move2); |
3830 delegate->ReceivedAck(); | 3939 delegate->ReceivedAck(); |
3831 | 3940 |
3832 EXPECT_FALSE(delegate->scroll_begin()); | 3941 EXPECT_FALSE(delegate->scroll_begin()); |
3833 EXPECT_FALSE(delegate->scroll_update()); | 3942 EXPECT_FALSE(delegate->scroll_update()); |
3834 } | 3943 } |
3835 | 3944 |
3836 // Test that consuming the first touch move event of a touch point doesn't | 3945 // Test that consuming the first touch move event of a touch point doesn't |
3837 // prevent pinching once an additional touch has been pressed. | 3946 // prevent pinching once an additional touch has been pressed. |
3838 TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMovePinchTest) { | 3947 TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMovePinchTest) { |
3948 // Consuming moves within the touch slop and the the disposition handling of | |
3949 // pinch events behave differently between the Unified GR and the Aura GR. | |
3950 if (UsingUnifiedGR()) | |
3951 return; | |
3952 | |
3839 scoped_ptr<QueueTouchEventDelegate> delegate( | 3953 scoped_ptr<QueueTouchEventDelegate> delegate( |
3840 new QueueTouchEventDelegate(host()->dispatcher())); | 3954 new QueueTouchEventDelegate(host()->dispatcher())); |
3841 TimedEvents tes; | 3955 TimedEvents tes; |
3842 const int kTouchId1 = 7; | 3956 const int kTouchId1 = 7; |
3843 const int kTouchId2 = 4; | 3957 const int kTouchId2 = 4; |
3844 gfx::Rect bounds(0, 0, 1000, 1000); | 3958 gfx::Rect bounds(0, 0, 1000, 1000); |
3845 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 3959 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3846 delegate.get(), -1234, bounds, root_window())); | 3960 delegate.get(), -1234, bounds, root_window())); |
3847 | 3961 |
3848 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), | 3962 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3885 kTouchId2, tes.Now()); | 3999 kTouchId2, tes.Now()); |
3886 DispatchEventUsingWindowDispatcher(&move4); | 4000 DispatchEventUsingWindowDispatcher(&move4); |
3887 delegate->ReceivedAck(); | 4001 delegate->ReceivedAck(); |
3888 | 4002 |
3889 EXPECT_TRUE(delegate->pinch_update()); | 4003 EXPECT_TRUE(delegate->pinch_update()); |
3890 EXPECT_EQ(10, delegate->scroll_x()); | 4004 EXPECT_EQ(10, delegate->scroll_x()); |
3891 EXPECT_EQ(10, delegate->scroll_y()); | 4005 EXPECT_EQ(10, delegate->scroll_y()); |
3892 } | 4006 } |
3893 | 4007 |
3894 // Test that consuming the first move touch doesn't prevent a tap. | 4008 // Test that consuming the first move touch doesn't prevent a tap. |
3895 TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveTapTest) { | 4009 TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMoveTapTest) { |
3896 scoped_ptr<QueueTouchEventDelegate> delegate( | 4010 scoped_ptr<QueueTouchEventDelegate> delegate( |
3897 new QueueTouchEventDelegate(host()->dispatcher())); | 4011 new QueueTouchEventDelegate(host()->dispatcher())); |
3898 TimedEvents tes; | 4012 TimedEvents tes; |
3899 const int kTouchId = 7; | 4013 const int kTouchId = 7; |
3900 gfx::Rect bounds(0, 0, 1000, 1000); | 4014 gfx::Rect bounds(0, 0, 1000, 1000); |
3901 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 4015 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3902 delegate.get(), -1234, bounds, root_window())); | 4016 delegate.get(), -1234, bounds, root_window())); |
3903 | 4017 |
3904 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), | 4018 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), |
3905 kTouchId, tes.Now()); | 4019 kTouchId, tes.Now()); |
3906 DispatchEventUsingWindowDispatcher(&press); | 4020 DispatchEventUsingWindowDispatcher(&press); |
3907 delegate->ReceivedAck(); | 4021 delegate->ReceivedAck(); |
3908 | 4022 |
3909 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(2, 2), | 4023 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(2, 2), |
3910 kTouchId, tes.Now()); | 4024 kTouchId, tes.Now()); |
3911 DispatchEventUsingWindowDispatcher(&move); | 4025 DispatchEventUsingWindowDispatcher(&move); |
3912 delegate->ReceivedAckPreventDefaulted(); | 4026 delegate->ReceivedAckPreventDefaulted(); |
3913 | 4027 |
3914 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(2, 2), | 4028 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(2, 2), |
3915 kTouchId, tes.LeapForward(50)); | 4029 kTouchId, tes.LeapForward(50)); |
3916 DispatchEventUsingWindowDispatcher(&release); | 4030 DispatchEventUsingWindowDispatcher(&release); |
3917 delegate->ReceivedAck(); | 4031 delegate->ReceivedAck(); |
3918 | 4032 |
3919 EXPECT_TRUE(delegate->tap()); | 4033 EXPECT_TRUE(delegate->tap()); |
3920 } | 4034 } |
3921 | 4035 |
3922 // Test that consuming the first move touch doesn't prevent a long press. | 4036 // Test that consuming the first move touch doesn't prevent a long press. |
3923 TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveLongPressTest) { | 4037 TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMoveLongPressTest) { |
3924 scoped_ptr<QueueTouchEventDelegate> delegate( | 4038 scoped_ptr<QueueTouchEventDelegate> delegate( |
3925 new QueueTouchEventDelegate(host()->dispatcher())); | 4039 new QueueTouchEventDelegate(host()->dispatcher())); |
3926 TimedEvents tes; | 4040 TimedEvents tes; |
3927 const int kWindowWidth = 123; | 4041 const int kWindowWidth = 123; |
3928 const int kWindowHeight = 45; | 4042 const int kWindowHeight = 45; |
3929 const int kTouchId = 2; | 4043 const int kTouchId = 2; |
3930 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | 4044 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); |
3931 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 4045 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3932 delegate.get(), -1234, bounds, root_window())); | 4046 delegate.get(), -1234, bounds, root_window())); |
3933 | 4047 |
(...skipping 13 matching lines...) Expand all Loading... | |
3947 kTouchId, tes.Now()); | 4061 kTouchId, tes.Now()); |
3948 DispatchEventUsingWindowDispatcher(&move); | 4062 DispatchEventUsingWindowDispatcher(&move); |
3949 delegate->ReceivedAckPreventDefaulted(); | 4063 delegate->ReceivedAckPreventDefaulted(); |
3950 | 4064 |
3951 // Wait until the timer runs out | 4065 // Wait until the timer runs out |
3952 delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_LONG_PRESS); | 4066 delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_LONG_PRESS); |
3953 EXPECT_TRUE(delegate->long_press()); | 4067 EXPECT_TRUE(delegate->long_press()); |
3954 } | 4068 } |
3955 | 4069 |
3956 // Tests that the deltas are correct when leaving the slop region very slowly. | 4070 // Tests that the deltas are correct when leaving the slop region very slowly. |
3957 TEST_F(GestureRecognizerTest, TestExceedingSlopSlowly) { | 4071 TEST_P(GestureRecognizerTest, TestExceedingSlopSlowly) { |
4072 // Disabled for unified GR due to subtle differences in touch slop handling. | |
4073 if (UsingUnifiedGR()) | |
4074 return; | |
4075 | |
3958 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(3); | 4076 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(3); |
3959 scoped_ptr<GestureEventConsumeDelegate> delegate( | 4077 scoped_ptr<GestureEventConsumeDelegate> delegate( |
3960 new GestureEventConsumeDelegate()); | 4078 new GestureEventConsumeDelegate()); |
3961 const int kWindowWidth = 234; | 4079 const int kWindowWidth = 234; |
3962 const int kWindowHeight = 345; | 4080 const int kWindowHeight = 345; |
3963 const int kTouchId = 5; | 4081 const int kTouchId = 5; |
3964 TimedEvents tes; | 4082 TimedEvents tes; |
3965 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); | 4083 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); |
3966 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 4084 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
3967 delegate.get(), -1234, bounds, root_window())); | 4085 delegate.get(), -1234, bounds, root_window())); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4005 ui::TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(14, 10), kTouchId, | 4123 ui::TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(14, 10), kTouchId, |
4006 tes.LeapForward(40)); | 4124 tes.LeapForward(40)); |
4007 DispatchEventUsingWindowDispatcher(&move4); | 4125 DispatchEventUsingWindowDispatcher(&move4); |
4008 EXPECT_FALSE(delegate->scroll_begin()); | 4126 EXPECT_FALSE(delegate->scroll_begin()); |
4009 EXPECT_TRUE(delegate->scroll_update()); | 4127 EXPECT_TRUE(delegate->scroll_update()); |
4010 EXPECT_EQ(1, delegate->scroll_x()); | 4128 EXPECT_EQ(1, delegate->scroll_x()); |
4011 EXPECT_EQ(0, delegate->scroll_x_hint()); | 4129 EXPECT_EQ(0, delegate->scroll_x_hint()); |
4012 delegate->Reset(); | 4130 delegate->Reset(); |
4013 } | 4131 } |
4014 | 4132 |
4015 TEST_F(GestureRecognizerTest, ScrollAlternatelyConsumedTest) { | 4133 TEST_P(GestureRecognizerTest, ScrollAlternatelyConsumedTest) { |
4016 scoped_ptr<QueueTouchEventDelegate> delegate( | 4134 scoped_ptr<QueueTouchEventDelegate> delegate( |
4017 new QueueTouchEventDelegate(host()->dispatcher())); | 4135 new QueueTouchEventDelegate(host()->dispatcher())); |
4018 TimedEvents tes; | 4136 TimedEvents tes; |
4019 const int kWindowWidth = 3000; | 4137 const int kWindowWidth = 3000; |
4020 const int kWindowHeight = 3000; | 4138 const int kWindowHeight = 3000; |
4021 const int kTouchId = 2; | 4139 const int kTouchId = 2; |
4022 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); | 4140 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); |
4023 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 4141 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
4024 delegate.get(), -1234, bounds, root_window())); | 4142 delegate.get(), -1234, bounds, root_window())); |
4025 | 4143 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4064 ui::TouchEvent move3( | 4182 ui::TouchEvent move3( |
4065 ui::ET_TOUCH_MOVED, gfx::Point(x, y), kTouchId, tes.Now()); | 4183 ui::ET_TOUCH_MOVED, gfx::Point(x, y), kTouchId, tes.Now()); |
4066 DispatchEventUsingWindowDispatcher(&move3); | 4184 DispatchEventUsingWindowDispatcher(&move3); |
4067 delegate->ReceivedAckPreventDefaulted(); | 4185 delegate->ReceivedAckPreventDefaulted(); |
4068 EXPECT_FALSE(delegate->scroll_begin()); | 4186 EXPECT_FALSE(delegate->scroll_begin()); |
4069 EXPECT_FALSE(delegate->scroll_update()); | 4187 EXPECT_FALSE(delegate->scroll_update()); |
4070 delegate->Reset(); | 4188 delegate->Reset(); |
4071 } | 4189 } |
4072 } | 4190 } |
4073 | 4191 |
4074 TEST_F(GestureRecognizerTest, PinchAlternatelyConsumedTest) { | 4192 TEST_P(GestureRecognizerTest, PinchAlternatelyConsumedTest) { |
4193 // Disabled for unified GR due to differences in when scroll update is | |
4194 // sent. The Aura GR will never send a ScrollUpdate with a ScrollBegin, but | |
4195 // the unified GR will. | |
4196 if (UsingUnifiedGR()) | |
4197 return; | |
4198 | |
4075 scoped_ptr<QueueTouchEventDelegate> delegate( | 4199 scoped_ptr<QueueTouchEventDelegate> delegate( |
4076 new QueueTouchEventDelegate(host()->dispatcher())); | 4200 new QueueTouchEventDelegate(host()->dispatcher())); |
4077 TimedEvents tes; | 4201 TimedEvents tes; |
4078 const int kWindowWidth = 3000; | 4202 const int kWindowWidth = 3000; |
4079 const int kWindowHeight = 3000; | 4203 const int kWindowHeight = 3000; |
4080 const int kTouchId1 = 5; | 4204 const int kTouchId1 = 5; |
4081 const int kTouchId2 = 7; | 4205 const int kTouchId2 = 7; |
4082 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); | 4206 gfx::Rect bounds(0, 0, kWindowWidth, kWindowHeight); |
4083 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 4207 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
4084 delegate.get(), -1234, bounds, root_window())); | 4208 delegate.get(), -1234, bounds, root_window())); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4148 EXPECT_FALSE(delegate->scroll_begin()); | 4272 EXPECT_FALSE(delegate->scroll_begin()); |
4149 EXPECT_FALSE(delegate->scroll_update()); | 4273 EXPECT_FALSE(delegate->scroll_update()); |
4150 EXPECT_FALSE(delegate->scroll_end()); | 4274 EXPECT_FALSE(delegate->scroll_end()); |
4151 EXPECT_FALSE(delegate->pinch_begin()); | 4275 EXPECT_FALSE(delegate->pinch_begin()); |
4152 EXPECT_FALSE(delegate->pinch_update()); | 4276 EXPECT_FALSE(delegate->pinch_update()); |
4153 EXPECT_FALSE(delegate->pinch_end()); | 4277 EXPECT_FALSE(delegate->pinch_end()); |
4154 delegate->Reset(); | 4278 delegate->Reset(); |
4155 } | 4279 } |
4156 } | 4280 } |
4157 | 4281 |
4282 // Test that touch event flags are passed through to the gesture event. | |
4283 TEST_P(GestureRecognizerTest, GestureEventFlagsPassedFromTouchEvent) { | |
4284 scoped_ptr<GestureEventConsumeDelegate> delegate( | |
4285 new GestureEventConsumeDelegate()); | |
4286 TimedEvents tes; | |
4287 const int kWindowWidth = 123; | |
4288 const int kWindowHeight = 45; | |
4289 const int kTouchId = 6; | |
4290 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); | |
4291 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | |
4292 delegate.get(), -1234, bounds, root_window())); | |
4293 | |
4294 delegate->Reset(); | |
4295 | |
4296 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), | |
4297 kTouchId, tes.Now()); | |
4298 DispatchEventUsingWindowDispatcher(&press1); | |
4299 EXPECT_TRUE(delegate->tap_down()); | |
4300 | |
4301 int default_flags = delegate->flags(); | |
4302 | |
4303 ui::TouchEvent move1( | |
4304 ui::ET_TOUCH_MOVED, gfx::Point(397, 149), kTouchId, tes.LeapForward(50)); | |
4305 move1.set_flags(992); | |
4306 | |
4307 DispatchEventUsingWindowDispatcher(&move1); | |
4308 EXPECT_NE(default_flags, delegate->flags()); | |
4309 } | |
4310 | |
4311 INSTANTIATE_TEST_CASE_P(GestureRecognizer, | |
4312 GestureRecognizerTest, | |
4313 ::testing::Bool()); | |
4314 | |
4158 } // namespace test | 4315 } // namespace test |
4159 } // namespace aura | 4316 } // namespace aura |
OLD | NEW |