Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js |
| diff --git a/third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js b/third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js |
| index b738cb6fb92c016f07ec07d8b29ecbf7fc972334..cf142e878c627a101a4a43a62728a949f5a2118f 100644 |
| --- a/third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js |
| +++ b/third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js |
| @@ -193,6 +193,41 @@ function mouseWheelScroll(targetSelector, direction) { |
| }); |
| } |
| +// Request a pointer lock and capture. |
| +function mouseRequestPointerLockAndCaptureInTarget(targetSelector, targetFrame) { |
| + var targetDocument = document; |
| + var frameLeft = 0; |
| + var frameTop = 0; |
| + var button = 'left'; |
| + if (targetFrame !== undefined) { |
| + targetDocument = targetFrame.contentDocument; |
| + var frameRect = targetFrame.getBoundingClientRect(); |
| + frameLeft = frameRect.left; |
| + frameTop = frameRect.top; |
| + } |
| + return new Promise(function(resolve, reject) { |
| + if (window.chrome && chrome.gpuBenchmarking) { |
| + scrollPageIfNeeded(targetSelector, targetDocument); |
| + var target = targetDocument.querySelector(targetSelector); |
| + var targetRect = target.getBoundingClientRect(); |
| + var xPosition = frameLeft + targetRect.left + boundaryOffset; |
| + var yPosition = frameTop + targetRect.top + boundaryOffset; |
| + |
| + chrome.gpuBenchmarking.pointerActionSequence( [ |
| + {source: 'mouse', |
| + actions: [ |
| + {name: 'pointerMove', x: xPosition, y: yPosition}, |
| + {name: 'pointerDown', x: xPosition, y: yPosition, button: 'left'}, |
|
Navid Zolghadr
2017/05/17 16:30:10
Can you add a little move after the left pressed a
lanwei
2017/05/19 15:05:00
Done.
|
| + {name: 'pause', duration: 0.1}, |
| + {name: 'pointerDown', x: xPosition, y: yPosition, button: 'middle'}, |
| + {name: 'pointerMove', x: xPosition + 30, y: yPosition + 30}, |
| + ]}], resolve); |
| + } else { |
| + reject(); |
| + } |
| + }); |
| +} |
| + |
| // Touch inputs. |
| function touchTapInTarget(targetSelector, targetFrame) { |
| var targetDocument = document; |