Skip to content

Commit

Permalink
Import wpt@5659625cf77d23579eeb41cd546b8763826db49d
Browse files Browse the repository at this point in the history
Using wpt-import in Chromium 00bd8a0.
With Chromium commits locally applied on WPT:
85af4a9 "usb: Use Mojo union to separate device open success from error codes"
a801b78 "[Private Network Access] Test insecure fetches within workers loaded from blob urls"


Note to sheriffs: This CL imports external tests and adds
expectations for those tests; if this CL is large and causes
a few new failures, please fix the failures by adding new
lines to TestExpectations rather than reverting. See:
https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md

Directory owners for changes in this CL:
andruud@chromium.org:
  external/wpt/css/css-properties-values-api
binji@chromium.org:
  external/wpt/wasm
jsbell@chromium.org:
  external/wpt/resources
mustaq@chromium.org:
  external/wpt/html/interaction/focus
yosin@chromium.org, pcupp@microsoft.com:
  external/wpt/editing

NOAUTOREVERT=true
R=rubber-stamper@appspot.gserviceaccount.com

No-Export: true
Cq-Include-Trybots: luci.chromium.try:linux-wpt-identity-fyi-rel,linux-wpt-input-fyi-rel,linux-blink-rel
Change-Id: I694b0d80fb3dc8fb62a8ad9bd7e7197180194be7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4262151
Auto-Submit: WPT Autoroller <wpt-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1106545}
  • Loading branch information
