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> | 4 <script> |
5 | 5 |
6 function addItem(key, value) | 6 function addItem(key, value) |
7 { | 7 { |
8 localStorage.setItem(key, value); | 8 localStorage.setItem(key, value); |
9 } | 9 } |
10 | 10 |
11 function removeItem(key) | 11 function removeItem(key) |
12 { | 12 { |
13 localStorage.removeItem(key); | 13 localStorage.removeItem(key); |
14 } | 14 } |
15 | 15 |
| 16 function updateItem(key, newValue) |
| 17 { |
| 18 localStorage.setItem(key, newValue); |
| 19 } |
| 20 |
16 function clear() | 21 function clear() |
17 { | 22 { |
18 localStorage.clear(); | 23 localStorage.clear(); |
19 } | 24 } |
20 | 25 |
21 function test() | 26 function test() |
22 { | 27 { |
23 var view = null; | 28 var view = null; |
24 | 29 |
25 // Resources panel must be visible | 30 // Resources panel must be visible |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 InspectorTest.addResult(""); | 120 InspectorTest.addResult(""); |
116 InspectorTest.addSniffer(view.domStorageModel, "_domStorageItemR
emoved", itemRemoved); | 121 InspectorTest.addSniffer(view.domStorageModel, "_domStorageItemR
emoved", itemRemoved); |
117 var command = "removeItem('key" + index + "');"; | 122 var command = "removeItem('key" + index + "');"; |
118 InspectorTest.addResult(command); | 123 InspectorTest.addResult(command); |
119 InspectorTest.evaluateInPage(command); | 124 InspectorTest.evaluateInPage(command); |
120 } | 125 } |
121 | 126 |
122 removeItem(); | 127 removeItem(); |
123 }, | 128 }, |
124 | 129 |
| 130 function updateItemTest(next) |
| 131 { |
| 132 InspectorTest.addResult(""); |
| 133 InspectorTest.addSniffer(view.domStorageModel, "_domStorageItemUpdat
ed", itemUpdated); |
| 134 var command = "updateItem('key2', 'VALUE2');"; |
| 135 InspectorTest.addResult(command); |
| 136 InspectorTest.evaluateInPage(command); |
| 137 |
| 138 function itemUpdated() |
| 139 { |
| 140 dumpDataGrid(view._dataGrid.rootNode()); |
| 141 next(); |
| 142 } |
| 143 }, |
| 144 |
125 function clearTest(next) | 145 function clearTest(next) |
126 { | 146 { |
127 function itemsCleared() | 147 function itemsCleared() |
128 { | 148 { |
129 dumpDataGrid(view._dataGrid.rootNode()); | 149 dumpDataGrid(view._dataGrid.rootNode()); |
130 next(); | 150 next(); |
131 } | 151 } |
132 | 152 |
133 InspectorTest.addResult(""); | 153 InspectorTest.addResult(""); |
134 InspectorTest.addSniffer(view.domStorageModel, "_domStorageItemsClea
red", itemsCleared); | 154 InspectorTest.addSniffer(view.domStorageModel, "_domStorageItemsClea
red", itemsCleared); |
135 var command = "clear()"; | 155 var command = "clear()"; |
136 InspectorTest.addResult(command); | 156 InspectorTest.addResult(command); |
137 InspectorTest.evaluateInPage(command); | 157 InspectorTest.evaluateInPage(command); |
138 } | 158 } |
139 ]); | 159 ]); |
140 } | 160 } |
141 </script> | 161 </script> |
142 </head> | 162 </head> |
143 | 163 |
144 <body onload="runTest()"> | 164 <body onload="runTest()"> |
145 <p>Test that storage panel is present and that it contains correct data whenever
localStorage is updated.</p> | 165 <p>Test that storage panel is present and that it contains correct data whenever
localStorage is updated.</p> |
146 </body> | 166 </body> |
147 </html> | 167 </html> |
OLD | NEW |