Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / storage-panel-dom-storage-update.html
blobd818a53c8b006a1ef63dcb8b50411478cca4508a
1 <html>
2 <head>
3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script src="../http/tests/inspector/resources-test.js"></script>
5 <script>
7 function addItem(key, value)
9 localStorage.setItem(key, value);
12 function removeItem(key)
14 localStorage.removeItem(key);
17 function updateItem(key, newValue)
19 localStorage.setItem(key, newValue);
22 function clear()
24 localStorage.clear();
27 function test()
29 var view = null;
31 function dumpDataGrid(rootNode)
33 var nodes = rootNode.children;
34 var rows = [];
35 for (var i = 0; i < nodes.length; ++i) {
36 var node = nodes[i];
37 if (typeof node._data.key === "string")
38 rows.push(node._data.key + " = " + node._data.value);
40 rows.sort();
41 InspectorTest.addResult("Table rows: [" + rows.join(", ") + "]");
44 InspectorTest.runTestSuite([
45 function initialize(next)
47 InspectorTest.evaluateInPage("clear();", next);
50 function updateLocalStorageView(next)
52 function viewUpdated(items)
54 InspectorTest.addResult("Resource Panel with localStorage view updated.");
55 next();
58 var storage = null;
59 var storages = InspectorTest.domStorageModel().storages();
60 for (var i = 0; i < storages.length; ++i) {
61 if (storages[i].isLocalStorage) {
62 storage = storages[i];
63 break;
67 InspectorTest.assertTrue(!!storage, "Local storage not found.");
69 WebInspector.panels.resources._showDOMStorage(storage);
70 view = WebInspector.panels.resources._domStorageViews.get(storage);
71 InspectorTest.addSniffer(view, "_dataGridForDOMStorageItems", viewUpdated);
74 function addItemTest(next)
76 var indicesToAdd = [1, 2, 3, 4, 5, 6];
78 function itemAdded()
80 dumpDataGrid(view._dataGrid.rootNode());
81 addItem();
84 function addItem()
86 var index = indicesToAdd.shift();
87 if (!index) {
88 next();
89 return;
91 InspectorTest.addResult("");
92 InspectorTest.addSniffer(InspectorTest.domStorageModel(), "_domStorageItemAdded", itemAdded);
93 var command = "addItem('key" + index + "', 'value" + index + "');";
94 InspectorTest.addResult(command);
95 InspectorTest.evaluateInPage(command);
98 addItem();
101 function removeItemTest(next)
103 var indicesToRemove = [1, 3, 5];
105 function itemRemoved()
107 dumpDataGrid(view._dataGrid.rootNode());
108 removeItem();
111 function removeItem()
113 var index = indicesToRemove.shift();
114 if (!index) {
115 next();
116 return;
118 InspectorTest.addResult("");
119 InspectorTest.addSniffer(InspectorTest.domStorageModel(), "_domStorageItemRemoved", itemRemoved);
120 var command = "removeItem('key" + index + "');";
121 InspectorTest.addResult(command);
122 InspectorTest.evaluateInPage(command);
125 removeItem();
128 function updateItemTest(next)
130 InspectorTest.addResult("");
131 InspectorTest.addSniffer(InspectorTest.domStorageModel(), "_domStorageItemUpdated", itemUpdated);
132 var command = "updateItem('key2', 'VALUE2');";
133 InspectorTest.addResult(command);
134 InspectorTest.evaluateInPage(command);
136 function itemUpdated()
138 dumpDataGrid(view._dataGrid.rootNode());
139 next();
143 function clearTest(next)
145 function itemsCleared()
147 dumpDataGrid(view._dataGrid.rootNode());
148 next();
151 InspectorTest.addResult("");
152 InspectorTest.addSniffer(InspectorTest.domStorageModel(), "_domStorageItemsCleared", itemsCleared);
153 var command = "clear()";
154 InspectorTest.addResult(command);
155 InspectorTest.evaluateInPage(command);
159 </script>
160 </head>
162 <body onload="runTest()">
163 <p>Test that storage panel is present and that it contains correct data whenever localStorage is updated.</p>
164 </body>
165 </html>