JS Test Harness: Remove successfullyParsed from more tests
[WebKit-https.git] / LayoutTests / storage / indexeddb / set_version_blocked.html
1 <html>\r
2 <head>\r
3 <script src="../../fast/js/resources/js-test-pre.js"></script>\r
4 <script src="resources/shared.js"></script>\r
5 </head>\r
6 <body>\r
7 <p id="description"></p>\r
8 <div id="console"></div>\r
9 <script>\r
10 \r
11 description("An open connection blocks a separate connection's setVersion call");\r
12 if (window.layoutTestController)\r
13     layoutTestController.waitUntilDone();\r
14 \r
15 connections = []\r
16 function test()\r
17 {\r
18     if ('webkitIndexedDB' in window)\r
19         IndexedDB = webkitIndexedDB;\r
20     else if ('mozIndexedDB' in window)\r
21         IndexedDB = mozIndexedDB;\r
22     shouldBeFalse("IndexedDB == null");\r
23     openDBConnection();\r
24 }\r
25 \r
26 function openDBConnection()\r
27 {\r
28     request = evalAndLog("IndexedDB.open('set-version-blocked')");\r
29     request.onsuccess = openSuccess;\r
30     request.onerror = unexpectedErrorCallback;\r
31 }\r
32 \r
33 function openSuccess()\r
34 {\r
35     connection = event.target.result;\r
36     connections.push(connection);\r
37     original_version = connection.version;\r
38     if (connections.length < 2)\r
39         openDBConnection();\r
40     else {\r
41         var versionChangeRequest = evalAndLog("connections[0].setVersion('version 1')");\r
42         versionChangeRequest.onerror = unexpectedErrorCallback;\r
43         versionChangeRequest.onsuccess = inSetVersion;\r
44         versionChangeRequest.onblocked = blocked;\r
45     }\r
46 }\r
47 \r
48 seen_blocked_event = false;\r
49 function blocked()\r
50 {\r
51     evalAndLog("seen_blocked_event = true");\r
52     blocked_event = event;\r
53     shouldBeEqualToString("blocked_event.version", "version 1");\r
54     shouldEvaluateTo("blocked_event.target.readyState", 1);\r
55     evalAndLog("connections[1].close()");\r
56 }\r
57 \r
58 function inSetVersion()\r
59 {\r
60     debug("in setVersion.onsuccess");\r
61     shouldBeTrue("seen_blocked_event");\r
62     deleteAllObjectStores(connections[0]);\r
63     done();\r
64 }\r
65 \r
66 \r
67 test();\r
68 \r
69 </script>\r
70 </body>\r
71 </html>\r