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

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

Issue 2126323002: Add support for touch-action: pinch-zoom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add exception for mac Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // This file contains the commonly used functions in pointerevent tests. 1 // This file contains the commonly used functions in pointerevent tests.
2 2
3 const scrollOffset = 30; 3 const scrollOffset = 30;
4 const boundaryOffset = 5; 4 const boundaryOffset = 5;
5 const touchSourceType = 1; 5 const touchSourceType = 1;
6 6
7 function delayPromise(delay) { 7 function delayPromise(delay) {
8 return new Promise(function(resolve, reject) { 8 return new Promise(function(resolve, reject) {
9 window.setTimeout(resolve, delay); 9 window.setTimeout(resolve, delay);
10 }); 10 });
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 var target = document.querySelector(targetSelector); 131 var target = document.querySelector(targetSelector);
132 var targetRect = target.getBoundingClientRect(); 132 var targetRect = target.getBoundingClientRect();
133 chrome.gpuBenchmarking.smoothScrollBy(scrollOffset, resolve, 133 chrome.gpuBenchmarking.smoothScrollBy(scrollOffset, resolve,
134 targetRect.left + boundaryOffset, targetRect.top + boundaryOffset, tou chSourceType, direction); 134 targetRect.left + boundaryOffset, targetRect.top + boundaryOffset, tou chSourceType, direction);
135 } else { 135 } else {
136 reject(); 136 reject();
137 } 137 }
138 }); 138 });
139 } 139 }
140 140
141 function pinchZoomInTarget(targetSelector, scale) {
142 return new Promise(function(resolve, reject) {
143 if (window.chrome && chrome.gpuBenchmarking) {
144 scrollPageIfNeeded(targetSelector, document);
145 var target = document.querySelector(targetSelector);
146 var targetRect = target.getBoundingClientRect();
147 chrome.gpuBenchmarking.pinchBy(scale, targetRect.left + (targetRect.width/ 2), targetRect.top + (targetRect.height/2), function() {
148 resolve();
149 });
150 } else {
151 reject();
152 }
153 });
154 }
155
141 // Pen inputs. 156 // Pen inputs.
142 function penMoveToDocument() { 157 function penMoveToDocument() {
143 return new Promise(function(resolve, reject) { 158 return new Promise(function(resolve, reject) {
144 if (window.eventSender) { 159 if (window.eventSender) {
145 eventSender.mouseMoveTo(0, 0, [], "pen", 0); 160 eventSender.mouseMoveTo(0, 0, [], "pen", 0);
146 resolve(); 161 resolve();
147 } else { 162 } else {
148 reject(); 163 reject();
149 } 164 }
150 }); 165 });
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 219 }
205 220
206 { 221 {
207 var pointerevent_automation = async_test("PointerEvent Automation"); 222 var pointerevent_automation = async_test("PointerEvent Automation");
208 // Defined in every test and should return a promise that gets resolved when i nput is finished. 223 // Defined in every test and should return a promise that gets resolved when i nput is finished.
209 inject_input().then(function() { 224 inject_input().then(function() {
210 pointerevent_automation.done(); 225 pointerevent_automation.done();
211 }); 226 });
212 } 227 }
213 228
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698