| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../inspector-test.js"></script> | 3 <script src="../inspector-test.js"></script> |
| 4 <script src="indexeddb-test.js"></script> | 4 <script src="indexeddb-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 function test() | 6 function test() |
| 7 { | 7 { |
| 8 var indexedDBModel = InspectorTest.createIndexedDBModel(); | 8 var indexedDBModel = InspectorTest.createIndexedDBModel(); |
| 9 var mainFrameId = InspectorTest.resourceTreeModel.mainFrame.id; | 9 var mainFrameId = InspectorTest.resourceTreeModel.mainFrame.id; |
| 10 var securityOrigin = "http://127.0.0.1:8000"; | 10 var securityOrigin = "http://127.0.0.1:8000"; |
| 11 var databaseName = "testDatabase - " + self.location; | 11 var databaseName = "testDatabase - " + self.location; |
| 12 var objectStoreName = "testObjectStore"; | 12 var objectStoreName = "testObjectStore"; |
| 13 var databaseId = new WebInspector.IndexedDBModel.DatabaseId(securityOrigin,
databaseName); | 13 var databaseId = new Resources.IndexedDBModel.DatabaseId(securityOrigin, dat
abaseName); |
| 14 | 14 |
| 15 function onConsoleError(callback) { | 15 function onConsoleError(callback) { |
| 16 var old = console.error; | 16 var old = console.error; |
| 17 console.error = function(message) { | 17 console.error = function(message) { |
| 18 console.error = old; | 18 console.error = old; |
| 19 InspectorTest.addResult(message); | 19 InspectorTest.addResult(message); |
| 20 callback(); | 20 callback(); |
| 21 }; | 21 }; |
| 22 } | 22 } |
| 23 | 23 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 function loadValues(skipCount, pageSize, callback) | 43 function loadValues(skipCount, pageSize, callback) |
| 44 { | 44 { |
| 45 indexedDBModel.loadObjectStoreData(databaseId, objectStoreName, null, sk
ipCount, pageSize, innerCallback); | 45 indexedDBModel.loadObjectStoreData(databaseId, objectStoreName, null, sk
ipCount, pageSize, innerCallback); |
| 46 | 46 |
| 47 function innerCallback(entries, hasMore) | 47 function innerCallback(entries, hasMore) |
| 48 { | 48 { |
| 49 callback(); | 49 callback(); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 InspectorTest.addSniffer(WebInspector.IndexedDBModel.prototype, "_updateOrig
inDatabaseNames", fillDatabase, false); | 53 InspectorTest.addSniffer(Resources.IndexedDBModel.prototype, "_updateOriginD
atabaseNames", fillDatabase, false); |
| 54 | 54 |
| 55 function fillDatabase() | 55 function fillDatabase() |
| 56 { | 56 { |
| 57 InspectorTest.addResult('Preparing database'); | 57 InspectorTest.addResult('Preparing database'); |
| 58 InspectorTest.deleteDatabase(mainFrameId, databaseName, step2); | 58 InspectorTest.deleteDatabase(mainFrameId, databaseName, step2); |
| 59 | 59 |
| 60 function step2() | 60 function step2() |
| 61 { | 61 { |
| 62 InspectorTest.createDatabase(mainFrameId, databaseName, step3); | 62 InspectorTest.createDatabase(mainFrameId, databaseName, step3); |
| 63 } | 63 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 | 107 |
| 108 function step5() | 108 function step5() |
| 109 { | 109 { |
| 110 InspectorTest.completeTest(); | 110 InspectorTest.completeTest(); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 function checkDatabaseDoesExist(callback) | 114 function checkDatabaseDoesExist(callback) |
| 115 { | 115 { |
| 116 InspectorTest.addSniffer(WebInspector.IndexedDBModel.prototype, "_update
OriginDatabaseNames", step2, false); | 116 InspectorTest.addSniffer(Resources.IndexedDBModel.prototype, "_updateOri
ginDatabaseNames", step2, false); |
| 117 indexedDBModel.refreshDatabaseNames(); | 117 indexedDBModel.refreshDatabaseNames(); |
| 118 | 118 |
| 119 function step2() | 119 function step2() |
| 120 { | 120 { |
| 121 var names = indexedDBModel._databaseNamesBySecurityOrigin[securityOr
igin]; | 121 var names = indexedDBModel._databaseNamesBySecurityOrigin[securityOr
igin]; |
| 122 InspectorTest.assertGreaterOrEqual(0, names.indexOf(databaseName), "
Database should exist"); | 122 InspectorTest.assertGreaterOrEqual(0, names.indexOf(databaseName), "
Database should exist"); |
| 123 callback(); | 123 callback(); |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 | 126 |
| 127 function checkDatabaseDoesNotExist(callback) | 127 function checkDatabaseDoesNotExist(callback) |
| 128 { | 128 { |
| 129 InspectorTest.addSniffer(WebInspector.IndexedDBModel.prototype, "_update
OriginDatabaseNames", step2, false); | 129 InspectorTest.addSniffer(Resources.IndexedDBModel.prototype, "_updateOri
ginDatabaseNames", step2, false); |
| 130 indexedDBModel.refreshDatabaseNames(); | 130 indexedDBModel.refreshDatabaseNames(); |
| 131 | 131 |
| 132 function step2() | 132 function step2() |
| 133 { | 133 { |
| 134 var names = indexedDBModel._databaseNamesBySecurityOrigin[securityOr
igin]; | 134 var names = indexedDBModel._databaseNamesBySecurityOrigin[securityOr
igin]; |
| 135 InspectorTest.assertEquals(-1, names.indexOf(databaseName), "Databas
e should not exist"); | 135 InspectorTest.assertEquals(-1, names.indexOf(databaseName), "Databas
e should not exist"); |
| 136 callback(); | 136 callback(); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 </script> | 140 </script> |
| 141 </head> | 141 </head> |
| 142 <body onload="runTest()"> | 142 <body onload="runTest()"> |
| 143 <p>Tests that deleted databases do not get recreated.</p> | 143 <p>Tests that deleted databases do not get recreated.</p> |
| 144 </body> | 144 </body> |
| 145 </html> | 145 </html> |
| OLD | NEW |