GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / content / test / data / indexeddb / blob_did_ack.html
blob515e24bf88a8f4f1f9efbea5b0e64a0f8f790605
1 <!DOCTYPE html>
2 <html>
3 <!--
4 Copyright 2015 The Chromium Authors. All rights reserved.
5 Use of this source code is governed by a BSD-style license that can be
6 found in the LICENSE file.
7 -->
8 <head>
9 <title>IDB Test that reading a blob from the database does send an ack back to browser process</title>
10 <script src="common.js"></script>
11 <script>
13 // Constants.
14 var store_name = 'blobs_ack';
15 var blob_key = 'blob_key';
16 var blob_size = 200;
18 // Shared variables.
19 var db;
20 var put_blob;
22 function test() {
23 indexedDBTest(prepareDatabase, putBlob);
26 function prepareDatabase() {
27 db = event.target.result;
28 db.createObjectStore(store_name);
31 function putBlob() {
32 debug("Writing blob.");
34 var trans = db.transaction(store_name, 'readwrite');
35 trans.onabort = unexpectedAbortCallback;
36 trans.oncomplete = getBlob;
38 var data = new Array(1 + blob_size).join("X");
39 put_blob = new Blob([data]);
40 var request = trans.objectStore(store_name).put(put_blob, blob_key);
41 request.onerror = unexpectedErrorCallback;
44 function getBlob() {
45 debug("Deleting blob.");
46 put_blob = undefined; // So that the blob can be GC'd
47 var trans = db.transaction(store_name, 'readonly');
48 trans.onabort = unexpectedAbortCallback;
49 trans.oncomplete = onGetComplete;
51 var request = trans.objectStore(store_name).get(blob_key);
52 request.onerror = unexpectedErrorCallback;
55 function onGetComplete() {
56 gc();
57 done();
60 </script>
61 </head>
62 <body onLoad="test()">
63 <div id="status">Starting...<br>
64 <p>Run this test with --js-flags=--expose-gc when run from Chrome.</p>
65 </div>
66 </body>
67 </html>