| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../http/tests/inspector/resources-test.js"></script> | 4 <script src="../http/tests/inspector/resources-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function addItem(key, value) | 7 function addItem(key, value) |
| 8 { | 8 { |
| 9 localStorage.setItem(key, value); | 9 localStorage.setItem(key, value); |
| 10 } | 10 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 function updateLocalStorageView(next) | 50 function updateLocalStorageView(next) |
| 51 { | 51 { |
| 52 function viewUpdated(items) | 52 function viewUpdated(items) |
| 53 { | 53 { |
| 54 InspectorTest.addResult("Resource Panel with localStorage view u
pdated."); | 54 InspectorTest.addResult("Resource Panel with localStorage view u
pdated."); |
| 55 next(); | 55 next(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 var storage = null; | 58 var storage = null; |
| 59 var storages = WebInspector.domStorageModel.storages(); | 59 var storages = InspectorTest.domStorageModel.storages(); |
| 60 for (var i = 0; i < storages.length; ++i) { | 60 for (var i = 0; i < storages.length; ++i) { |
| 61 if (storages[i].isLocalStorage) { | 61 if (storages[i].isLocalStorage) { |
| 62 storage = storages[i]; | 62 storage = storages[i]; |
| 63 break; | 63 break; |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 InspectorTest.assertTrue(!!storage, "Local storage not found."); | 67 InspectorTest.assertTrue(!!storage, "Local storage not found."); |
| 68 | 68 |
| 69 WebInspector.panels.resources._showDOMStorage(storage); | 69 WebInspector.panels.resources._showDOMStorage(storage); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 82 } | 82 } |
| 83 | 83 |
| 84 function addItem() | 84 function addItem() |
| 85 { | 85 { |
| 86 var index = indicesToAdd.shift(); | 86 var index = indicesToAdd.shift(); |
| 87 if (!index) { | 87 if (!index) { |
| 88 next(); | 88 next(); |
| 89 return; | 89 return; |
| 90 } | 90 } |
| 91 InspectorTest.addResult(""); | 91 InspectorTest.addResult(""); |
| 92 InspectorTest.addSniffer(WebInspector.domStorageModel, "_domStor
ageItemAdded", itemAdded); | 92 InspectorTest.addSniffer(InspectorTest.domStorageModel, "_domSto
rageItemAdded", itemAdded); |
| 93 var command = "addItem('key" + index + "', 'value" + index + "')
;"; | 93 var command = "addItem('key" + index + "', 'value" + index + "')
;"; |
| 94 InspectorTest.addResult(command); | 94 InspectorTest.addResult(command); |
| 95 InspectorTest.evaluateInPage(command); | 95 InspectorTest.evaluateInPage(command); |
| 96 } | 96 } |
| 97 | 97 |
| 98 addItem(); | 98 addItem(); |
| 99 }, | 99 }, |
| 100 | 100 |
| 101 function removeItemTest(next) | 101 function removeItemTest(next) |
| 102 { | 102 { |
| 103 var indicesToRemove = [1, 3, 5]; | 103 var indicesToRemove = [1, 3, 5]; |
| 104 | 104 |
| 105 function itemRemoved() | 105 function itemRemoved() |
| 106 { | 106 { |
| 107 dumpDataGrid(view._dataGrid.rootNode()); | 107 dumpDataGrid(view._dataGrid.rootNode()); |
| 108 removeItem(); | 108 removeItem(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 function removeItem() | 111 function removeItem() |
| 112 { | 112 { |
| 113 var index = indicesToRemove.shift(); | 113 var index = indicesToRemove.shift(); |
| 114 if (!index) { | 114 if (!index) { |
| 115 next(); | 115 next(); |
| 116 return; | 116 return; |
| 117 } | 117 } |
| 118 InspectorTest.addResult(""); | 118 InspectorTest.addResult(""); |
| 119 InspectorTest.addSniffer(WebInspector.domStorageModel, "_domStor
ageItemRemoved", itemRemoved); | 119 InspectorTest.addSniffer(InspectorTest.domStorageModel, "_domSto
rageItemRemoved", itemRemoved); |
| 120 var command = "removeItem('key" + index + "');"; | 120 var command = "removeItem('key" + index + "');"; |
| 121 InspectorTest.addResult(command); | 121 InspectorTest.addResult(command); |
| 122 InspectorTest.evaluateInPage(command); | 122 InspectorTest.evaluateInPage(command); |
| 123 } | 123 } |
| 124 | 124 |
| 125 removeItem(); | 125 removeItem(); |
| 126 }, | 126 }, |
| 127 | 127 |
| 128 function updateItemTest(next) | 128 function updateItemTest(next) |
| 129 { | 129 { |
| 130 InspectorTest.addResult(""); | 130 InspectorTest.addResult(""); |
| 131 InspectorTest.addSniffer(WebInspector.domStorageModel, "_domStorageI
temUpdated", itemUpdated); | 131 InspectorTest.addSniffer(InspectorTest.domStorageModel, "_domStorage
ItemUpdated", itemUpdated); |
| 132 var command = "updateItem('key2', 'VALUE2');"; | 132 var command = "updateItem('key2', 'VALUE2');"; |
| 133 InspectorTest.addResult(command); | 133 InspectorTest.addResult(command); |
| 134 InspectorTest.evaluateInPage(command); | 134 InspectorTest.evaluateInPage(command); |
| 135 | 135 |
| 136 function itemUpdated() | 136 function itemUpdated() |
| 137 { | 137 { |
| 138 dumpDataGrid(view._dataGrid.rootNode()); | 138 dumpDataGrid(view._dataGrid.rootNode()); |
| 139 next(); | 139 next(); |
| 140 } | 140 } |
| 141 }, | 141 }, |
| 142 | 142 |
| 143 function clearTest(next) | 143 function clearTest(next) |
| 144 { | 144 { |
| 145 function itemsCleared() | 145 function itemsCleared() |
| 146 { | 146 { |
| 147 dumpDataGrid(view._dataGrid.rootNode()); | 147 dumpDataGrid(view._dataGrid.rootNode()); |
| 148 next(); | 148 next(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 InspectorTest.addResult(""); | 151 InspectorTest.addResult(""); |
| 152 InspectorTest.addSniffer(WebInspector.domStorageModel, "_domStorageI
temsCleared", itemsCleared); | 152 InspectorTest.addSniffer(InspectorTest.domStorageModel, "_domStorage
ItemsCleared", itemsCleared); |
| 153 var command = "clear()"; | 153 var command = "clear()"; |
| 154 InspectorTest.addResult(command); | 154 InspectorTest.addResult(command); |
| 155 InspectorTest.evaluateInPage(command); | 155 InspectorTest.evaluateInPage(command); |
| 156 } | 156 } |
| 157 ]); | 157 ]); |
| 158 } | 158 } |
| 159 </script> | 159 </script> |
| 160 </head> | 160 </head> |
| 161 | 161 |
| 162 <body onload="runTest()"> | 162 <body onload="runTest()"> |
| 163 <p>Test that storage panel is present and that it contains correct data whenever
localStorage is updated.</p> | 163 <p>Test that storage panel is present and that it contains correct data whenever
localStorage is updated.</p> |
| 164 </body> | 164 </body> |
| 165 </html> | 165 </html> |
| OLD | NEW |