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

Side by Side Diff: content/test/data/indexeddb/blob_did_ack.html

Issue 917353002: IndexedDB: Test that Blink ack's blobs upon receipt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test working with num_blobs() Created 5 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
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 b rowser process</title>
10 <script src="common.js"></script>
11 <script>
12
13 // Constants.
14 var store_name = 'blobs_ack';
15 var blob_key = 'blob_key';
16 var blob_size = 200;
17
18 // Shared variables.
19 var db;
20 var put_blob;
21 var got_blob;
22
23 function test() {
24 indexedDBTest(prepareDatabase, putBlob);
25 }
26
27 function prepareDatabase() {
28 db = event.target.result;
29 db.createObjectStore(store_name);
30 }
31
32 function putBlob() {
33 debug("Writing blob.");
34
35 var trans = db.transaction(store_name, 'readwrite');
36 trans.onabort = unexpectedAbortCallback;
37 trans.oncomplete = getBlob;
38
39 var data = new Array(1 + blob_size).join("X");
40 put_blob = new Blob([data]);
41 var request = trans.objectStore(store_name).put(put_blob, blob_key);
42 request.onerror = unexpectedErrorCallback;
43 }
44
45 function getBlob() {
46 debug("Deleting blob.");
47 put_blob = undefined; // So that the blob can be GC'd
48 got_blob = false;
49 var trans = db.transaction(store_name, 'readonly');
50 trans.onabort = unexpectedAbortCallback;
51 trans.oncomplete = onGetComplete;
52
53 var request = trans.objectStore(store_name).get(blob_key);
54 request.onerror = unexpectedErrorCallback;
55 request.onsuccess = onGetSuccess;
56 }
57
58 function onGetComplete() {
59 if (got_blob) {
60 gc();
61 done();
62 } else {
63 fail('Did not close the blob');
64 }
65 }
66
67 function onGetSuccess(evt) {
68 got_blob = true;
69 }
70
71 </script>
72 </head>
73 <body onLoad="test()">
74 <div id="status">Starting...<br></div>
jsbell 2015/02/13 16:53:29 Can you add a <p> with some text explaining that t
cmumford 2015/02/13 17:03:39 Done.
75 </body>
76 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698