Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Unified Diff: LayoutTests/crypto/resources/common.js

Issue 23126008: WebCrypto: refactor layout tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/crypto/importKey-expected.txt ('k') | LayoutTests/crypto/sign-verify.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/crypto/resources/common.js
diff --git a/LayoutTests/crypto/resources/common.js b/LayoutTests/crypto/resources/common.js
index 301cc2b7a6d6563618536c8e14c9e49b866bf680..c208412acd64d2d1a07726d65832210321b2370e 100644
--- a/LayoutTests/crypto/resources/common.js
+++ b/LayoutTests/crypto/resources/common.js
@@ -1,12 +1,23 @@
-function importHmacSha1Key()
+function importTestKeys()
{
var keyFormat = "spki";
var data = new Uint8Array([]);
- var algorithm = {name: 'hmac', hash: {name: 'sha-1'}};
var extractable = false;
var keyUsages = ['encrypt', 'decrypt', 'sign', 'verify'];
- return crypto.subtle.importKey(keyFormat, data, algorithm, extractable, keyUsages);
+ var hmacPromise = crypto.subtle.importKey(keyFormat, data, {name: 'hmac', hash: {name: 'sha-1'}}, extractable, keyUsages);
+ var rsaSsaPromise = crypto.subtle.importKey(keyFormat, data, {name: 'RSASSA-PKCS1-v1_5', hash: {name: 'sha-1'}}, extractable, keyUsages);
+ var aesCbcPromise = crypto.subtle.importKey(keyFormat, data, {name: 'AES-CBC'}, extractable, keyUsages);
+ var aesCbcJustDecrypt = crypto.subtle.importKey(keyFormat, data, {name: 'AES-CBC'}, extractable, ['decrypt']);
+
+ return Promise.every(hmacPromise, rsaSsaPromise, aesCbcPromise, aesCbcJustDecrypt).then(function(results) {
+ return {
+ hmacSha1: results[0],
+ rsaSsaSha1: results[1],
+ aesCbc: results[2],
+ aesCbcJustDecrypt: results[3],
+ };
+ });
}
// Builds a hex string representation of any array-like input (array or
@@ -34,3 +45,9 @@ function asciiToArrayBuffer(str)
return new Uint8Array(chars);
}
+function failAndFinishJSTest(error)
+{
+ if (error)
+ debug(error);
+ finishJSTest();
+}
« no previous file with comments | « LayoutTests/crypto/importKey-expected.txt ('k') | LayoutTests/crypto/sign-verify.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698