Skip to content

Commit a7f743f

Browse files
watildedanielleadams
authored andcommitted
test: update wpt resources
Refs: web-platform-tests/wpt#26824 PR-URL: #36659 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 4acc273 commit a7f743f

File tree

5 files changed

+94
-27
lines changed

5 files changed

+94
-27
lines changed

test/fixtures/wpt/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Last update:
1313
- console: https://github.com/web-platform-tests/wpt/tree/3b1f72e99a/console
1414
- encoding: https://github.com/web-platform-tests/wpt/tree/3c9820d1cc/encoding
1515
- url: https://github.com/web-platform-tests/wpt/tree/1783c9bccf/url
16-
- resources: https://github.com/web-platform-tests/wpt/tree/001e50de41/resources
16+
- resources: https://github.com/web-platform-tests/wpt/tree/351a99782b/resources
1717
- 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

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

+57-9
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,12 @@
281281
* pointer source
282282
* @returns {Actions}
283283
*/
284-
pointerDown: function({button=this.ButtonType.LEFT, sourceName=null}={}) {
284+
pointerDown: function({button=this.ButtonType.LEFT, sourceName=null,
285+
width, height, pressure, tangentialPressure,
286+
tiltX, tiltY, twist, altitudeAngle, azimuthAngle}={}) {
285287
let source = this.getSource("pointer", sourceName);
286-
source.pointerDown(this, button);
288+
source.pointerDown(this, button, width, height, pressure, tangentialPressure,
289+
tiltX, tiltY, twist, altitudeAngle, azimuthAngle);
287290
return this;
288291
},
289292

@@ -314,9 +317,13 @@
314317
* @returns {Actions}
315318
*/
316319
pointerMove: function(x, y,
317-
{origin="viewport", duration, sourceName=null}={}) {
320+
{origin="viewport", duration, sourceName=null,
321+
width, height, pressure, tangentialPressure,
322+
tiltX, tiltY, twist, altitudeAngle, azimuthAngle}={}) {
318323
let source = this.getSource("pointer", sourceName);
319-
source.pointerMove(this, x, y, duration, origin);
324+
source.pointerMove(this, x, y, duration, origin, width, height, pressure,
325+
tangentialPressure, tiltX, tiltY, twist, altitudeAngle,
326+
azimuthAngle);
320327
return this;
321328
},
322329

@@ -424,6 +431,38 @@
424431
this.actions = new Map();
425432
}
426433

