3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script type="text/javascript">
7 function dumpHistory(history)
9 InspectorTest.addResult(" history = " + JSON.stringify(history._serializeToObject()) + "");
12 function updateScrollAndSelectionAndDump(history, url, scrollLineNumber, selection)
14 history.updateScrollLineNumber(url, scrollLineNumber);
15 history.updateSelectionRange(url, selection);
19 function updateAndDump(history, urls)
25 function removeAndDump(history, url)
33 return "url_" + index;
36 var history = new WebInspector.TabbedEditorContainer.History([]);
39 // Emulate opening of several tabs.
40 updateAndDump(history, [url(1)]);
41 updateAndDump(history, [url(2), url(1)]);
42 updateAndDump(history, [url(3), url(2), url(1)]);
43 // Emulate switching between tabs.
44 updateAndDump(history, [url(2), url(3), url(1)]);
45 updateAndDump(history, [url(1), url(2), url(3)]);
46 // Emulate opening of several tabs from another page.
47 updateAndDump(history, [url(11)]);
48 updateAndDump(history, [url(12), url(11)]);
49 updateAndDump(history, [url(13), url(12), url(11)]);
50 // ... and switching between them.
51 updateAndDump(history, [url(12), url(13), url(11)]);
52 updateAndDump(history, [url(11), url(12), url(13)]);
53 updateScrollAndSelectionAndDump(history, url(11), 10, new WebInspector.TextRange(15, 5, 15, 10));
54 // Now close some tabs.
55 removeAndDump(history, url(11));
56 removeAndDump(history, url(13));
57 // Now open some other instead of them.
58 updateAndDump(history, [url(14), url(12)]);
59 updateAndDump(history, [url(15), url(14), url(12)]);
60 updateAndDump(history, [url(16), url(15), url(14), url(12)]);
61 // Close all of them one by one.
62 removeAndDump(history, url(16));
63 removeAndDump(history, url(15));
64 removeAndDump(history, url(14));
65 removeAndDump(history, url(12));
66 removeAndDump(history, url(1));
67 removeAndDump(history, url(2));
68 removeAndDump(history, url(3));
70 InspectorTest.completeTest();
74 <body onload="runTest()">
75 <p>Tests history saving logic in TabbedEditorContainer.</p>
76 <a href="https://bugs.webkit.org/show_bug.cgi?id=76912">Bug 76912</a>