4 Copyright 2014 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.
9 <title>IDB Test that blobs use space when created and free up space when deleted
</title>
10 <script src=
"common.js"></script>
14 var store_name
= 'blobs';
15 var blob_key
= 'blob_key';
16 var blob_size
= 20 * 1024 * 1024; // 20MB
22 indexedDBTest(prepareDatabase
, putBlob
);
25 function prepareDatabase() {
26 db
= event
.target
.result
;
27 db
.createObjectStore(store_name
);
31 debug("Writing blob.");
33 var trans
= db
.transaction(store_name
, 'readwrite');
34 trans
.onabort
= unexpectedAbortCallback
;
35 trans
.oncomplete
= done
;
37 var data
= new Array(1 + blob_size
).join("X");
38 var blob
= new Blob([data
]);
39 var request
= trans
.objectStore(store_name
).put(blob
, blob_key
);
40 request
.onerror
= unexpectedErrorCallback
;
45 <body onLoad=
"test()">
46 <div id=
"status">Starting...
<br></div>