Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / resources / set_version_blocked.js
blobe256c3d45cd8ae6c28d23c4d1ed19b818783b582
1 if (this.importScripts) {
2     importScripts('../../../resources/js-test.js');
3     importScripts('shared.js');
6 description("An open connection blocks a separate connection's setVersion call");
8 indexedDBTest(prepareDatabase, openAnother);
9 function prepareDatabase()
11     connection = event.target.result;
14 function openAnother()
16     openRequest = indexedDB.open(dbname, 2);
17     openRequest.onblocked = blocked;
18     openRequest.onupgradeneeded = inSetVersion;
21 seen_blocked_event = false;
22 function blocked()
24     evalAndLog("seen_blocked_event = true");
25     blocked_event = event;
26     shouldBe("blocked_event.oldVersion", "1");
27     shouldBe("blocked_event.newVersion", "2");
28     shouldEvaluateTo("blocked_event.target.readyState", "'pending'");
29     evalAndLog("connection.close()");
32 function inSetVersion()
34     debug("in setVersion.onsuccess");
35     shouldBeTrue("seen_blocked_event");
36     deleteAllObjectStores(connection);
37     finishJSTest();