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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js

Issue 2252683002: Add promise to pointerevent wpt automations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/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) {

Powered by Google App Engine
This is Rietveld 408576698