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

Unified 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: aaaaaaaand one more nit. Created 6 years, 6 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: LayoutTests/storage/indexeddb/blob-delete-objectstore-db.html
diff --git a/LayoutTests/storage/indexeddb/blob-delete-objectstore-db.html b/LayoutTests/storage/indexeddb/blob-delete-objectstore-db.html
new file mode 100644
index 0000000000000000000000000000000000000000..6f983852093b81860511334dd77da1300f1a6b2e
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/blob-delete-objectstore-db.html
@@ -0,0 +1,71 @@
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<script>
+
+description("Test that deleting an object store and a database containing blobs doesn't crash.");
+
+indexedDBTest(prepareDatabase, reopen, {version: 1});
+function prepareDatabase()
+{
+ db = event.target.result;
+ event.target.transaction.onabort = unexpectedAbortCallback;
+ evalAndLog("store0 = db.createObjectStore('store0')");
+ evalAndLog("store1 = db.createObjectStore('store1')");
+ blobAContent = "First blob content";
+ blobA = new Blob([blobAContent], {"type" : "text/plain"});
+ key = "blob key";
+ evalAndLog("store0.put(blobA, key)");
+}
+
+function reopen()
+{
+ evalAndLog("db.close()");
+ preamble();
+ evalAndLog("request = indexedDB.open(dbname, 2)");
+ request.onupgradeneeded = deleteObjectStore;
+ request.onsuccess = unexpectedSuccessCallback;
+ request.onerror = unexpectedErrorCallback;
+ request.onblocked = unexpectedBlockedCallback;
+}
+
+function deleteObjectStore(e)
+{
+ preamble();
+ db = e.target.result;
+ evalAndLog("db.deleteObjectStore('store0')");
+ request.onsuccess = didDeleteObjectStore;
+}
+
+function didDeleteObjectStore()
+{
+ preamble();
+ blobBContent = "Second blob content";
+ evalAndLog("trans = db.transaction('store1', 'readwrite')");
+ evalAndLog("store1 = trans.objectStore('store1')");
+ blobB = new Blob([blobBContent], {"type" : "text/plain"});
+ evalAndLog("store1.put(blobB, key)");
+ trans.oncomplete = deleteDatabase;
+ trans.onabort = unexpectedAbortCallback;
+}
+
+function deleteDatabase()
+{
+ evalAndLog("db.close()");
+ evalAndLog("request = indexedDB.deleteDatabase(dbname)");
+ request.onerror = unexpectedErrorCallback;
+ request.onsuccess = reportSuccess;
+}
+
+function reportSuccess()
+{
+ debug("Database deleted.");
+ finishJSTest();
+}
+</script>
+</body>
+</html>
+

Powered by Google App Engine
This is Rietveld 408576698