Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js |
| diff --git a/third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js b/third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js |
| index f5282e15ac0e7134abbeaf11f54d16a967ed5c3a..bcad05ce7c397cdfd26171cdf9b7d4f26c70ba43 100644 |
| --- a/third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js |
| +++ b/third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js |
| @@ -58,13 +58,35 @@ function mouseScrollLeft() { |
| const scrollOffset = 30; |
| const boundaryOffset = 5; |
| const touchSourceType = 1; |
| + |
| function touchTapInTarget(targetId) { |
| - if (window.chrome && chrome.gpuBenchmarking) { |
| - var target = document.getElementById(targetId); |
| - target.scrollIntoViewIfNeeded(); |
| - var targetRect = target.getBoundingClientRect(); |
| - chrome.gpuBenchmarking.tap(targetRect.left+boundaryOffset, targetRect.top+boundaryOffset); |
| - } |
| + return new Promise(function(resolve, reject) { |
| + if (window.chrome && chrome.gpuBenchmarking) { |
| + var target = document.getElementById(targetId); |
| + target.scrollIntoViewIfNeeded(); |
| + var targetRect = target.getBoundingClientRect(); |
| + chrome.gpuBenchmarking.tap(targetRect.left + boundaryOffset, targetRect.top + boundaryOffset, function() { |
| + resolve(); |
| + }); |
| + } else { |
| + reject(); |
|
mustaq
2016/08/17 15:17:49
I think it reject the Promise if gpuBenchmarking.t
Navid Zolghadr
2016/08/17 15:24:54
I don't think we should make this distinction ther
|
| + } |
| + }); |
| +} |
| + |
| +function touchScrollInTarget(targetId, direction) { |
| + return new Promise(function(resolve, reject) { |
| + if (window.chrome && chrome.gpuBenchmarking) { |
| + var target = document.getElementById(targetId); |
| + target.scrollIntoViewIfNeeded(); |
| + var targetRect = target.getBoundingClientRect(); |
| + chrome.gpuBenchmarking.smoothScrollBy(scrollOffset, function() { |
| + resolve(); |
| + }, targetRect.left + boundaryOffset, targetRect.top + boundaryOffset, 1, direction); |
| + } else { |
| + reject(); |
| + } |
| + }); |
| } |
| function scrollPageIfNeeded(targetRect, startX, startY) { |