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

Unified Diff: LayoutTests/crypto/digest-arraybuffer.html

Issue 267133002: [webcrypto] Allow both ArrayBuffer and ArrayBufferView as inputs to crypto.subtle methods. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename ArrayBytes --> ArrayPiece Created 6 years, 7 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/digest-arraybuffer-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/crypto/digest-arraybuffer.html
diff --git a/LayoutTests/crypto/digest-arraybuffer.html b/LayoutTests/crypto/digest-arraybuffer.html
new file mode 100644
index 0000000000000000000000000000000000000000..0244d2f2879849144250afac44900cf20d3d597e
--- /dev/null
+++ b/LayoutTests/crypto/digest-arraybuffer.html
@@ -0,0 +1,31 @@
+<!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 the digest() method using ArrayBuffer");
+
+jsTestIsAsync = true;
+
+var algorithmName = "sha-256";
+var inputHex = "00";
+var expectedOutputHex = "6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d";
+
+// Most of the crypto LayouTests use ArrayBufferView for data input. This one
+// passes an ArrayBuffer instead.
+var input = hexStringToUint8Array(inputHex).buffer;
+
+crypto.subtle.digest({name : algorithmName}, input).then(function(result) {
+ bytesShouldMatchHexString("sha-256 of [0]", expectedOutputHex, result);
+}).then(finishJSTest, failAndFinishJSTest);
+
+</script>
+
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/crypto/digest-arraybuffer-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698