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

Side by Side Diff: LayoutTests/storage/indexeddb/blob-delete-objectstore-db.html

Issue 18590006: Blob support for IDB [Blink] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebasing issue? Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <script src="resources/shared.js"></script>
5 </head>
6 <body>
7 <script>
8
9 description("Test deleting an object store and a database containing blobs.");
jsbell 2014/05/29 00:40:06 Since this test doesn't have any shouldXXXX() asse
ericu 2014/06/02 22:18:47 Done.
10
11 indexedDBTest(prepareDatabase, reopen, {version: 1});
12 function prepareDatabase()
13 {
14 db = event.target.result;
15 event.target.transaction.onabort = unexpectedAbortCallback;
16 evalAndLog("store0 = db.createObjectStore('store0')");
17 evalAndLog("store1 = db.createObjectStore('store1')");
18 blobAContent = "First blob content";
19 blobA = new Blob([blobAContent], {"type" : "text\/plain"});
jsbell 2014/05/29 00:40:06 No need to escape the forward slash here (and belo
ericu 2014/06/02 22:18:47 Done.
20 key = "blob key";
21 evalAndLog("store0.put(blobA, key)");
22 delete blobA;
jsbell 2014/05/29 00:40:06 This is unusual; it's unclear why you'd write this
ericu 2014/06/02 22:18:47 Fixed; I'd misremembered how delete worked. As it
23 }
24
25 function reopen()
26 {
27 evalAndLog("db.close()");
28 debug("");
29 debug("reopen():");
30 request = indexedDB.open(dbname, 2);
31 request.onupgradeneeded = deleteObjectStore;
32 request.onsuccess = unexpectedSuccessCallback;
33 request.onerror = unexpectedErrorCallback;
34 request.onblocked = unexpectedBlockedCallback;
35 }
36
37 function deleteObjectStore(e)
38 {
39 debug("");
40 debug("deleteObjectStore():");
41 db = e.target.result;
42 evalAndLog("db.deleteObjectStore('store0')");
43 request.onsuccess = didDeleteObjectStore;
44 }
45
46 function didDeleteObjectStore()
47 {
48 debug("");
49 debug("didDeleteObjectStore()");
50 blobBContent = "Second blob content";
51 evalAndLog("trans = db.transaction('store1', 'readwrite')");
52 evalAndLog("store1 = trans.objectStore('store1')");
53 blobB = new Blob([blobBContent], {"type" : "text\/plain"});
54 evalAndLog("store1.put(blobB, key)");
55 delete blobB;
56 trans.oncomplete = deleteDatabase;
57 }
58
59 function deleteDatabase()
60 {
61 evalAndLog("db.close()");
62 evalAndLog("request = indexedDB.deleteDatabase(dbname)");
63 request.onerror = unexpectedErrorCallback;
64 request.onsuccess = reportSuccess;
65 }
66
67 function reportSuccess()
68 {
69 debug("Database deleted.");
70 finishJSTest();
71 }
72 </script>
73 </body>
74 </html>
75
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698