Index: third_party/WebKit/LayoutTests/crypto/subtle/digest-arraybuffer-oom.html |
diff --git a/third_party/WebKit/LayoutTests/crypto/subtle/digest-arraybuffer.html b/third_party/WebKit/LayoutTests/crypto/subtle/digest-arraybuffer-oom.html |
similarity index 55% |
copy from third_party/WebKit/LayoutTests/crypto/subtle/digest-arraybuffer.html |
copy to third_party/WebKit/LayoutTests/crypto/subtle/digest-arraybuffer-oom.html |
index 0bb6998f14989beab60be52e8da82f0452463e0b..8a996e9a949b2c55bc6d3a2102c05a2f90b7b8a2 100644 |
--- a/third_party/WebKit/LayoutTests/crypto/subtle/digest-arraybuffer.html |
+++ b/third_party/WebKit/LayoutTests/crypto/subtle/digest-arraybuffer-oom.html |
@@ -9,7 +9,7 @@ |
<div id="console"></div> |
<script> |
-description("Tests the digest() method using ArrayBuffer"); |
+description("Tests the digest() method using ArrayBuffer, with a memory allocation failure."); |
jsTestIsAsync = true; |
@@ -17,13 +17,13 @@ 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); |
+if (window.internals) { |
+ internals.fakeOutOfMemoryForNextArrayBufferAllocation(); |
Stephen White
2015/10/29 16:29:52
Nice!
|
+ // Test succeeds if promise is rejected. |
+ crypto.subtle.digest({name : algorithmName}, input).then(failAndFinishJSTest, finishJSTest); |
+} |
</script> |