Skip to content

Commit 73bb54a

Browse files
watildecodebytere
authored andcommitted
test: update wpt url and resource
Refs: web-platform-tests/wpt#26317 PR-URL: #36032 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 24065b9 commit 73bb54a

12 files changed

+437
-222
lines changed

test/fixtures/wpt/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ Last update:
1212

1313
- console: https://github.com/web-platform-tests/wpt/tree/3b1f72e99a/console
1414
- encoding: https://github.com/web-platform-tests/wpt/tree/1821fb5f77/encoding
15-
- url: https://github.com/web-platform-tests/wpt/tree/54c6d64be0/url
16-
- resources: https://github.com/web-platform-tests/wpt/tree/1d14e821b9/resources
17-
- interfaces: https://github.com/web-platform-tests/wpt/tree/15e47f779c/interfaces
15+
- url: https://github.com/web-platform-tests/wpt/tree/09d8830be1/url
16+
- resources: https://github.com/web-platform-tests/wpt/tree/001e50de41/resources
17+
- interfaces: https://github.com/web-platform-tests/wpt/tree/8719553b2d/interfaces
1818
- html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/2c5c3c4c27/html/webappapis/microtask-queuing
1919
- html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/264f12bc7b/html/webappapis/timers
2020
- hr-time: https://github.com/web-platform-tests/wpt/tree/a5d1774ecf/hr-time

test/fixtures/wpt/interfaces/html.idl

