Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / resources / intversion-pending-version-changes-ascending.js
blob97e359ad796dcf54a9082155dec885eed6ed2240
1 if (this.importScripts) {
2     importScripts('../../../resources/js-test.js');
3     importScripts('shared.js');
6 description("Check processing of pending version change requests - increasing versions.");
8 indexedDBTest(null, function onConnection1Open(evt) {
9     preamble(evt);
10     db = event.target.result;
12     request = evalAndLog("indexedDB.open(dbname, 2)");
13     request.onblocked = connection2Blocked;
14     request.onupgradeneeded = connection2UpgradeNeeded;
15     request.onsuccess = connection2OpenSuccess;
16     request.onerror = unexpectedErrorCallback;
18     request = evalAndLog("indexedDB.open(dbname, 3)");
19     request.onblocked = connection3Blocked;
20     request.onupgradeneeded = connection3UpgradeNeeded;
21     request.onsuccess = connection3OpenSuccess;
22     request.onerror = unexpectedErrorCallback;
24     debug("");
25     debug("FIXME: The open call with higher version should execute first.");
26 });
28 function connection2Blocked(evt)
30     preamble(evt);
31     // Attempt to delay this until the third open has been processed;
32     // not strictly necessary but will exercise IPC/event timing.
33     setTimeout(function() {
34         evalAndLog("db.close()");
35     }, 0);
38 function connection2UpgradeNeeded(evt)
40     preamble(evt);
41     shouldBe("event.oldVersion", "1");
42     shouldBe("event.newVersion", "2");
45 function connection2OpenSuccess(evt)
47     preamble(evt);
48     evalAndLog("db2 = event.target.result");
49     shouldBe("db2.version", "2");
52 function connection3Blocked(evt)
54     preamble(evt);
55     evalAndLog("db2.close()");
58 function connection3UpgradeNeeded(evt)
60     preamble(evt);
61     shouldBe("event.oldVersion", "2");
62     shouldBe("event.newVersion", "3");
65 function connection3OpenSuccess(evt)
67     preamble(evt);
68     evalAndLog("db3 = event.target.result");
69     shouldBe("db3.version", "3");
70     finishJSTest();