Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / storage-panel-dom-storage.html
blobaf29f963a4681f014eee09ae83b20bcdb8a9bca1
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 populateDOMStorage()
9 localStorage.clear();
10 sessionStorage.clear();
11 localStorage["resource-history"] = "{}"; // This mitigates file:// localstorage conflict.
12 // Fill local and session storage with some random strings.
13 for (var i = 0; i < 10; i++) {
14 localStorage["a" + i] = "=value" + i + ", ";
15 sessionStorage["b" + i] = "=value" + (i+10) + ", ";
19 function test()
21 InspectorTest.evaluateInPage("populateDOMStorage()", function(result) {
22 InspectorTest.addResult("Populated local and session storage");
23 });
24 function name(storage)
26 return storage.isLocalStorage ? "Local storage" : "Session storage";
29 function dumpDataGridContent(dataGrid)
31 var nodes = dataGrid.rootNode().children;
32 var rows = [];
33 for (var i = 0; i < nodes.length; ++i) {
34 var node = nodes[i];
35 if (!node.isCreationNode)
36 rows.push(node._data.key + node._data.value);
38 rows.sort();
39 InspectorTest.addResult("KeyValue pairs: " + rows.join(''));
42 InspectorTest.runAfterPendingDispatches(function() {
43 var storages = InspectorTest.domStorageModel().storages();
44 if (storages) {
45 for (var i = 0; i < storages.length; i++) {
46 var storage = storages[i];
47 WebInspector.panels.resources._showDOMStorage(storage);
48 InspectorTest.addResult("Did show: " + name(storage));
50 } else
51 InspectorTest.addResult("FAIL: no DOM storages found.");
53 InspectorTest.runAfterPendingDispatches(function() {
54 var storages = InspectorTest.domStorageModel().storages();
55 for (var i = 0; i < storages.length; i++) {
56 var storage = storages[i];
57 InspectorTest.addResult(name(storage) + " content: ");
58 var view = WebInspector.panels.resources._domStorageViews.get(storage);
59 dumpDataGridContent(view._dataGrid);
61 InspectorTest.addResult("DONE");
62 InspectorTest.completeTest();
63 });
64 });
67 </script>
68 </head>
70 <body onload="runTest()">
71 <p>
72 Test that storage panel is present and that it contains correct data for local and session DOM storages.
73 </p>
75 </body>
76 </html>