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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp

Issue 1654653002: Canvas2d: Implement rerouting event by hit region's control. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bot errors Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 p1.id = 2; 111 p1.id = 2;
112 p0.screenPosition = WebFloatPoint(100.f, 50.f); 112 p0.screenPosition = WebFloatPoint(100.f, 50.f);
113 p1.screenPosition = WebFloatPoint(150.f, 25.f); 113 p1.screenPosition = WebFloatPoint(150.f, 25.f);
114 p0.position = WebFloatPoint(10.f, 10.f); 114 p0.position = WebFloatPoint(10.f, 10.f);
115 p1.position = WebFloatPoint(5.f, 5.f); 115 p1.position = WebFloatPoint(5.f, 5.f);
116 p0.radiusX = p1.radiusY = 10.f; 116 p0.radiusX = p1.radiusY = 10.f;
117 p0.radiusY = p1.radiusX = 5.f; 117 p0.radiusY = p1.radiusX = 5.f;
118 p0.rotationAngle = p1.rotationAngle = 1.f; 118 p0.rotationAngle = p1.rotationAngle = 1.f;
119 p0.force = p1.force = 25.f; 119 p0.force = p1.force = 25.f;
120 120
121 RefPtrWillBeRawPtr<Touch> touch0 = Touch::create(toLocalFrame(webViewImpl->p age()->mainFrame()), document.get(), p0.id, p0.screenPosition, p0.position, Floa tSize(p0.radiusX, p0.radiusY), p0.rotationAngle, p0.force); 121 RefPtrWillBeRawPtr<Touch> touch0 = Touch::create(toLocalFrame(webViewImpl->p age()->mainFrame()), document.get(), p0.id, p0.screenPosition, p0.position, Floa tSize(p0.radiusX, p0.radiusY), p0.rotationAngle, p0.force, String());
122 RefPtrWillBeRawPtr<Touch> touch1 = Touch::create(toLocalFrame(webViewImpl->p age()->mainFrame()), document.get(), p1.id, p1.screenPosition, p1.position, Floa tSize(p1.radiusX, p1.radiusY), p1.rotationAngle, p1.force); 122 RefPtrWillBeRawPtr<Touch> touch1 = Touch::create(toLocalFrame(webViewImpl->p age()->mainFrame()), document.get(), p1.id, p1.screenPosition, p1.position, Floa tSize(p1.radiusX, p1.radiusY), p1.rotationAngle, p1.force, String());
123 123
124 // Test touchstart. 124 // Test touchstart.
125 { 125 {
126 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); 126 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create();
127 touchList->append(touch0); 127 touchList->append(touch0);
128 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList .get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow, PlatformEvent::NoModifiers, false, false, 0); 128 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList .get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow, PlatformEvent::NoModifiers, false, false, 0);
129 129
130 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); 130 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent);
131 ASSERT_EQ(1u, webTouchBuilder.touchesLength); 131 ASSERT_EQ(1u, webTouchBuilder.touchesLength);
132 EXPECT_EQ(WebInputEvent::TouchStart, webTouchBuilder.type); 132 EXPECT_EQ(WebInputEvent::TouchStart, webTouchBuilder.type);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[1].stat e); 209 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[1].stat e);
210 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); 210 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id);
211 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); 211 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id);
212 } 212 }
213 213
214 // Test max point limit. 214 // Test max point limit.
215 { 215 {
216 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); 216 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create();
217 RefPtrWillBeRawPtr<TouchList> changedTouchList = TouchList::create(); 217 RefPtrWillBeRawPtr<TouchList> changedTouchList = TouchList::create();
218 for (int i = 0; i <= static_cast<int>(WebTouchEvent::touchesLengthCap) * 2; ++i) { 218 for (int i = 0; i <= static_cast<int>(WebTouchEvent::touchesLengthCap) * 2; ++i) {
219 RefPtrWillBeRawPtr<Touch> touch = Touch::create(toLocalFrame(webView Impl->page()->mainFrame()), document.get(), i, p0.screenPosition, p0.position, F loatSize(p0.radiusX, p0.radiusY), p0.rotationAngle, p0.force); 219 RefPtrWillBeRawPtr<Touch> touch = Touch::create(toLocalFrame(webView Impl->page()->mainFrame()), document.get(), i, p0.screenPosition, p0.position, F loatSize(p0.radiusX, p0.radiusY), p0.rotationAngle, p0.force, String());
220 touchList->append(touch); 220 touchList->append(touch);
221 changedTouchList->append(touch); 221 changedTouchList->append(touch);
222 } 222 }
223 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList .get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow, PlatformEvent::NoModifiers, false, false, 0); 223 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList .get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow, PlatformEvent::NoModifiers, false, false, 0);
224 224
225 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); 225 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent);
226 ASSERT_EQ(static_cast<unsigned>(WebTouchEvent::touchesLengthCap), webTou chBuilder.touchesLength); 226 ASSERT_EQ(static_cast<unsigned>(WebTouchEvent::touchesLengthCap), webTou chBuilder.touchesLength);
227 } 227 }
228 } 228 }
229 229
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 EXPECT_EQ(30, webGestureBuilder.data.scrollUpdate.deltaX); 457 EXPECT_EQ(30, webGestureBuilder.data.scrollUpdate.deltaX);
458 EXPECT_EQ(32, webGestureBuilder.data.scrollUpdate.deltaY); 458 EXPECT_EQ(32, webGestureBuilder.data.scrollUpdate.deltaY);
459 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityX); 459 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityX);
460 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityY); 460 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityY);
461 EXPECT_TRUE(webGestureBuilder.data.scrollUpdate.inertial); 461 EXPECT_TRUE(webGestureBuilder.data.scrollUpdate.inertial);
462 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.preventPropagation); 462 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.preventPropagation);
463 EXPECT_EQ(WebGestureDeviceTouchscreen, webGestureBuilder.sourceDevice); 463 EXPECT_EQ(WebGestureDeviceTouchscreen, webGestureBuilder.sourceDevice);
464 } 464 }
465 465
466 { 466 {
467 RefPtrWillBeRawPtr<Touch> touch = Touch::create(toLocalFrame(webViewImpl ->page()->mainFrame()), document.get(), 0, FloatPoint(10, 9.5), FloatPoint(3.5, 2), FloatSize(4, 4.5), 0, 0); 467 RefPtrWillBeRawPtr<Touch> touch = Touch::create(toLocalFrame(webViewImpl ->page()->mainFrame()), document.get(), 0, FloatPoint(10, 9.5), FloatPoint(3.5, 2), FloatSize(4, 4.5), 0, 0, String());
468 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); 468 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create();
469 touchList->append(touch); 469 touchList->append(touch);
470 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList .get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow, PlatformEvent::NoModifiers, false, false, 0); 470 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList .get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow, PlatformEvent::NoModifiers, false, false, 0);
471 471
472 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); 472 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent);
473 ASSERT_EQ(1u, webTouchBuilder.touchesLength); 473 ASSERT_EQ(1u, webTouchBuilder.touchesLength);
474 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); 474 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x);
475 EXPECT_FLOAT_EQ(9.5, webTouchBuilder.touches[0].screenPosition.y); 475 EXPECT_FLOAT_EQ(9.5, webTouchBuilder.touches[0].screenPosition.y);
476 EXPECT_FLOAT_EQ(3.5, webTouchBuilder.touches[0].position.x); 476 EXPECT_FLOAT_EQ(3.5, webTouchBuilder.touches[0].position.x);
477 EXPECT_FLOAT_EQ(2, webTouchBuilder.touches[0].position.y); 477 EXPECT_FLOAT_EQ(2, webTouchBuilder.touches[0].position.y);
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 EXPECT_EQ(15, platformWheelBuilder.deltaX()); 987 EXPECT_EQ(15, platformWheelBuilder.deltaX());
988 EXPECT_EQ(10, platformWheelBuilder.deltaY()); 988 EXPECT_EQ(10, platformWheelBuilder.deltaY());
989 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.getModifiers()); 989 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.getModifiers());
990 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); 990 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas());
991 EXPECT_FALSE(platformWheelBuilder.canScroll()); 991 EXPECT_FALSE(platformWheelBuilder.canScroll());
992 EXPECT_EQ(platformWheelBuilder.getRailsMode(), PlatformEvent::RailsModeV ertical); 992 EXPECT_EQ(platformWheelBuilder.getRailsMode(), PlatformEvent::RailsModeV ertical);
993 } 993 }
994 } 994 }
995 995
996 } // namespace blink 996 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698