| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/events/gestures/gesture_provider_aura.h" | 5 #include "ui/events/gestures/gesture_provider_aura.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 base::MessageLoopForUI message_loop_; | 37 base::MessageLoopForUI message_loop_; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 TEST_F(GestureProviderAuraTest, IgnoresExtraPressEvents) { | 40 TEST_F(GestureProviderAuraTest, IgnoresExtraPressEvents) { |
| 41 base::TimeDelta time = ui::EventTimeForNow(); | 41 base::TimeDelta time = ui::EventTimeForNow(); |
| 42 TouchEvent press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time); | 42 TouchEvent press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time); |
| 43 EXPECT_TRUE(provider()->OnTouchEvent(&press1)); | 43 EXPECT_TRUE(provider()->OnTouchEvent(&press1)); |
| 44 | 44 |
| 45 time += base::TimeDelta::FromMilliseconds(10); | 45 time += base::TimeDelta::FromMilliseconds(10); |
| 46 TouchEvent press2(ET_TOUCH_PRESSED, gfx::Point(30, 40), 0, time); | 46 TouchEvent press2(ET_TOUCH_PRESSED, gfx::Point(30, 40), 0, time); |
| 47 // TODO(tdresser): this redundant press with same id should be | 47 EXPECT_FALSE(provider()->OnTouchEvent(&press2)); |
| 48 // ignored; however, there is at least one case where we need to | |
| 49 // allow a touch press from a currently used touch id. See | |
| 50 // crbug.com/373125 for details. | |
| 51 EXPECT_TRUE(provider()->OnTouchEvent(&press2)); | |
| 52 } | 48 } |
| 53 | 49 |
| 54 TEST_F(GestureProviderAuraTest, IgnoresExtraMoveOrReleaseEvents) { | 50 TEST_F(GestureProviderAuraTest, IgnoresExtraMoveOrReleaseEvents) { |
| 55 base::TimeDelta time = ui::EventTimeForNow(); | 51 base::TimeDelta time = ui::EventTimeForNow(); |
| 56 TouchEvent press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time); | 52 TouchEvent press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time); |
| 57 EXPECT_TRUE(provider()->OnTouchEvent(&press1)); | 53 EXPECT_TRUE(provider()->OnTouchEvent(&press1)); |
| 58 | 54 |
| 59 time += base::TimeDelta::FromMilliseconds(10); | 55 time += base::TimeDelta::FromMilliseconds(10); |
| 60 TouchEvent release1(ET_TOUCH_RELEASED, gfx::Point(30, 40), 0, time); | 56 TouchEvent release1(ET_TOUCH_RELEASED, gfx::Point(30, 40), 0, time); |
| 61 EXPECT_TRUE(provider()->OnTouchEvent(&release1)); | 57 EXPECT_TRUE(provider()->OnTouchEvent(&release1)); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 time += base::TimeDelta::FromMilliseconds(10); | 111 time += base::TimeDelta::FromMilliseconds(10); |
| 116 TouchEvent move0_4(ET_TOUCH_MOVED, gfx::Point(), 0, kTouchId0, time, kRadiusX, | 112 TouchEvent move0_4(ET_TOUCH_MOVED, gfx::Point(), 0, kTouchId0, time, kRadiusX, |
| 117 kRadiusY + 1, kAngle, kForce); | 113 kRadiusY + 1, kAngle, kForce); |
| 118 move0_4.set_location_f(gfx::PointF(70, 75.1f)); | 114 move0_4.set_location_f(gfx::PointF(70, 75.1f)); |
| 119 move0_4.set_root_location_f(gfx::PointF(70, 75.1f)); | 115 move0_4.set_root_location_f(gfx::PointF(70, 75.1f)); |
| 120 } | 116 } |
| 121 | 117 |
| 122 // TODO(jdduke): Test whether event marked as scroll trigger. | 118 // TODO(jdduke): Test whether event marked as scroll trigger. |
| 123 | 119 |
| 124 } // namespace ui | 120 } // namespace ui |
| OLD | NEW |