Chromium WPT Sync authored and Chromium LUCI CQ committed Feb 17, 2023
1 parent 14ceaee commit 1c4a522
Show file tree
Hide file tree
Showing 39 changed files with 808 additions and 125 deletions.
340 changes: 295 additions & 45 deletions third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function run_test(algorithmNames, slowTest) {
.then(function(result) {
if (resultType === "CryptoKeyPair") {
assert_goodCryptoKey(result.privateKey, algorithm, extractable, usages, "private");
assert_goodCryptoKey(result.publicKey, algorithm, extractable, usages, "public");
assert_goodCryptoKey(result.publicKey, algorithm, true, usages, "public");
} else {
assert_goodCryptoKey(result, algorithm, extractable, usages, "secret");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// META: title=WebCryptoAPI: importKey() for EC keys
// META: timeout=long
// META: script=../util/helpers.js

// Test importKey and exportKey for EC algorithms. Only "happy paths" are
// currently tested - those where the operation should succeed.
Expand Down Expand Up @@ -110,6 +111,7 @@
return subtle.importKey(format, keyData, algorithm, extractable, usages).
then(function(key) {
assert_equals(key.constructor, CryptoKey, "Imported a CryptoKey object");
assert_goodCryptoKey(key, algorithm, extractable, usages, (format === 'pkcs8' || (format === 'jwk' && keyData.d)) ? 'private' : 'public');
if (!extractable) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// META: title=WebCryptoAPI: importKey() for OKP keys
// META: timeout=long
// META: script=../util/helpers.js

// Test importKey and exportKey for OKP algorithms. Only "happy paths" are
// currently tested - those where the operation should succeed.
Expand Down Expand Up @@ -104,6 +105,7 @@
return subtle.importKey(format, keyData[format], algorithm, extractable, usages).
then(function(key) {
assert_equals(key.constructor, CryptoKey, "Imported a CryptoKey object");
assert_goodCryptoKey(key, algorithm, extractable, usages, (format === 'pkcs8' || (format === 'jwk' && keyData[format].d)) ? 'private' : 'public');
if (!extractable) {
return;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// META: title=WebCryptoAPI: importKey() for symmetric keys
// META: timeout=long
// META: script=../util/helpers.js

// Test importKey and exportKey for non-PKC algorithms. Only "happy paths" are
// currently tested - those where the operation should succeed.
Expand Down Expand Up @@ -57,13 +58,18 @@
});
});

function hasLength(algorithm) {
return algorithm.name === 'HMAC' || algorithm.name.startsWith('AES');
}

// Test importKey with a given key format and other parameters. If
// extrable is true, export the key and verify that it matches the input.
function testFormat(format, algorithm, keyData, keySize, usages, extractable) {
promise_test(function(test) {
return subtle.importKey(format, keyData, algorithm, extractable, usages).
then(function(key) {
assert_equals(key.constructor, CryptoKey, "Imported a CryptoKey object");
assert_goodCryptoKey(key, hasLength(key.algorithm) ? { length: keySize, ...algorithm } : algorithm, extractable, usages, 'secret');
if (!extractable) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var registeredAlgorithmNames = [
"SHA-256",
"SHA-384",
"SHA-512",
"HKDF-CTR",
"HKDF",
"PBKDF2",
"Ed25519",
"Ed448",
Expand Down Expand Up @@ -104,9 +104,6 @@ function assert_goodCryptoKey(key, algorithm, extractable, usages, kind) {

assert_equals(key.constructor, CryptoKey, "Is a CryptoKey");
assert_equals(key.type, kind, "Is a " + kind + " key");
if (key.type === "public") {
extractable = true; // public keys are always extractable
}
assert_equals(key.extractable, extractable, "Extractability is correct");

assert_equals(key.algorithm.name, registeredAlgorithmName, "Correct algorithm name");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="utf-8">
<meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-2500" />
<title>CSS Animations Test: pauses a opacity animation and sets the current time</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-animations-1/#animation-name">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This is a testharness.js-based test.
FAIL A custom property can yield a CSS Transition with transition-property: all assert_equals: A single animation is running expected 1 but got 0
Harness: the test ran to completion.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.css-houdini.org/css-properties-values-api-1">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/utils.js"></script>
<div id="target"></div>
<script>

transition_test({
syntax: "<length>",
from: "100px",
to: "200px",
expected: "150px",
transitionProperty: "all"
}, 'A custom property can yield a CSS Transition with transition-property: all');

</script>
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ function transition_test(options, description) {
promise_test(async () => {
const customProperty = generate_name();

options.transitionProperty ??= customProperty;

CSS.registerProperty({
name: customProperty,
syntax: options.syntax,
Expand All @@ -199,7 +201,7 @@ function transition_test(options, description) {
});
});

target.style.transition = `${customProperty} 1s -500ms linear`;
target.style.transition = `${options.transitionProperty} 1s -500ms linear`;
target.style.setProperty(customProperty, options.to);

const animations = target.getAnimations();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,24 @@ complex cleanup behavior should manage execution order explicitly. If
any of the eventual values are rejected, the test runner will report
an error.

### AbortSignal support ###

[`Test.get_signal`](#Test.get_signal) gives an AbortSignal that is aborted when
the test finishes. This can be useful when dealing with AbortSignal-supported
APIs.

```js
promise_test(t => {
// Throws when the user agent does not support AbortSignal
const signal = t.get_signal();
const event = await new Promise(resolve => {
document.body.addEventListener(resolve, { once: true, signal });
document.body.click();
});
assert_equals(event.type, "click");
}, "");
```

## Timers in Tests ##

In general the use of timers (i.e. `setTimeout`) in tests is
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script>
document.addEventListener("DOMContentLoaded", () => {
document.execCommand("selectAll");
const editingHost = document.querySelector("thead[contenteditable]");
editingHost.addEventListener("focus", () => {
editingHost.addEventListener("focusout", () => {
document.execCommand("italic");
document.execCommand("insertText", false, "A");
document.execCommand("insertUnorderedList");
});
document.designMode = "on";
document.execCommand("selectAll");
document.execCommand("insertHTML", false, "A");
});
editingHost.focus();
});
</script>
</head>
<body>
<big>
</big>
<table>
<thead contenteditable>
</thead></table>
<p>
<object></object>
</p>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -3012,4 +3012,11 @@ var browserTests = [
"<ol>\n<li>{}<br></li></ol>"],
[true],
{}],

// Select all list item children when list items have multiple nodes.
["{<ul><li>abc<span>def</span>ghi</li><li>jkl<span>opq</span>rst</li></ul>}",
[["delete",""]],
"<ul><li>{}<br></li></ul>",
[true],
{}],
]
Original file line number Diff line number Diff line change
Expand Up @@ -2892,4 +2892,11 @@ var browserTests = [
"<ol>\n<li>{}<br></li></ol>"],
[true],
{}],

// Select all list item children when list items have multiple nodes.
["{<ul><li>abc<span>def</span>ghi</li><li>jkl<span>opq</span>rst</li></ul>}",
[["delete",""]],
"<ul><li>{}<br></li></ul>",
[true],
{}],
]
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,14 @@ class EditorTestUtils {
// - `{` specifies start boundary before a node
// - `]` specifies end boundary in a text node
// - `}` specifies end boundary after a node
setupEditingHost(innerHTMLWithRangeMarkers) {
//
// options can have following fields:
// - selection: how to set selection, "addRange" (default),
// "setBaseAndExtent", "setBaseAndExtent-reverse".
setupEditingHost(innerHTMLWithRangeMarkers, options = {}) {
if (!options.selection) {
options.selection = "addRange";
}
const startBoundaries = innerHTMLWithRangeMarkers.match(/\{|\[/g) || [];
const endBoundaries = innerHTMLWithRangeMarkers.match(/\}|\]/g) || [];
if (startBoundaries.length !== endBoundaries.length) {
Expand Down Expand Up @@ -351,9 +358,31 @@ class EditorTestUtils {
ranges.push(range);
}

if (options.selection != "addRange" && ranges.length > 1) {
throw `Failed due to invalid selection option, ${options.selection}, for multiple selection ranges`;
}

this.selection.removeAllRanges();
for (let range of ranges) {
this.selection.addRange(range);
for (const range of ranges) {
if (options.selection == "addRange") {
this.selection.addRange(range);
} else if (options.selection == "setBaseAndExtent") {
this.selection.setBaseAndExtent(
range.startContainer,
range.startOffset,
range.endContainer,
range.endOffset
);
} else if (options.selection == "setBaseAndExtent-reverse") {
this.selection.setBaseAndExtent(
range.endContainer,
range.endOffset,
range.startContainer,
range.startOffset
);
} else {
throw `Failed due to invalid selection option, ${options.selection}`;
}
}

if (this.selection.rangeCount != ranges.length) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This is a testharness.js-based test.
Found 590 tests; 575 PASS, 15 FAIL, 0 TIMEOUT, 0 NOTRUN.
Found 593 tests; 578 PASS, 15 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS [["delete",""]] "<p contenteditable=false><span contenteditable=true>[abc]</span></p>" queryCommandIndeterm("delete") after
PASS [["delete",""]] "<p contenteditable=false><span contenteditable=true>[abc]</span></p>" queryCommandState("delete") after
PASS [["delete",""]] "<p contenteditable=false><span contenteditable=true>[abc]</span></p>" queryCommandValue("delete") after
Expand Down Expand Up @@ -590,5 +590,8 @@ PASS [["delete",""]] "<ol><li> [abc</li></ol><ul><li>def]</li></ul>" compare inn
PASS [["delete",""]] "<ol>\n<li>[abc</li></ol><ul><li>def]</li></ul>": execCommand("delete", false, "") return value
PASS [["delete",""]] "<ol>\n<li>[abc</li></ol><ul><li>def]</li></ul>" checks for modifications to non-editable content
PASS [["delete",""]] "<ol>\n<li>[abc</li></ol><ul><li>def]</li></ul>" compare innerHTML
PASS [["delete",""]] "{<ul><li>abc<span>def</span>ghi</li><li>jkl<span>opq</span>rst</li></ul>}": execCommand("delete", false, "") return value
PASS [["delete",""]] "{<ul><li>abc<span>def</span>ghi</li><li>jkl<span>opq</span>rst</li></ul>}" checks for modifications to non-editable content
PASS [["delete",""]] "{<ul><li>abc<span>def</span>ghi</li><li>jkl<span>opq</span>rst</li></ul>}" compare innerHTML
Harness: the test ran to completion.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This is a testharness.js-based test.
Found 257 tests; 248 PASS, 9 FAIL, 0 TIMEOUT, 0 NOTRUN.
Found 260 tests; 251 PASS, 9 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS [["styleWithCSS","false"],["defaultparagraphseparator","p"],["forwarddelete",""]] "<p><font size=3>foo[]</font><p><font size=5>bar</font>": execCommand("styleWithCSS", false, "false") return value
PASS [["styleWithCSS","false"],["defaultparagraphseparator","p"],["forwarddelete",""]] "<p><font size=3>foo[]</font><p><font size=5>bar</font>": execCommand("defaultparagraphseparator", false, "p") return value
PASS [["styleWithCSS","false"],["defaultparagraphseparator","p"],["forwarddelete",""]] "<p><font size=3>foo[]</font><p><font size=5>bar</font>": execCommand("forwarddelete", false, "") return value
Expand Down Expand Up @@ -257,5 +257,8 @@ PASS [["forwarddelete",""]] "<ol><li> [abc</li></ol><ul><li>def]</li></ul>" comp
PASS [["forwarddelete",""]] "<ol>\n<li>[abc</li></ol><ul><li>def]</li></ul>": execCommand("forwarddelete", false, "") return value
PASS [["forwarddelete",""]] "<ol>\n<li>[abc</li></ol><ul><li>def]</li></ul>" checks for modifications to non-editable content
PASS [["forwarddelete",""]] "<ol>\n<li>[abc</li></ol><ul><li>def]</li></ul>" compare innerHTML
PASS [["delete",""]] "{<ul><li>abc<span>def</span>ghi</li><li>jkl<span>opq</span>rst</li></ul>}": execCommand("delete", false, "") return value
PASS [["delete",""]] "{<ul><li>abc<span>def</span>ghi</li><li>jkl<span>opq</span>rst</li></ul>}" checks for modifications to non-editable content
PASS [["delete",""]] "{<ul><li>abc<span>def</span>ghi</li><li>jkl<span>opq</span>rst</li></ul>}" compare innerHTML
Harness: the test ran to completion.

0 comments on commit 1c4a522

Please sign in to comment.