| 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 | 10 |
| 11 function dumpDatabaseNames() | 11 function dumpDatabaseNames() |
| 12 { | 12 { |
| 13 InspectorTest.addResult("Dumping database names:"); | 13 InspectorTest.addResult("Dumping database names:"); |
| 14 var securityOrigins = InspectorTest.securityOriginManager.securityOrigin
s(); | 14 var securityOrigins = InspectorTest.securityOriginManager.securityOrigin
s(); |
| 15 var securityOrigin = securityOrigins[0]; | 15 var securityOrigin = securityOrigins[0]; |
| 16 var names = indexedDBModel._databaseNamesBySecurityOrigin[securityOrigin
]; | 16 var names = indexedDBModel._databaseNamesBySecurityOrigin[securityOrigin
]; |
| 17 for (var i = 0; i < names.length; ++i) | 17 for (var i = 0; i < names.length; ++i) |
| 18 InspectorTest.addResult(" " + names[i]); | 18 InspectorTest.addResult(" " + names[i]); |
| 19 InspectorTest.addResult(""); | 19 InspectorTest.addResult(""); |
| 20 } | 20 } |
| 21 | 21 |
| 22 InspectorTest.addSniffer(WebInspector.IndexedDBModel.prototype, "_updateOrig
inDatabaseNames", step2, false); | 22 InspectorTest.addSniffer(Resources.IndexedDBModel.prototype, "_updateOriginD
atabaseNames", step2, false); |
| 23 | 23 |
| 24 function step2() | 24 function step2() |
| 25 { | 25 { |
| 26 dumpDatabaseNames(); | 26 dumpDatabaseNames(); |
| 27 InspectorTest.createDatabase(mainFrameId, "testDatabase1", step3); | 27 InspectorTest.createDatabase(mainFrameId, "testDatabase1", step3); |
| 28 } | 28 } |
| 29 | 29 |
| 30 function step3() | 30 function step3() |
| 31 { | 31 { |
| 32 InspectorTest.addSniffer(WebInspector.IndexedDBModel.prototype, "_update
OriginDatabaseNames", step4, false); | 32 InspectorTest.addSniffer(Resources.IndexedDBModel.prototype, "_updateOri
ginDatabaseNames", step4, false); |
| 33 indexedDBModel.refreshDatabaseNames(); | 33 indexedDBModel.refreshDatabaseNames(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 function step4() | 36 function step4() |
| 37 { | 37 { |
| 38 dumpDatabaseNames(); | 38 dumpDatabaseNames(); |
| 39 InspectorTest.createDatabase(mainFrameId, "testDatabase2", step5); | 39 InspectorTest.createDatabase(mainFrameId, "testDatabase2", step5); |
| 40 } | 40 } |
| 41 | 41 |
| 42 function step5() | 42 function step5() |
| 43 { | 43 { |
| 44 InspectorTest.addSniffer(WebInspector.IndexedDBModel.prototype, "_update
OriginDatabaseNames", step6, false); | 44 InspectorTest.addSniffer(Resources.IndexedDBModel.prototype, "_updateOri
ginDatabaseNames", step6, false); |
| 45 indexedDBModel.refreshDatabaseNames(); | 45 indexedDBModel.refreshDatabaseNames(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 function step6() | 48 function step6() |
| 49 { | 49 { |
| 50 dumpDatabaseNames(); | 50 dumpDatabaseNames(); |
| 51 InspectorTest.deleteDatabase(mainFrameId, "testDatabase2", step7); | 51 InspectorTest.deleteDatabase(mainFrameId, "testDatabase2", step7); |
| 52 } | 52 } |
| 53 | 53 |
| 54 function step7() | 54 function step7() |
| 55 { | 55 { |
| 56 InspectorTest.addSniffer(WebInspector.IndexedDBModel.prototype, "_update
OriginDatabaseNames", step8, false); | 56 InspectorTest.addSniffer(Resources.IndexedDBModel.prototype, "_updateOri
ginDatabaseNames", step8, false); |
| 57 indexedDBModel.refreshDatabaseNames(); | 57 indexedDBModel.refreshDatabaseNames(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 function step8() | 60 function step8() |
| 61 { | 61 { |
| 62 dumpDatabaseNames(); | 62 dumpDatabaseNames(); |
| 63 InspectorTest.deleteDatabase(mainFrameId, "testDatabase1", step9); | 63 InspectorTest.deleteDatabase(mainFrameId, "testDatabase1", step9); |
| 64 } | 64 } |
| 65 | 65 |
| 66 function step9() | 66 function step9() |
| 67 { | 67 { |
| 68 InspectorTest.addSniffer(WebInspector.IndexedDBModel.prototype, "_update
OriginDatabaseNames", step10, false); | 68 InspectorTest.addSniffer(Resources.IndexedDBModel.prototype, "_updateOri
ginDatabaseNames", step10, false); |
| 69 indexedDBModel.refreshDatabaseNames(); | 69 indexedDBModel.refreshDatabaseNames(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 function step10() | 72 function step10() |
| 73 { | 73 { |
| 74 dumpDatabaseNames(); | 74 dumpDatabaseNames(); |
| 75 InspectorTest.completeTest(); | 75 InspectorTest.completeTest(); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 </script> | 78 </script> |
| 79 </head> | 79 </head> |
| 80 <body onload="runTest()"> | 80 <body onload="runTest()"> |
| 81 <p>Tests that database names are correctly loaded and saved in IndexedDBModel.</
p> | 81 <p>Tests that database names are correctly loaded and saved in IndexedDBModel.</
p> |
| 82 </body> | 82 </body> |
| 83 </html> | 83 </html> |
| OLD | NEW |