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

Unified Diff: LayoutTests/crypto/exportKey.html

Issue 23592023: WebCrypto: Add interface for exportKey(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase, add test expectations, remove platformCrypto nullity check 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 | « no previous file | LayoutTests/crypto/exportKey-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/crypto/exportKey.html
diff --git a/LayoutTests/crypto/exportKey.html b/LayoutTests/crypto/exportKey.html
new file mode 100644
index 0000000000000000000000000000000000000000..82649deca0d53e0ba0cc033975930374cabc79f9
--- /dev/null
+++ b/LayoutTests/crypto/exportKey.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../fast/js/resources/js-test-pre.js"></script>
+<script src="resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Tests cypto.subtle.exportKey.");
+
+jsTestIsAsync = true;
+
+importTestKeys().then(function(result) {
+ keys = result;
+
+ // Invalid export formats.
+ shouldThrow("crypto.subtle.exportKey(3, keys.aesCbcJustDecrypt)");
+ shouldThrow("crypto.subtle.exportKey(null, keys.aesCbcJustDecrypt)");
+ shouldThrow("crypto.subtle.exportKey('invalid', keys.aesCbcJustDecrypt)");
+
+ // Invalid keys
+ shouldThrow("crypto.subtle.exportKey('raw', null)");
+ shouldThrow("crypto.subtle.exportKey('raw', 3)");
+
+ shouldBe("keys.aesCbcJustDecrypt.extractable", "false")
+ shouldThrow("crypto.subtle.exportKey('raw', keys.aesCbcJustDecrypt)");
+
+ return crypto.subtle.exportKey('raw', keys.hmacSha1);
+}).then(function(result) {
+ keyData = result;
+ shouldBe("keyData.byteLength", "3");
+
+ return crypto.subtle.exportKey('pkcs8', keys.hmacSha1);
+}).then(function(result) {
+ keyData = result;
+ shouldBe("keyData.byteLength", "5");
+}).then(finishJSTest, failAndFinishJSTest);
+
+</script>
+
+<script src="../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/crypto/exportKey-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698