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

Unified Diff: LayoutTests/crypto/importKey.html

Issue 206483010: [webcrypto] Refactor some layout tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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/import-aes-key-bad-length-expected.txt ('k') | LayoutTests/crypto/resources/common.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/crypto/importKey.html
diff --git a/LayoutTests/crypto/importKey.html b/LayoutTests/crypto/importKey.html
index fcdc3e24447427abc30821367f59df75c953b880..4db882e6c058be5aea30e5b15f3a519933b43f37 100644
--- a/LayoutTests/crypto/importKey.html
+++ b/LayoutTests/crypto/importKey.html
@@ -3,6 +3,7 @@
<head>
<script src="../resources/js-test.js"></script>
<script src="resources/common.js"></script>
+<script src="resources/keys.js"></script>
</head>
<body>
<p id="description"></p>
@@ -77,7 +78,7 @@ Promise.resolve(null).then(function() {
// Import an spki formatted public key
keyFormat = "spki";
- data = hexStringToUint8Array(kPublicKeySpkiDerHex);
+ data = hexStringToUint8Array(kKeyData.rsa1.spki);
algorithm = {name: 'RsasSA-pKCS1-v1_5', hash: {name: 'sha-1'}};
extractable = false;
keyUsages = [];
@@ -90,13 +91,13 @@ Promise.resolve(null).then(function() {
//shouldBe("key.extractable", "true");
shouldBe("key.algorithm.name", "'RSASSA-PKCS1-v1_5'");
shouldBe("key.algorithm.hash.name", '"SHA-1"');
- shouldBe("key.algorithm.modulusLength", '1024');
- bytesShouldMatchHexString("key.algorithm.publicExponent", "010001", key.algorithm.publicExponent);
+ shouldEvaluateAs("key.algorithm.modulusLength", kKeyData.rsa1.modulusLengthBits);
+ bytesShouldMatchHexString("key.algorithm.publicExponent", kKeyData.rsa1.publicExponent, key.algorithm.publicExponent);
shouldBe("key.usages.join(',')", "''");
// Import a pkcs8 formatted private key
keyFormat = "pkcs8";
- data = hexStringToUint8Array(kPrivateKeyPkcs8DerHex);
+ data = hexStringToUint8Array(kKeyData.rsa1.pkcs8);
algorithm = {name: 'RsasSA-pKCS1-v1_5', hash: {name: 'sha-1'}};
extractable = false;
keyUsages = [];
@@ -108,8 +109,8 @@ Promise.resolve(null).then(function() {
shouldBe("key.extractable", "false");
shouldBe("key.algorithm.name", "'RSASSA-PKCS1-v1_5'");
shouldBe("key.algorithm.hash.name", '"SHA-1"');
- shouldBe("key.algorithm.modulusLength", '1024');
- bytesShouldMatchHexString("key.algorithm.publicExponent", "010001", key.algorithm.publicExponent);
+ shouldEvaluateAs("key.algorithm.modulusLength", kKeyData.rsa1.modulusLengthBits);
+ bytesShouldMatchHexString("key.algorithm.publicExponent", kKeyData.rsa1.publicExponent, key.algorithm.publicExponent);
shouldBe("key.usages.join(',')", "''")
keyFormat = "raw";
« no previous file with comments | « LayoutTests/crypto/import-aes-key-bad-length-expected.txt ('k') | LayoutTests/crypto/resources/common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698