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

Unified Diff: third_party/WebKit/LayoutTests/crypto/subtle/digest-arraybuffer-oom.html

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverting some behavior changes Created 5 years, 2 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
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>

Powered by Google App Engine
This is Rietveld 408576698