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

Unified Diff: third_party/WebKit/LayoutTests/crypto/subtle/encrypt-neutered-data.html

Issue 2141843002: Copy array buffer data used by WebCrypto in the order expected by draft specification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change FIXME --> TODO(eroman) Created 4 years, 5 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 | third_party/WebKit/LayoutTests/crypto/subtle/encrypt-neutered-data-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/crypto/subtle/encrypt-neutered-data.html
diff --git a/third_party/WebKit/LayoutTests/crypto/subtle/encrypt-neutered-data.html b/third_party/WebKit/LayoutTests/crypto/subtle/encrypt-neutered-data.html
new file mode 100644
index 0000000000000000000000000000000000000000..e350ad9e11415cdf16caed1943a992e118c1d6e5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/crypto/subtle/encrypt-neutered-data.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+<script src="resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Tests crypto.subtle.encrypt() using a BufferSource that was neutered (prior to encrypt())");
+
+jsTestIsAsync = true;
+
+data = null;
+key = null;
+
+var keyData = hexStringToUint8Array("2b7e151628aed2a6abf7158809cf4f3c");
+var iv = hexStringToUint8Array("000102030405060708090a0b0c0d0e0f");
+var kExpectedCipherTextHex = "c84af0b613435d5d9182801a9bd9320b";
+
+var extractable = true;
+var usages = ['encrypt', 'decrypt'];
+
+debug("Importing key...");
+crypto.subtle.importKey('raw', keyData, "aes-cbc", extractable, usages).then(function(result) {
+ key = result;
+
+ debug("\nEncrypting empty plaintext (as a control group)...");
+ return crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, new Uint8Array());
+}).then(function(result) {
+ bytesShouldMatchHexString("Encryption", kExpectedCipherTextHex, result);
+
+ debug("\nCreating ArrayBuffer...");
+ plainText = new ArrayBuffer(1000);
+ shouldBe("plainText.byteLength", "1000");
+
+ debug("Neutering plainText...");
+ try { postMessage(plainText, "xxx", [plainText]); } catch (e) { }
+ shouldBe("plainText.byteLength", "0");
+
+ debug("\nEncrypting neutered plaintext...");
+ return crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, plainText);
+}).then(function(result) {
+ bytesShouldMatchHexString("Encryption", kExpectedCipherTextHex, result);
+}).then(finishJSTest, failAndFinishJSTest);
+</script>
+
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/crypto/subtle/encrypt-neutered-data-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698