| <html> |
| <head> |
| <script src="../inspector-test.js"></script> |
| <script src="../debugger-test.js"></script> |
| <script src="../isolated-filesystem-test.js"></script> |
| <script src="./persistence-test.js"></script> |
| <script src="./resources/foo.js"></script> |
| <script src="./resources/bar.js"></script> |
| <script src="./resources/baz.js"></script> |
| <script> |
| |
| function test() |
| { |
| InspectorTest.forceUseDefaultMapping(); |
| var fs = new InspectorTest.TestFileSystem("file:///var/www"); |
| var folder = fs.root.mkdir("inspector").mkdir("persistence").mkdir("resources"); |
| folder.addFile("foo.js", "\n\nwindow.foo = ()=>'foo';"); |
| folder.addFile("bar.js", "window.bar = () => \"bar\";"); |
| folder.addFile("baz.js", "window.baz = () => \"baz\";"); |
| fs.addFileMapping("http://127.0.0.1:8000", "/"); |
| fs.reportCreated(function() { }); |
| |
| InspectorTest.runTestSuite([ |
| function waitForBindings(next) |
| { |
| Promise.all([ |
| InspectorTest.waitForBinding("foo.js"), |
| InspectorTest.waitForBinding("bar.js"), |
| InspectorTest.waitForBinding("baz.js") |
| ]).then(next); |
| }, |
| |
| function openNetworkFiles(next) |
| { |
| Promise.all([ |
| InspectorTest.waitForUISourceCode("foo.js", Workspace.projectTypes.Network), |
| InspectorTest.waitForUISourceCode("bar.js", Workspace.projectTypes.Network), |
| InspectorTest.waitForUISourceCode("baz.js", Workspace.projectTypes.Network) |
| ]).then(onUISourceCodes); |
| |
| function onUISourceCodes(uiSourceCodes) |
| { |
| for (var uiSourceCode of uiSourceCodes) |
| InspectorTest.showUISourceCode(uiSourceCode, function() { }); |
| dumpTabs("initial tabs:"); |
| next(); |
| } |
| }, |
| |
| function reloadPage(next) |
| { |
| InspectorTest.hardReloadPage(onReloaded); |
| |
| function onReloaded() |
| { |
| Promise.all([ |
| InspectorTest.waitForBinding("foo.js"), |
| InspectorTest.waitForBinding("bar.js"), |
| InspectorTest.waitForBinding("baz.js") |
| ]).then(onBindingsRecreated); |
| } |
| |
| function onBindingsRecreated(bindings) |
| { |
| dumpTabs("Tabs after reload:"); |
| next(); |
| } |
| }, |
| ]); |
| |
| function dumpTabs(title) |
| { |
| var tabbedPane = UI.panels.sources._sourcesView._editorContainer._tabbedPane; |
| var tabs = tabbedPane._tabs; |
| InspectorTest.addResult(title); |
| for (var i = 0; i < tabs.length; ++i) { |
| var text = (i + 1) + ": "; |
| text += tabs[i].title; |
| if (tabs[i] === tabbedPane._currentTab) |
| text += " [selected]"; |
| InspectorTest.addResult(" " + text); |
| } |
| } |
| }; |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Verify that tabbed editor doesn't shuffle tabs when bindings are dropped and then re-added during reload.</p> |
| </body> |
| </html> |