434+
function setPointerProperties(action, width, height, pressure, tangentialPressure,
435+
tiltX, tiltY, twist, altitudeAngle, azimuthAngle) {
436+
if (width) {
437+
action.width = width;
438+
}
439+
if (height) {
440+
action.height = height;
441+
}
442+
if (pressure) {
443+
action.pressure = pressure;
444+
}
445+
if (tangentialPressure) {
446+
action.tangentialPressure = tangentialPressure;
447+
}
448+
if (tiltX) {
449+
action.tiltX = tiltX;
450+
}
451+
if (tiltY) {
452+
action.tiltY = tiltY;
453+
}
454+
if (twist) {
455+
action.twist = twist;
456+
}
457+
if (altitudeAngle) {
458+
action.altitudeAngle = altitudeAngle;
459+
}
460+
if (azimuthAngle) {
461+
action.azimuthAngle = azimuthAngle;
462+
}
463+
return action;
464+
}
465+
427466
PointerSource.prototype = {
428467
serialize: function(tickCount) {
429468
if (!this.actions.size) {
@@ -441,12 +480,16 @@
441480
return data;
442481
},
443482

444-
pointerDown: function(actions, button) {
483+
pointerDown: function(actions, button, width, height, pressure, tangentialPressure,
484+
tiltX, tiltY, twist, altitudeAngle, azimuthAngle) {
445485
let tick = actions.tickIdx;
446486
if (this.actions.has(tick)) {
447487
tick = actions.addTick().tickIdx;
448488
}
449-
this.actions.set(tick, {type: "pointerDown", button});
489+
let actionProperties = setPointerProperties({type: "pointerDown", button}, width, height,
490+
pressure, tangentialPressure, tiltX, tiltY,
491+
twist, altitudeAngle, azimuthAngle);
492+
this.actions.set(tick, actionProperties);
450493
},
451494

452495
pointerUp: function(actions, button) {
@@ -457,15 +500,20 @@
457500
this.actions.set(tick, {type: "pointerUp", button});
458501
},
459502

460-
pointerMove: function(actions, x, y, duration, origin) {
503+
pointerMove: function(actions, x, y, duration, origin, width, height, pressure,
504+
tangentialPressure, tiltX, tiltY, twist, altitudeAngle, azimuthAngle) {
461505
let tick = actions.tickIdx;
462506
if (this.actions.has(tick)) {
463507
tick = actions.addTick().tickIdx;
464508
}
465-
this.actions.set(tick, {type: "pointerMove", x, y, origin});
509+
let moveAction = {type: "pointerMove", x, y, origin};
466510
if (duration) {
467-
this.actions.get(tick).duration = duration;
511+
moveAction.duration = duration;
468512
}
513+
let actionProperties = setPointerProperties(moveAction, width, height, pressure,
514+
tangentialPressure, tiltX, tiltY, twist,
515+
altitudeAngle, azimuthAngle);
516+
this.actions.set(tick, actionProperties);
469517
},
470518

471519
addPause: function(actions, duration) {

test/fixtures/wpt/resources/testdriver.js

+22
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,24 @@
146146
y: centerPoint[1]});
147147
},
148148

149+
/**
150+
* Deletes all cookies.
151+
*
152+
* This matches the behaviour of the {@link
153+
* https://w3c.github.io/webdriver/#delete-all-cookies|WebDriver
154+
* Delete All Cookies command}.
155+
*
156+
* @param {WindowProxy} context - Browsing context in which
157+
* to run the call, or null for the current
158+
* browsing context.
159+
*
160+
* @returns {Promise} fulfilled after cookies are deleted, or rejected in
161+
* the cases the WebDriver command errors
162+
*/
163+
delete_all_cookies: function(context=null) {
164+
return window.test_driver_internal.delete_all_cookies(context);
165+
},
166+
149167
/**
150168
* Send keys to an element
151169
*
@@ -458,6 +476,10 @@
458476
});
459477
},
460478

479+
delete_all_cookies: function(context=null) {
480+
return Promise.reject(new Error("unimplemented"));
481+
},
482+
461483
send_keys: function(element, keys) {
462484
if (this.in_automation) {
463485
return Promise.reject(new Error('Not implemented'));

test/fixtures/wpt/resources/testharness.js

+13-16
Original file line numberDiff line numberDiff line change
@@ -2956,22 +2956,16 @@ policies and contribution forms [3].
29562956
}
29572957

29582958
function sanitize_unpaired_surrogates(str) {
2959-
return str.replace(/([\ud800-\udbff])(?![\udc00-\udfff])/g,
2960-
function(_, unpaired)
2961-
{
2962-
return code_unit_str(unpaired);
2963-
})
2964-
// This replacement is intentionally implemented without an
2965-
// ES2018 negative lookbehind assertion to support runtimes
2966-
// which do not yet implement that language feature.
2967-
.replace(/(^|[^\ud800-\udbff])([\udc00-\udfff])/g,
2968-
function(_, previous, unpaired) {
2969-
if (/[\udc00-\udfff]/.test(previous)) {
2970-
previous = code_unit_str(previous);
2971-
}
2972-
2973-
return previous + code_unit_str(unpaired);
2974-
});
2959+
return str.replace(
2960+
/([\ud800-\udbff]+)(?![\udc00-\udfff])|(^|[^\ud800-\udbff])([\udc00-\udfff]+)/g,
2961+
function(_, low, prefix, high) {
2962+
var output = prefix || ""; // prefix may be undefined
2963+
var string = low || high; // only one of these alternates can match
2964+
for (var i = 0; i < string.length; i++) {
2965+
output += code_unit_str(string[i]);
2966+
}
2967+
return output;
2968+
});
29752969
}
29762970

29772971
function sanitize_all_unpaired_surrogates(tests) {
@@ -3612,6 +3606,9 @@ policies and contribution forms [3].
36123606

36133607
function AssertionError(message)
36143608
{
3609+
if (typeof message == "string") {
3610+
message = sanitize_unpaired_surrogates(message);
3611+
}
36153612
this.message = message;
36163613
this.stack = this.get_stack();
36173614
}

test/fixtures/wpt/versions.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"path": "url"
1313
},
1414
"resources": {
15-
"commit": "001e50de41dc35820774b27e31f77a165f4c0b9b",
15+
"commit": "351a99782b9677706b5dc0dd78e85978fa4ab130",
1616
"path": "resources"
1717
},
1818
"interfaces": {

0 commit comments

Comments
 (0)