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

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

Issue 1987343002: Drag and drop cleans up touch sequences from the source window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: 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 "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 24 matching lines...) Expand all
35 base::MessageLoopForUI message_loop_; 35 base::MessageLoopForUI message_loop_;
36 }; 36 };
37 37
38 TEST_F(GestureProviderAuraTest, IgnoresExtraPressEvents) { 38 TEST_F(GestureProviderAuraTest, IgnoresExtraPressEvents) {
39 base::TimeDelta time = ui::EventTimeForNow(); 39 base::TimeDelta time = ui::EventTimeForNow();
40 TouchEvent press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time); 40 TouchEvent press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time);
41 EXPECT_TRUE(provider()->OnTouchEvent(&press1)); 41 EXPECT_TRUE(provider()->OnTouchEvent(&press1));
42 42
43 time += base::TimeDelta::FromMilliseconds(10); 43 time += base::TimeDelta::FromMilliseconds(10);
44 TouchEvent press2(ET_TOUCH_PRESSED, gfx::Point(30, 40), 0, time); 44 TouchEvent press2(ET_TOUCH_PRESSED, gfx::Point(30, 40), 0, time);
45 // TODO(tdresser): this redundant press with same id should be 45 EXPECT_FALSE(provider()->OnTouchEvent(&press2));
46 // ignored; however, there is at least one case where we need to
47 // allow a touch press from a currently used touch id. See
48 // crbug.com/373125 for details.
49 EXPECT_TRUE(provider()->OnTouchEvent(&press2));
50 } 46 }
51 47
52 TEST_F(GestureProviderAuraTest, IgnoresExtraMoveOrReleaseEvents) { 48 TEST_F(GestureProviderAuraTest, IgnoresExtraMoveOrReleaseEvents) {
53 base::TimeDelta time = ui::EventTimeForNow(); 49 base::TimeDelta time = ui::EventTimeForNow();
54 TouchEvent press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time); 50 TouchEvent press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time);
55 EXPECT_TRUE(provider()->OnTouchEvent(&press1)); 51 EXPECT_TRUE(provider()->OnTouchEvent(&press1));
56 52
57 time += base::TimeDelta::FromMilliseconds(10); 53 time += base::TimeDelta::FromMilliseconds(10);
58 TouchEvent release1(ET_TOUCH_RELEASED, gfx::Point(30, 40), 0, time); 54 TouchEvent release1(ET_TOUCH_RELEASED, gfx::Point(30, 40), 0, time);
59 EXPECT_TRUE(provider()->OnTouchEvent(&release1)); 55 EXPECT_TRUE(provider()->OnTouchEvent(&release1));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 time += base::TimeDelta::FromMilliseconds(10); 109 time += base::TimeDelta::FromMilliseconds(10);
114 TouchEvent move0_4(ET_TOUCH_MOVED, gfx::Point(), 0, kTouchId0, time, kRadiusX, 110 TouchEvent move0_4(ET_TOUCH_MOVED, gfx::Point(), 0, kTouchId0, time, kRadiusX,
115 kRadiusY + 1, kAngle, kForce); 111 kRadiusY + 1, kAngle, kForce);
116 move0_4.set_location_f(gfx::PointF(70, 75.1f)); 112 move0_4.set_location_f(gfx::PointF(70, 75.1f));
117 move0_4.set_root_location_f(gfx::PointF(70, 75.1f)); 113 move0_4.set_root_location_f(gfx::PointF(70, 75.1f));
118 } 114 }
119 115
120 // TODO(jdduke): Test whether event marked as scroll trigger. 116 // TODO(jdduke): Test whether event marked as scroll trigger.
121 117
122 } // namespace ui 118 } // 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