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

Unified Diff: ui/events/x/events_x_unittest.cc

Issue 1026573002: Prevent TouchEvent Crash on X (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/event.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/x/events_x_unittest.cc
diff --git a/ui/events/x/events_x_unittest.cc b/ui/events/x/events_x_unittest.cc
index 103637dd0bcee83532002901091298b23d7e3877..8b604ae5579b1df32f388d2c459376f1f266a5bc 100644
--- a/ui/events/x/events_x_unittest.cc
+++ b/ui/events/x/events_x_unittest.cc
@@ -353,6 +353,26 @@ TEST_F(EventsXTest, TouchEventNotRemovingFromNativeMapping) {
EXPECT_EQ(-1, GetTouchIdForTrackingId(kTrackingId));
}
+// Copied events should not remove native touch id mappings, as this causes a
+// crash (crbug.com/467102). Copied events do not contain a proper
+// base::NativeEvent and should not attempt to access it.
+TEST_F(EventsXTest, CopiedTouchEventNotRemovingFromNativeMapping) {
+ std::vector<unsigned int> devices;
+ devices.push_back(0);
+ ui::SetUpTouchDevicesForTest(devices);
+ std::vector<Valuator> valuators;
+
+ // Create a release event which has a native touch id mapping.
+ ui::ScopedXI2Event xrelease0;
+ xrelease0.InitTouchEvent(0, XI_TouchEnd, 0, gfx::Point(10, 10), valuators);
+ ui::TouchEvent urelease0(xrelease0);
+ {
+ // When the copy is destructed it should not attempt to remove the mapping.
+ // Exiting this scope should not cause a crash.
+ ui::TouchEvent copy = urelease0;
+ }
+}
+
TEST_F(EventsXTest, NumpadKeyEvents) {
XEvent event;
Display* display = gfx::GetXDisplay();
« no previous file with comments | « ui/events/event.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698