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

Side by Side 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: minor fixes Created 3 years, 5 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
(Empty)
1 (async function(testRunner) {
2 let {page, session, dp} = await testRunner.startBlank(``);
3
4 await session.evaluate(`
5 var logs = [];
6 function log(text) {
7 logs.push(text);
8 }
9
10 function logEvent(event) {
11 log('-----Event-----');
12 log('type: ' + event.type);
13 if (event.shiftKey)
14 log('shiftKey');
15 log('----Touches----');
16 for (var i = 0; i < event.touches.length; i++) {
17 var touch = event.touches[i];
18 log('id: ' + i);
19 log('pageX: ' + touch.pageX);
20 log('pageY: ' + touch.pageY);
21 log('radiusX: ' + touch.radiusX);
22 log('radiusY: ' + touch.radiusY);
23 log('rotationAngle: ' + touch.rotationAngle);
24 log('force: ' + touch.force);
25 }
26 }
27
28 window.addEventListener('touchstart', logEvent);
29 window.addEventListener('touchend', logEvent);
30 window.addEventListener('touchmove', logEvent);
31 `);
32
33 function dumpError(message) {
34 if (message.error)
35 testRunner.log('Error: ' + message.error.message);
36 }
37
38 dumpError(await dp.Input.dispatchTouchEvent({
39 type: 'touchStart',
40 touchPoints: [{
41 state: 'touchPressed',
42 x: 100,
43 y: 200
44 }]
45 }));
46 dumpError(await dp.Input.dispatchTouchEvent({
47 type: 'touchMove',
48 touchPoints: [{
49 state: 'touchMoved',
50 x: 100,
51 y: 200
52 }]
53 }));
54 dumpError(await dp.Input.dispatchTouchEvent({
55 type: 'touchEnd',
56 touchPoints: [{
57 state: 'touchReleased',
58 x: 100,
59 y: 200
60 }]
61 }));
62 dumpError(await dp.Input.dispatchTouchEvent({
63 type: 'touchStart',
64 touchPoints: [{
65 state: 'touchPressed',
66 x: 20,
67 y: 30,
68 id: 0
69 }, {
70 state: 'touchPressed',
71 x: 100,
72 y: 200,
73 radiusX: 5,
74 radiusY: 6,
75 rotationAngle: 1.0,
76 force: 0.0,
77 id: 1
78 }],
79 modifiers: 8 // shift
80 }));
81 dumpError(await dp.Input.dispatchTouchEvent({
82 type: 'touchEnd',
83 touchPoints: [{
84 state: 'touchReleased',
85 x: 100,
86 y: 100,
87 id: 0
88 }, {
89 state: 'touchReleased',
90 x: 100,
91 y: 200,
92 id: 1
93 }]
94 }));
95
96 testRunner.log(await session.evaluate(`window.logs.join('\\n')`));
97 testRunner.completeTest();
98 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698