Commit 391665de authored by Lan Wei's avatar Lan Wei Committed by Commit Bot

[Chromedriver] Fix a flaky test testActionsMultiTouchPoint

testActionsMultiTouchPoint is flaky, I change the test to listen to
touch events instead of pointer events. We should received two touch
start and two touch end events.

Bug: 999982, 1011225
Change-Id: I5310f42b347d6376cd976f58ae5a33c2e5c3042c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1841760
Commit-Queue: Lan Wei <lanwei@chromium.org>
Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703318}
parent 23748e60
......@@ -78,8 +78,6 @@ _NEGATIVE_FILTER = [
'ChromeDriverTest.testAlertOnNewWindow',
# https://bugs.chromium.org/p/chromedriver/issues/detail?id=2532
'ChromeDriverPageLoadTimeoutTest.testRefreshWithPageLoadTimeout',
# https://bugs.chromium.org/p/chromium/issues/detail?id=1011225
'ChromeDriverTest.testActionsMultiTouchPoint',
]
......@@ -953,15 +951,18 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer):
'document.body.innerHTML = "<div>old</div>";'
'var div = document.getElementsByTagName("div")[0];'
'window.events = [];'
'var touch_point_count = 0;'
'div.style["width"] = "100px";'
'div.style["height"] = "100px";'
'div.addEventListener("pointerdown", function() {'
' touch_point_count++;'
'div.addEventListener("touchstart", function(e) {'
' window.events.push('
' {x: event.clientX, y: event.clientY});'
' {type: e.type,'
' x: e.touches[e.touches.length - 1].clientX,'
' y: e.touches[e.touches.length - 1].clientY});'
'});'
'return div;')
'div.addEventListener("touchend", function(e) {'
' window.events.push('
' {type: e.type});'
'});')
actions = ({"actions": [{
"type":"pointer",
"actions":[{"type": "pointerMove", "x": 10, "y": 10},
......@@ -978,7 +979,11 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer):
"id": "pointer2"}]})
self._driver.PerformActions(actions)
events = self._driver.ExecuteScript('return window.events')
self.assertEquals(2, len(events))
self.assertEquals(4, len(events))
self.assertEquals("touchstart", events[0]['type'])
self.assertEquals("touchstart", events[1]['type'])
self.assertEquals("touchend", events[2]['type'])
self.assertEquals("touchend", events[3]['type'])
self.assertEquals(10, events[0]['x'])
self.assertEquals(10, events[0]['y'])
self.assertEquals(15, events[1]['x'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment