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