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> |