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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/input/dispatchTouchEvent.js

Issue 2961493002: [DevTools] Migrate inspector-protocol/{input,network} tests to new harness (Closed)
Patch Set: Created 3 years, 6 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/inspector-protocol/input/dispatchTouchEvent.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/input/dispatchTouchEvent.js b/third_party/WebKit/LayoutTests/inspector-protocol/input/dispatchTouchEvent.js
new file mode 100644
index 0000000000000000000000000000000000000000..45c5731b9cab9ce477298449c5b5f67650c7479b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/input/dispatchTouchEvent.js
@@ -0,0 +1,113 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank(``);
+
+ await session.evaluate(`
+ var logs = [];
+ function log(text) {
+ logs.push(text);
+ }
+
+ function logEvent(event) {
+ log('-----Event-----');
+ log('type: ' + event.type);
+ if (event.shiftKey)
+ log('shiftKey');
+ log('----Touches----');
+ for (var i = 0; i < event.touches.length; i++) {
+ var touch = event.touches[i];
+ log('id: ' + i);
+ log('pageX: ' + touch.pageX);
+ log('pageY: ' + touch.pageY);
+ log('radiusX: ' + touch.radiusX);
+ log('radiusY: ' + touch.radiusY);
+ log('rotationAngle: ' + touch.rotationAngle);
+ log('force: ' + touch.force);
+ }
+ }
+
+ window.addEventListener('touchstart', logEvent);
+ window.addEventListener('touchend', logEvent);
+ window.addEventListener('touchmove', logEvent);
+ `);
+
+ var events = [
+ {
+ 'type': 'touchStart',
+ 'touchPoints': [
+ {
+ 'state': 'touchPressed',
+ 'x': 100,
+ 'y': 200
+ }
+ ]
+ },
+ {
+ 'type': 'touchMove',
+ 'touchPoints': [
+ {
+ 'state': 'touchMoved',
+ 'x': 100,
+ 'y': 200
+ }
+ ]
+ },
+ {
+ 'type': 'touchEnd',
+ 'touchPoints': [
+ {
+ 'state': 'touchReleased',
+ 'x': 100,
+ 'y': 200
+ }
+ ]
+ },
+ {
+ 'type': 'touchStart',
+ 'touchPoints': [
+ {
+ 'state': 'touchPressed',
+ 'x': 20,
+ 'y': 30,
+ 'id': 0
+ },
+ {
+ 'state': 'touchPressed',
+ 'x': 100,
+ 'y': 200,
+ 'radiusX': 5,
+ 'radiusY': 6,
+ 'rotationAngle': 1.0,
+ 'force': 0.0,
+ 'id': 1
+ }
+ ],
+ 'modifiers': 8 // shift
+ },
+ {
+ 'type': 'touchEnd',
+ 'touchPoints': [
+ {
+ 'state': 'touchReleased',
+ 'x': 100,
+ 'y': 100,
+ 'id': 0
+ },
+ {
+ 'state': 'touchReleased',
+ 'x': 100,
+ 'y': 200,
+ 'id': 1
+ }
+ ]
+ }
+ ];
+
+ for (var event of events) {
+ var msg = await dp.Input.dispatchTouchEvent(event);
+ if (msg.error)
+ testRunner.log('Error: ' + msg.error.message);
+ }
+
+ testRunner.log(await session.evaluate(`window.logs.join('\\n')`));
+ testRunner.completeTest();
+})

Powered by Google App Engine
This is Rietveld 408576698