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

Side by Side Diff: ui/events/gestures/gesture_provider_aura_unittest.cc

Issue 1907323003: Drag and drop cleans up touch sequences from the source window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mac. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/gestures/gesture_provider_aura.cc ('k') | ui/events/gestures/gesture_recognizer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/events/gestures/gesture_provider_aura.cc ('k') | ui/events/gestures/gesture_recognizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698