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 84b0ced56c62e28e9d07dec63f597ffdf7cc55c1..6323b0e1a138ea4db098c73de1cee5de9753994e 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 |
| @@ -160,8 +160,29 @@ function touchScrollInTarget(targetSelector, direction) { |
| scrollPageIfNeeded(targetSelector, document); |
| var target = document.querySelector(targetSelector); |
| var targetRect = target.getBoundingClientRect(); |
| - chrome.gpuBenchmarking.smoothScrollBy(scrollOffset, resolve, |
| - targetRect.left + boundaryOffset, targetRect.top + boundaryOffset, touchSourceType, direction); |
| + var xPosition = targetRect.left + boundaryOffset; |
| + var yPosition = targetRect.top + boundaryOffset; |
| + var newXPosition = xPosition; |
| + var newYPosition = yPosition; |
| + if (direction == "down") |
| + newYPosition -= scrollOffset; |
| + else if (direction == "up") |
| + newYPosition += scrollOffset; |
| + else if (direction == "right") |
| + newXPosition -= scrollOffset; |
| + else if (direction == "left") |
| + newXPosition += scrollOffset; |
| + else |
| + return false; |
|
tdresser
2017/01/16 15:45:30
Should this throw?
lanwei
2017/01/16 19:55:04
Done.
|
| + |
| + chrome.gpuBenchmarking.pointerActionSequence( [ |
| + {"source": "touch", |
| + "actions": [ |
| + { "name": "pointerDown", "x": xPosition, "y": yPosition }, |
| + { "name": "pointerMove", "x": newXPosition, "y": newYPosition }, |
| + { "name": "pause", "duration": 0.1 }, |
| + { "name": "pointerUp" } |
| + ]}], resolve); |
| } else { |
| reject(); |
| } |
| @@ -174,9 +195,17 @@ function pinchZoomInTarget(targetSelector, scale) { |
| scrollPageIfNeeded(targetSelector, document); |
| var target = document.querySelector(targetSelector); |
| var targetRect = target.getBoundingClientRect(); |
| - chrome.gpuBenchmarking.pinchBy(scale, targetRect.left + (targetRect.width/2), targetRect.top + (targetRect.height/2), function() { |
| - resolve(); |
| - }); |
| + var xPosition = targetRect.left + (targetRect.width/2); |
| + var yPosition1 = targetRect.top + (targetRect.height/2) - 10; |
| + var yPosition2 = targetRect.top + (targetRect.height/2) + 10; |
| + var text = '[{"source": "touch", "actions": [{ "name": "pointerDown", "x":' + xPosition +', "y":' + yPosition1 +' },'; |
| + for (var offset=10; offset<80; offset+=10) |
| + text += '{ "name": "pointerMove", "x":' + xPosition +', "y":' + (yPosition1 - offset) +' },'; |
| + text += '{ "name": "pointerUp" }]}, {"source": "touch", "actions": [{ "name": "pointerDown", "x":' + xPosition +', "y":' + yPosition2 +' },'; |
| + for (var offset=10; offset<80; offset+=10) |
| + text += '{ "name": "pointerMove", "x":' + xPosition +', "y":' + (yPosition2 + offset) +' },'; |
| + text += '{ "name": "pointerUp" }]}]'; |
| + chrome.gpuBenchmarking.pointerActionSequence(JSON.parse(text), resolve); |
| } else { |
| reject(); |
| } |