Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / resources / deletedatabase-not-blocked.js
bloba0435053313c55df820621e1d81843fcc354059b
1 if (this.importScripts) {
2     importScripts('../../../resources/js-test.js');
3     importScripts('shared.js');
6 description("Test that deleteDatabase is not blocked when connections close in on versionchange callback");
8 function test() {
9     setDBNameFromPath();
11     request = evalAndLog("indexedDB.open(dbname)");
12     request.onblocked = unexpectedBlockedCallback;
13     request.onerror = unexpectedErrorCallback;
14     request.onsuccess = function openOnSuccess(evt) {
15         preamble(evt);
16         evalAndLog("h = event.target.result");
18         h.onversionchange = function onVersionChange(evt) {
19             preamble(evt);
20             shouldBe("event.target.version", "1");
21             shouldBe("event.oldVersion", "1");
22             shouldBeNull("event.newVersion");
23             evalAndLog("h.close()");
24         };
26         request = evalAndLog("indexedDB.deleteDatabase(dbname)");
27         request.onerror = unexpectedErrorCallback;
28         request.onblocked = unexpectedBlockedCallback;
29         request.onsuccess = function deleteDatabaseOnSuccess(evt) {
30             preamble(evt);
31             testPassed("blocked event was not fired");
32             finishJSTest();
33         };
34     };
37 test();