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

Unified Diff: third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp

Issue 2860663006: Remove WebTouchEvent from TouchEventManager APIs (Closed)
Patch Set: Fix more tests Created 3 years, 6 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
Index: third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp b/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
index b93512a7c4a01ecc754057aefb8ec3b9b54b5b10..cb16f99a9bb5ca9df07b7d390b1b5c0ffeb5994c 100644
--- a/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
@@ -644,11 +644,26 @@ TEST_F(WebPluginContainerTest, TouchEventScrolledWithCoalescedTouches) {
->Plugin();
EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin);
- WebTouchEvent event(WebInputEvent::kTouchStart, WebInputEvent::kNoModifiers,
+ {
+ WebTouchEvent event(WebInputEvent::kTouchStart, WebInputEvent::kNoModifiers,
mustaq 2017/06/08 20:02:52 Clarification question: why do we need this?
Navid Zolghadr 2017/06/08 21:18:41 Out code never expects to receive a move coalesced
+ WebInputEvent::kTimeStampForTesting);
+ WebRect rect = plugin_container_one_element.BoundsInViewport();
+ event.touches_length = 1;
+ event.touches[0].state = WebTouchPoint::kStatePressed;
+ event.touches[0].SetPositionInWidget(rect.x + rect.width / 2,
+ rect.y + rect.height / 2);
+
+ WebCoalescedInputEvent coalesced_event(event);
+
+ web_view->HandleInputEvent(coalesced_event);
+ RunPendingTasks();
+ }
+
+ WebTouchEvent event(WebInputEvent::kTouchMove, WebInputEvent::kNoModifiers,
WebInputEvent::kTimeStampForTesting);
WebRect rect = plugin_container_one_element.BoundsInViewport();
event.touches_length = 1;
- event.touches[0].state = WebTouchPoint::kStatePressed;
+ event.touches[0].state = WebTouchPoint::kStateMoved;
event.touches[0].SetPositionInWidget(rect.x + rect.width / 2,
rect.y + rect.height / 2);
@@ -657,7 +672,7 @@ TEST_F(WebPluginContainerTest, TouchEventScrolledWithCoalescedTouches) {
WebTouchEvent c_event(WebInputEvent::kTouchMove, WebInputEvent::kNoModifiers,
WebInputEvent::kTimeStampForTesting);
c_event.touches_length = 1;
- c_event.touches[0].state = WebTouchPoint::kStatePressed;
+ c_event.touches[0].state = WebTouchPoint::kStateMoved;
c_event.touches[0].SetPositionInWidget(rect.x + rect.width / 2 + 1,
rect.y + rect.height / 2 + 1);
@@ -669,9 +684,9 @@ TEST_F(WebPluginContainerTest, TouchEventScrolledWithCoalescedTouches) {
web_view->HandleInputEvent(coalesced_event);
RunPendingTasks();
- EXPECT_EQ(static_cast<const size_t>(3),
+ EXPECT_EQ(static_cast<const size_t>(2),
test_plugin->GetCoalescedEventCount());
- EXPECT_EQ(WebInputEvent::kTouchStart, test_plugin->GetLastInputEventType());
+ EXPECT_EQ(WebInputEvent::kTouchMove, test_plugin->GetLastInputEventType());
EXPECT_EQ(rect.width / 2, test_plugin->GetLastEventLocation().X());
EXPECT_EQ(rect.height / 2, test_plugin->GetLastEventLocation().Y());
}

Powered by Google App Engine
This is Rietveld 408576698