+21-5
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@ interface HTMLIFrameElement : HTMLElement {
436436
[SameObject, PutForwards=value] readonly attribute DOMTokenList sandbox;
437437
[CEReactions] attribute DOMString allow;
438438
[CEReactions] attribute boolean allowFullscreen;
439-
[CEReactions] attribute boolean allowPaymentRequest;
440439
[CEReactions] attribute DOMString width;
441440
[CEReactions] attribute DOMString height;
442441
[CEReactions] attribute DOMString referrerPolicy;
@@ -1564,16 +1563,18 @@ dictionary ElementDefinitionOptions {
15641563

15651564
[Exposed=Window]
15661565
interface ElementInternals {
1567-
// Form-associated custom elements
1566+
// Shadow root access
1567+
readonly attribute ShadowRoot? shadowRoot;
15681568

1569+
// Form-associated custom elements
15691570
undefined setFormValue((File or USVString or FormData)? value,
1570-
optional (File or USVString or FormData)? state);
1571+
optional (File or USVString or FormData)? state);
15711572

15721573
readonly attribute HTMLFormElement? form;
15731574

15741575
undefined setValidity(optional ValidityStateFlags flags = {},
1575-
optional DOMString message,
1576-
optional HTMLElement anchor);
1576+
optional DOMString message,
1577+
optional HTMLElement anchor);
15771578
readonly attribute boolean willValidate;
15781579
readonly attribute ValidityState validity;
15791580
readonly attribute DOMString validationMessage;
@@ -1583,6 +1584,9 @@ interface ElementInternals {
15831584
readonly attribute NodeList labels;
15841585
};
15851586

1587+
// Accessibility semantics
1588+
ElementInternals includes ARIAMixin;
1589+
15861590
dictionary ValidityStateFlags {
15871591
boolean valueMissing = false;
15881592
boolean typeMismatch = false;
@@ -2353,6 +2357,18 @@ interface WorkerLocation {
23532357
readonly attribute USVString hash;
23542358
};
23552359

2360+
[Exposed=Worklet, SecureContext]
2361+
interface WorkletGlobalScope {};
2362+
2363+
[Exposed=Window, SecureContext]
2364+
interface Worklet {
2365+
[NewObject] Promise<undefined> addModule(USVString moduleURL, optional WorkletOptions options = {});
2366+
};
2367+
2368+
dictionary WorkletOptions {
2369+
RequestCredentials credentials = "same-origin";
2370+
};
2371+
23562372
[Exposed=Window]
23572373
interface Storage {
23582374
readonly attribute unsigned long length;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* Whether the browser is Chromium-based with MojoJS enabled */
2+
export const isChromiumBased = 'MojoInterfaceInterceptor' in self;
3+
4+
/* Whether the browser is WebKit-based with internal test-only API enabled */
5+
export const isWebKitBased = !isChromiumBased && 'internals' in self;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Content-Type: text/javascript; charset=utf-8
2+
Cache-Control: max-age=3600

test/fixtures/wpt/resources/testdriver-actions.js

+105-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
function Actions(defaultTickDuration=16) {
1010
this.sourceTypes = new Map([["key", KeySource],
1111
["pointer", PointerSource],
12+
["wheel", WheelSource],
1213
["none", GeneralSource]]);
1314
this.sources = new Map();
1415
this.sourceOrder = [];
@@ -22,6 +23,7 @@
2223
this.createSource("none");
2324
this.tickIdx = 0;
2425
this.defaultTickDuration = defaultTickDuration;
26+
this.context = null;
2527
}
2628

2729
Actions.prototype = {
@@ -65,15 +67,25 @@
6567
} catch(e) {
6668
return Promise.reject(e);
6769
}
68-
return test_driver.action_sequence(actions);
70+
return test_driver.action_sequence(actions, this.context);
71+
},
72+
73+
/**
74+
* Set the context for the actions
75+
*
76+
* @param {WindowProxy} context - Context in which to run the action sequence
77+
*/
78+
setContext: function(context) {
79+
this.context = context;
80+
return this;
6981
},
7082

7183
/**
7284
* Get the action source with a particular source type and name.
7385
* If no name is passed, a new source with the given type is
7486
* created.
7587
*
76-
* @param {String} type - Source type ('none', 'key', or 'pointer')
88+
* @param {String} type - Source type ('none', 'key', 'pointer', or 'wheel')
7789
* @param {String?} name - Name of the source
7890
* @returns {Source} Source object for that source.
7991
*/
@@ -154,6 +166,32 @@
154166
return this;
155167
},
156168

169+
/**
170+
* Add a new wheel input source with the given name
171+
*
172+
* @param {String} type - Name of the wheel source
173+
* @param {Bool} set - Set source as the default wheel source
174+
* @returns {Actions}
175+
*/
176+
addWheel: function(name, set=true) {
177+
this.createSource("wheel", name);
178+
if (set) {
179+
this.setWheel(name);
180+
}
181+
return this;
182+
},
183+
184+
/**
185+
* Set the current default wheel source
186+
*
187+
* @param {String} name - Name of the wheel source
188+
* @returns {Actions}
189+
*/
190+
setWheel: function(name) {
191+
this.setSource("wheel", name);
192+
return this;
193+
},
194+
157195
createSource: function(type, name, parameters={}) {
158196
if (!this.sources.has(type)) {
159197
throw new Error(`${type} is not a valid action type`);
@@ -196,8 +234,9 @@
196234
*
197235
* @param {Number?} duration - Minimum length of the tick in ms.
198236
* @param {String} sourceType - source type
199-
* @param {String?} sourceName - Named key or pointer source to use or null for the default
200-
* key or pointer source
237+
* @param {String?} sourceName - Named key, pointer or wheel source to use
238+
* or null for the default key, pointer or
239+
* wheel source
201240
* @returns {Actions}
202241
*/
203242
pause: function(duration=0, sourceType="none", {sourceName=null}={}) {
@@ -280,6 +319,27 @@
280319
source.pointerMove(this, x, y, duration, origin);
281320
return this;
282321
},
322+
323+
/**
324+
* Create a scroll event for the current default wheel source
325+
*
326+
* @param {Number} x - mouse cursor x coordinate
327+
* @param {Number} y - mouse cursor y coordinate
328+
* @param {Number} deltaX - scroll delta value along the x-axis in pixels
329+
* @param {Number} deltaY - scroll delta value along the y-axis in pixels
330+
* @param {String|Element} origin - Origin of the coordinate system.
331+
* Either "viewport" or an Element
332+
* @param {Number?} duration - Time in ms for the scroll
333+
* @param {String?} sourceName - Named wheel source to use or null for the
334+
* default wheel source
335+
* @returns {Actions}
336+
*/
337+
scroll: function(x, y, deltaX, deltaY,
338+
{origin="viewport", duration, sourceName=null}={}) {
339+
let source = this.getSource("wheel", sourceName);
340+
source.scroll(this, x, y, deltaX, deltaY, duration, origin);
341+
return this;
342+
},
283343
};
284344

285345
function GeneralSource() {
@@ -417,5 +477,46 @@
417477
},
418478
};
419479

480+
function WheelSource() {
481+
this.actions = new Map();
482+
}
483+
484+
WheelSource.prototype = {
485+
serialize: function(tickCount) {
486+
if (!this.actions.size) {
487+
return undefined;
488+
}
489+
let actions = [];
490+
let data = {"type": "wheel", "actions": actions};
491+
for (let i=0; i<tickCount; i++) {
492+
if (this.actions.has(i)) {
493+
actions.push(this.actions.get(i));
494+
} else {
495+
actions.push({"type": "pause"});
496+
}
497+
}
498+
return data;
499+
},
500+
501+
scroll: function(actions, x, y, deltaX, deltaY, duration, origin) {
502+
let tick = actions.tickIdx;
503+
if (this.actions.has(tick)) {
504+
tick = actions.addTick().tickIdx;
505+
}
506+
this.actions.set(tick, {type: "scroll", x, y, deltaX, deltaY, origin});
507+
if (duration) {
508+
this.actions.get(tick).duration = duration;
509+
}
510+
},
511+
512+
addPause: function(actions, duration) {
513+
let tick = actions.tickIdx;
514+
if (this.actions.has(tick)) {
515+
tick = actions.addTick().tickIdx;
516+
}
517+
this.actions.set(tick, {type: "pause", duration: duration});
518+
},
519+
};
520+
420521
test_driver.Actions = Actions;
421522
})();

0 commit comments

Comments
 (0)