OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../inspector-test.js"></script> |
| 4 <script src="../debugger-test.js"></script> |
| 5 <script src="../workspace-test.js"></script> |
| 6 <script src="../isolated-filesystem-test.js"></script> |
| 7 <script src="./persistence-test.js"></script> |
| 8 <script src="./resources/foo.js"></script> |
| 9 <script> |
| 10 |
| 11 function test() |
| 12 { |
| 13 var fs = new InspectorTest.TestFileSystem("file:///var/www"); |
| 14 var fsEntry = InspectorTest.addFooJSFile(fs); |
| 15 |
| 16 InspectorTest.runTestSuite([ |
| 17 function addFileSystem(next) |
| 18 { |
| 19 fs.reportCreated(next); |
| 20 }, |
| 21 |
| 22 function openEditorTabs(next) |
| 23 { |
| 24 var promises = [ |
| 25 InspectorTest.waitForUISourceCode("foo.js", WebInspector.project
Types.Network) |
| 26 .then(code => InspectorTest.showUISourceCode(code)), |
| 27 InspectorTest.waitForUISourceCode("foo.js", WebInspector.project
Types.FileSystem) |
| 28 .then(code => InspectorTest.showUISourceCode(code)) |
| 29 ]; |
| 30 Promise.all(promises).then(onTabsOpened); |
| 31 |
| 32 function onTabsOpened() |
| 33 { |
| 34 dumpEditorTabs(); |
| 35 next(); |
| 36 } |
| 37 }, |
| 38 |
| 39 function addFileMapping(next) |
| 40 { |
| 41 InspectorTest.waitForBinding("foo.js").then(onBindingCreated); |
| 42 WebInspector.fileSystemMapping.addFileMapping(fs.fileSystemPath, "ht
tp://127.0.0.1:8000", "/"); |
| 43 |
| 44 function onBindingCreated(binding) |
| 45 { |
| 46 dumpEditorTabs(); |
| 47 next(); |
| 48 } |
| 49 }, |
| 50 |
| 51 function removeFileMapping(next) |
| 52 { |
| 53 WebInspector.persistence.addEventListener(WebInspector.Persistence.E
vents.BindingRemoved, onBindingRemoved); |
| 54 WebInspector.fileSystemMapping.removeFileMapping(fs.fileSystemPath,
"http://127.0.0.1:8000", "/"); |
| 55 |
| 56 function onBindingRemoved(event) |
| 57 { |
| 58 var binding = event.data; |
| 59 if (binding.network.name() !== "foo.js") |
| 60 return |
| 61 WebInspector.persistence.removeEventListener(WebInspector.Persis
tence.Events.BindingRemoved, onBindingRemoved); |
| 62 dumpEditorTabs(); |
| 63 next(); |
| 64 } |
| 65 }, |
| 66 ]); |
| 67 |
| 68 function dumpEditorTabs() |
| 69 { |
| 70 var editorContainer = WebInspector.panels.sources._sourcesView._editorCo
ntainer; |
| 71 var openedUISourceCodes = editorContainer._tabIds.keysArray(); |
| 72 openedUISourceCodes.sort((a, b) => a.url().compareTo(b.url())); |
| 73 InspectorTest.addResult("Opened tabs: "); |
| 74 for (code of openedUISourceCodes) |
| 75 InspectorTest.addResult(" " + code.url()); |
| 76 } |
| 77 }; |
| 78 </script> |
| 79 </head> |
| 80 <body onload="runTest()"> |
| 81 <p>Verify that tabs get merged and split when binding is added and removed.</p> |
| 82 </body> |
| 83 </html> |
OLD | NEW |