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

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: 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 var events = [
34 {
35 'type': 'touchStart',
36 'touchPoints': [
37 {
38 'state': 'touchPressed',
39 'x': 100,
40 'y': 200
41 }
42 ]
43 },
44 {
45 'type': 'touchMove',
46 'touchPoints': [
47 {
48 'state': 'touchMoved',
49 'x': 100,
50 'y': 200
51 }
52 ]
53 },
54 {
55 'type': 'touchEnd',
56 'touchPoints': [
57 {
58 'state': 'touchReleased',
59 'x': 100,
60 'y': 200
61 }
62 ]
63 },
64 {
65 'type': 'touchStart',
66 'touchPoints': [
67 {
68 'state': 'touchPressed',
69 'x': 20,
70 'y': 30,
71 'id': 0
72 },
73 {
74 'state': 'touchPressed',
75 'x': 100,
76 'y': 200,
77 'radiusX': 5,
78 'radiusY': 6,
79 'rotationAngle': 1.0,
80 'force': 0.0,
81 'id': 1
82 }
83 ],
84 'modifiers': 8 // shift
85 },
86 {
87 'type': 'touchEnd',
88 'touchPoints': [
89 {
90 'state': 'touchReleased',
91 'x': 100,
92 'y': 100,
93 'id': 0
94 },
95 {
96 'state': 'touchReleased',
97 'x': 100,
98 'y': 200,
99 'id': 1
100 }
101 ]
102 }
103 ];
104
105 for (var event of events) {
106 var msg = await dp.Input.dispatchTouchEvent(event);
107 if (msg.error)
108 testRunner.log('Error: ' + msg.error.message);
109 }
110
111 testRunner.log(await session.evaluate(`window.logs.join('\\n')`));
112 testRunner.completeTest();
113 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698