diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md index 8f59b55ce8af85..074caa3d711cb7 100644 --- a/test/fixtures/wpt/README.md +++ b/test/fixtures/wpt/README.md @@ -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 diff --git a/test/fixtures/wpt/resources/testdriver-actions.js b/test/fixtures/wpt/resources/testdriver-actions.js index f3e6388e8acd19..4dafa0c018b101 100644 --- a/test/fixtures/wpt/resources/testdriver-actions.js +++ b/test/fixtures/wpt/resources/testdriver-actions.js @@ -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; }, @@ -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; }, @@ -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) { @@ -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) { @@ -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) { diff --git a/test/fixtures/wpt/resources/testdriver.js b/test/fixtures/wpt/resources/testdriver.js index c53b24136c091f..f3cee9821e13f9 100644 --- a/test/fixtures/wpt/resources/testdriver.js +++ b/test/fixtures/wpt/resources/testdriver.js @@ -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 * @@ -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')); diff --git a/test/fixtures/wpt/resources/testharness.js b/test/fixtures/wpt/resources/testharness.js index d50e094117df56..f7fe7531710d23 100644 --- a/test/fixtures/wpt/resources/testharness.js +++ b/test/fixtures/wpt/resources/testharness.js @@ -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) { @@ -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(); } diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index f5d2cc5c600658..b6a871ea9da93f 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -12,7 +12,7 @@ "path": "url" }, "resources": { - "commit": "001e50de41dc35820774b27e31f77a165f4c0b9b", + "commit": "351a99782b9677706b5dc0dd78e85978fa4ab130", "path": "resources" }, "interfaces": {