Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-merge-editor-tabs.html

Issue 2349343002: DevTools: introduce persistence/ module (Closed)
Patch Set: DevTools: add persistence/ module Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 = fs.root.mkdir("inspector").mkdir("persistence").mkdir("resourc es").addFile("foo.js", "window.foo = ()=>'foo';");
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", onBindingCreated);
42 WebInspector.fileSystemMapping.addFileSystem(fs.fileSystemPath);
43 WebInspector.fileSystemMapping.addFileMapping(fs.fileSystemPath, "ht tp://127.0.0.1:8000", "/");
44
45 function onBindingCreated(binding)
46 {
47 dumpEditorTabs();
48 next();
49 }
50 },
51
52 function removeFileMapping(next)
53 {
54 WebInspector.persistence.addEventListener(WebInspector.Persistence.E vents.BindingRemoved, onBindingRemoved);
55 WebInspector.fileSystemMapping.removeFileMapping(fs.fileSystemPath, "http://127.0.0.1:8000", "/");
56
57 function onBindingRemoved(event)
58 {
59 var binding = event.data;
60 if (binding.network.name() !== "foo.js")
61 return
62 WebInspector.persistence.removeEventListener(WebInspector.Persis tence.Events.BindingRemoved, onBindingRemoved);
63 dumpEditorTabs();
64 next();
65 }
66 },
67 ]);
68
69 function dumpEditorTabs()
70 {
71 var editorContainer = WebInspector.panels.sources._sourcesView._editorCo ntainer;
72 var openedUISourceCodes = editorContainer._tabIds.keysArray();
73 openedUISourceCodes.sort((a, b) => a.url().compareTo(b.url()));
74 InspectorTest.addResult("Opened tabs: ");
75 for (code of openedUISourceCodes)
76 InspectorTest.addResult(" " + code.url());
77 }
78 };
79 </script>
80 </head>
81 <body onload="runTest()">
82 <p>Verify that tabs get merged and split when binding is added and removed.</p>
83 </body>
84 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698