3 <script src=
"../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../http/tests/inspector/resources-test.js"></script>
7 function populateDOMStorage()
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) + ", ";
21 InspectorTest
.evaluateInPage("populateDOMStorage()", function(result
) {
22 InspectorTest
.addResult("Populated local and session storage");
24 function name(storage
)
26 return storage
.isLocalStorage
? "Local storage" : "Session storage";
29 function dumpDataGridContent(dataGrid
)
31 var nodes
= dataGrid
.rootNode().children
;
33 for (var i
= 0; i
< nodes
.length
; ++i
) {
35 if (!node
.isCreationNode
)
36 rows
.push(node
._data
.key
+ node
._data
.value
);
39 InspectorTest
.addResult("KeyValue pairs: " + rows
.join(''));
42 InspectorTest
.runAfterPendingDispatches(function() {
43 var storages
= InspectorTest
.domStorageModel().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
));
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();
70 <body onload=
"runTest()">
72 Test that storage panel is present and that it contains correct data for local and session DOM storages.