Skip to content

Commit

Permalink
test,crypto: update WebCryptoAPI WPT
Browse files Browse the repository at this point in the history
PR-URL: #54925
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
panva authored and RafaelGSS committed Sep 16, 2024
1 parent 101d917 commit e26f6da
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/fixtures/wpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Last update:
- user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/6748a0a246/WebCryptoAPI
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/272064ebf9/WebCryptoAPI
- webidl/ecmascript-binding/es-exceptions: https://github.com/web-platform-tests/wpt/tree/a370aad338/webidl/ecmascript-binding/es-exceptions
- webmessaging/broadcastchannel: https://github.com/web-platform-tests/wpt/tree/e97fac4791/webmessaging/broadcastchannel
- webstorage: https://github.com/web-platform-tests/wpt/tree/9dafa89214/webstorage
Expand Down
30 changes: 27 additions & 3 deletions test/fixtures/wpt/WebCryptoAPI/generateKey/successes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ function run_test(algorithmNames, slowTest) {
setup({explicit_timeout: true});

// These tests check that generateKey successfully creates keys
// when provided any of a wide set of correct parameters.
// when provided any of a wide set of correct parameters
// and that they can be exported afterwards.
//
// There are a lot of combinations of possible parameters,
// resulting in a very large number of tests
Expand Down Expand Up @@ -68,9 +69,32 @@ function run_test(algorithmNames, slowTest) {
} else {
assert_goodCryptoKey(result, algorithm, extractable, usages, "secret");
}
return result;
}, function(err) {
assert_unreached("Threw an unexpected error: " + err.toString());
});
assert_unreached("generateKey threw an unexpected error: " + err.toString());
})
.then(async function (result) {
if (resultType === "CryptoKeyPair") {
await Promise.all([
subtle.exportKey('jwk', result.publicKey),
subtle.exportKey('spki', result.publicKey),
result.publicKey.algorithm.name.startsWith('RSA') ? undefined : subtle.exportKey('raw', result.publicKey),
...(extractable ? [
subtle.exportKey('jwk', result.privateKey),
subtle.exportKey('pkcs8', result.privateKey),
] : [])
]);
} else {
if (extractable) {
await Promise.all([
subtle.exportKey('raw', result),
subtle.exportKey('jwk', result),
]);
}
}
}, function(err) {
assert_unreached("exportKey threw an unexpected error: " + err.toString());
})
}, testTag + ": generateKey" + parameterString(algorithm, extractable, usages));
}

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 @@ -88,7 +88,7 @@
"path": "wasm/webapi"
},
"WebCryptoAPI": {
"commit": "6748a0a24614b01ce6527493a19ef846738bee3a",
"commit": "272064ebf9a3d313a2d4db8bb9ce2790648aa162",
"path": "WebCryptoAPI"
},
"webidl/ecmascript-binding/es-exceptions": {
Expand Down

0 comments on commit e26f6da

Please sign in to comment.