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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/events/event_utils.h" | 8 #include "ui/events/event_utils.h" |
9 #include "ui/events/gestures/gesture_provider_aura.h" | 9 #include "ui/events/gestures/gesture_provider_aura.h" |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 base::MessageLoopForUI message_loop_; | 30 base::MessageLoopForUI message_loop_; |
31 }; | 31 }; |
32 | 32 |
33 TEST_F(GestureProviderAuraTest, IgnoresExtraPressEvents) { | 33 TEST_F(GestureProviderAuraTest, IgnoresExtraPressEvents) { |
34 base::TimeDelta time = ui::EventTimeForNow(); | 34 base::TimeDelta time = ui::EventTimeForNow(); |
35 TouchEvent press1(ET_TOUCH_PRESSED, gfx::PointF(10, 10), 0, time); | 35 TouchEvent press1(ET_TOUCH_PRESSED, gfx::PointF(10, 10), 0, time); |
36 EXPECT_TRUE(provider()->OnTouchEvent(&press1)); | 36 EXPECT_TRUE(provider()->OnTouchEvent(&press1)); |
37 | 37 |
38 time += base::TimeDelta::FromMilliseconds(10); | 38 time += base::TimeDelta::FromMilliseconds(10); |
39 TouchEvent press2(ET_TOUCH_PRESSED, gfx::PointF(30, 40), 0, time); | 39 TouchEvent press2(ET_TOUCH_PRESSED, gfx::PointF(30, 40), 0, time); |
40 // Redundant press with same id is ignored. | 40 // FIXME(tdresser): this redundant press with same id should be |
41 EXPECT_FALSE(provider()->OnTouchEvent(&press2)); | 41 // ignored; however, there is at least one case where we need to |
| 42 // allow a touch press from a currently used touch id. See |
| 43 // crbug.com/373125 for details. |
| 44 EXPECT_TRUE(provider()->OnTouchEvent(&press2)); |
42 } | 45 } |
43 | 46 |
44 TEST_F(GestureProviderAuraTest, IgnoresExtraMoveOrReleaseEvents) { | 47 TEST_F(GestureProviderAuraTest, IgnoresExtraMoveOrReleaseEvents) { |
45 base::TimeDelta time = ui::EventTimeForNow(); | 48 base::TimeDelta time = ui::EventTimeForNow(); |
46 TouchEvent press1(ET_TOUCH_PRESSED, gfx::PointF(10, 10), 0, time); | 49 TouchEvent press1(ET_TOUCH_PRESSED, gfx::PointF(10, 10), 0, time); |
47 EXPECT_TRUE(provider()->OnTouchEvent(&press1)); | 50 EXPECT_TRUE(provider()->OnTouchEvent(&press1)); |
48 | 51 |
49 time += base::TimeDelta::FromMilliseconds(10); | 52 time += base::TimeDelta::FromMilliseconds(10); |
50 TouchEvent release1(ET_TOUCH_RELEASED, gfx::PointF(30, 40), 0, time); | 53 TouchEvent release1(ET_TOUCH_RELEASED, gfx::PointF(30, 40), 0, time); |
51 EXPECT_TRUE(provider()->OnTouchEvent(&release1)); | 54 EXPECT_TRUE(provider()->OnTouchEvent(&release1)); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 time, | 146 time, |
144 kRadiusX, | 147 kRadiusX, |
145 kRadiusY + 1, | 148 kRadiusY + 1, |
146 kAngle, | 149 kAngle, |
147 kForce); | 150 kForce); |
148 } | 151 } |
149 | 152 |
150 // TODO(jdduke): Test whether event marked as scroll trigger. | 153 // TODO(jdduke): Test whether event marked as scroll trigger. |
151 | 154 |
152 } // namespace ui | 155 } // namespace ui |
OLD | NEW |