Skip to content

Commit

Permalink
test: update wpt resources
Browse files Browse the repository at this point in the history
Refs: web-platform-tests/wpt#26824

PR-URL: #36659
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
watilde authored and danielleadams committed Jan 12, 2021
1 parent 4acc273 commit a7f743f
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 27 deletions.
2 changes: 1 addition & 1 deletion test/fixtures/wpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Last update:
- console: https://github.com/web-platform-tests/wpt/tree/3b1f72e99a/console
- encoding: https://github.com/web-platform-tests/wpt/tree/3c9820d1cc/encoding
- url: https://github.com/web-platform-tests/wpt/tree/1783c9bccf/url
- resources: https://github.com/web-platform-tests/wpt/tree/001e50de41/resources
- resources: https://github.com/web-platform-tests/wpt/tree/351a99782b/resources
- interfaces: https://github.com/web-platform-tests/wpt/tree/8719553b2d/interfaces
- html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/2c5c3c4c27/html/webappapis/microtask-queuing
- html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/264f12bc7b/html/webappapis/timers
Expand Down
66 changes: 57 additions & 9 deletions test/fixtures/wpt/resources/testdriver-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,12 @@
* pointer source
* @returns {Actions}
*/
pointerDown: function({button=this.ButtonType.LEFT, sourceName=null}={}) {
pointerDown: function({button=this.ButtonType.LEFT, sourceName=null,
width, height, pressure, tangentialPressure,
tiltX, tiltY, twist, altitudeAngle, azimuthAngle}={}) {
let source = this.getSource("pointer", sourceName);
source.pointerDown(this, button);
source.pointerDown(this, button, width, height, pressure, tangentialPressure,
tiltX, tiltY, twist, altitudeAngle, azimuthAngle);
return this;
},

Expand Down Expand Up @@ -314,9 +317,13 @@
* @returns {Actions}
*/
pointerMove: function(x, y,
{origin="viewport", duration, sourceName=null}={}) {
{origin="viewport", duration, sourceName=null,
width, height, pressure, tangentialPressure,
tiltX, tiltY, twist, altitudeAngle, azimuthAngle}={}) {
let source = this.getSource("pointer", sourceName);
source.pointerMove(this, x, y, duration, origin);
source.pointerMove(this, x, y, duration, origin, width, height, pressure,
tangentialPressure, tiltX, tiltY, twist, altitudeAngle,
azimuthAngle);
return this;
},

Expand Down Expand Up @@ -424,6 +431,38 @@
this.actions = new Map();
}

function setPointerProperties(action, width, height, pressure, tangentialPressure,
tiltX, tiltY, twist, altitudeAngle, azimuthAngle) {
if (width) {
action.width = width;
}
if (height) {
action.height = height;
}
if (pressure) {
action.pressure = pressure;
}
if (tangentialPressure) {
action.tangentialPressure = tangentialPressure;
}
if (tiltX) {
action.tiltX = tiltX;
}
if (tiltY) {
action.tiltY = tiltY;
}
if (twist) {
action.twist = twist;
}
if (altitudeAngle) {
action.altitudeAngle = altitudeAngle;
}
if (azimuthAngle) {
action.azimuthAngle = azimuthAngle;
}
return action;
}

PointerSource.prototype = {
serialize: function(tickCount) {
if (!this.actions.size) {
Expand All @@ -441,12 +480,16 @@
return data;
},

pointerDown: function(actions, button) {
pointerDown: function(actions, button, width, height, pressure, tangentialPressure,
tiltX, tiltY, twist, altitudeAngle, azimuthAngle) {
let tick = actions.tickIdx;
if (this.actions.has(tick)) {
tick = actions.addTick().tickIdx;
}
this.actions.set(tick, {type: "pointerDown", button});
let actionProperties = setPointerProperties({type: "pointerDown", button}, width, height,
pressure, tangentialPressure, tiltX, tiltY,
twist, altitudeAngle, azimuthAngle);
this.actions.set(tick, actionProperties);
},

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

pointerMove: function(actions, x, y, duration, origin) {
pointerMove: function(actions, x, y, duration, origin, width, height, pressure,
tangentialPressure, tiltX, tiltY, twist, altitudeAngle, azimuthAngle) {
let tick = actions.tickIdx;
if (this.actions.has(tick)) {
tick = actions.addTick().tickIdx;
}
this.actions.set(tick, {type: "pointerMove", x, y, origin});
let moveAction = {type: "pointerMove", x, y, origin};
if (duration) {
this.actions.get(tick).duration = duration;
moveAction.duration = duration;
}
let actionProperties = setPointerProperties(moveAction, width, height, pressure,
tangentialPressure, tiltX, tiltY, twist,
altitudeAngle, azimuthAngle);
this.actions.set(tick, actionProperties);
},

addPause: function(actions, duration) {
Expand Down
22 changes: 22 additions & 0 deletions test/fixtures/wpt/resources/testdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,24 @@
y: centerPoint[1]});
},

/**
* Deletes all cookies.
*
* This matches the behaviour of the {@link
* https://w3c.github.io/webdriver/#delete-all-cookies|WebDriver
* Delete All Cookies command}.
*
* @param {WindowProxy} context - Browsing context in which
* to run the call, or null for the current
* browsing context.
*
* @returns {Promise} fulfilled after cookies are deleted, or rejected in
* the cases the WebDriver command errors
*/
delete_all_cookies: function(context=null) {
return window.test_driver_internal.delete_all_cookies(context);
},

/**
* Send keys to an element
*
Expand Down Expand Up @@ -458,6 +476,10 @@
});
},

delete_all_cookies: function(context=null) {
return Promise.reject(new Error("unimplemented"));
},

send_keys: function(element, keys) {
if (this.in_automation) {
return Promise.reject(new Error('Not implemented'));
Expand Down
29 changes: 13 additions & 16 deletions test/fixtures/wpt/resources/testharness.js
Original file line number Diff line number Diff line change
Expand Up @@ -2956,22 +2956,16 @@ policies and contribution forms [3].
}

function sanitize_unpaired_surrogates(str) {
return str.replace(/([\ud800-\udbff])(?![\udc00-\udfff])/g,
function(_, unpaired)
{
return code_unit_str(unpaired);
})
// This replacement is intentionally implemented without an
// ES2018 negative lookbehind assertion to support runtimes
// which do not yet implement that language feature.
.replace(/(^|[^\ud800-\udbff])([\udc00-\udfff])/g,
function(_, previous, unpaired) {
if (/[\udc00-\udfff]/.test(previous)) {
previous = code_unit_str(previous);
}

return previous + code_unit_str(unpaired);
});
return str.replace(
/([\ud800-\udbff]+)(?![\udc00-\udfff])|(^|[^\ud800-\udbff])([\udc00-\udfff]+)/g,
function(_, low, prefix, high) {
var output = prefix || ""; // prefix may be undefined
var string = low || high; // only one of these alternates can match
for (var i = 0; i < string.length; i++) {
output += code_unit_str(string[i]);
}
return output;
});
}

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

function AssertionError(message)
{
if (typeof message == "string") {
message = sanitize_unpaired_surrogates(message);
}
this.message = message;
this.stack = this.get_stack();
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"path": "url"
},
"resources": {
"commit": "001e50de41dc35820774b27e31f77a165f4c0b9b",
"commit": "351a99782b9677706b5dc0dd78e85978fa4ab130",
"path": "resources"
},
"interfaces": {
Expand Down

0 comments on commit a7f743f

Please sign in to comment.