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

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

Issue 2435043003: DevTools: restore selection and scrollposition between network and filesystem (Closed)
Patch Set: add test + fix scroll event Created 4 years, 1 month 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
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../inspector-test.js"></script> 3 <script src="../inspector-test.js"></script>
4 <script src="../debugger-test.js"></script> 4 <script src="../debugger-test.js"></script>
5 <script src="../workspace-test.js"></script> 5 <script src="../workspace-test.js"></script>
6 <script src="../isolated-filesystem-test.js"></script> 6 <script src="../isolated-filesystem-test.js"></script>
7 <script src="./persistence-test.js"></script> 7 <script src="./persistence-test.js"></script>
8 <script src="./resources/foo.js"></script> 8 <script src="./resources/foo.js"></script>
9 <script> 9 <script>
10 10
11 function test() 11 function test()
12 { 12 {
13 var fs = new InspectorTest.TestFileSystem("file:///var/www"); 13 var fs = new InspectorTest.TestFileSystem("file:///var/www");
14 var fsEntry = InspectorTest.addFooJSFile(fs); 14 var fsEntry = InspectorTest.addFooJSFile(fs);
15 var networkSourceFrame, fileSystemSourceFrame;
15 16
16 InspectorTest.runTestSuite([ 17 InspectorTest.runTestSuite([
17 function addFileSystem(next) 18 function addFileSystem(next)
18 { 19 {
19 fs.reportCreated(next); 20 fs.reportCreated(next);
20 }, 21 },
21 22
22 function openEditorTabs(next) 23 function openNetworkTab(next)
23 { 24 {
24 var promises = [ 25 InspectorTest.waitForUISourceCode("foo.js", WebInspector.projectType s.Network)
25 InspectorTest.waitForUISourceCode("foo.js", WebInspector.project Types.Network) 26 .then(code => InspectorTest.showUISourceCodePromise(code))
26 .then(code => InspectorTest.showUISourceCode(code)), 27 .then(onNetworkTab);
27 InspectorTest.waitForUISourceCode("foo.js", WebInspector.project Types.FileSystem)
28 .then(code => InspectorTest.showUISourceCode(code))
29 ];
30 Promise.all(promises).then(onTabsOpened);
31 28
32 function onTabsOpened() 29 function onNetworkTab(sourceFrame)
33 { 30 {
31 networkSourceFrame = sourceFrame;
32 dumpSourceFrame(networkSourceFrame);
33 next();
34 }
35 },
36
37 function openFileSystemTab(next)
38 {
39 InspectorTest.waitForUISourceCode("foo.js", WebInspector.projectType s.FileSystem)
40 .then(code => InspectorTest.showUISourceCodePromise(code))
41 .then(onFileSystemTab);
42
43 function onFileSystemTab(sourceFrame)
44 {
45 fileSystemSourceFrame = sourceFrame;
46 fileSystemSourceFrame.setSelection(new WebInspector.TextRange(2, 0, 2, 5));
47 fileSystemSourceFrame.scrollToLine(2);
48 dumpSourceFrame(fileSystemSourceFrame);
34 dumpEditorTabs(); 49 dumpEditorTabs();
35 next(); 50 next();
36 } 51 }
37 }, 52 },
38 53
39 function addFileMapping(next) 54 function addFileMapping(next)
40 { 55 {
41 InspectorTest.waitForBinding("foo.js").then(onBindingCreated); 56 InspectorTest.waitForBinding("foo.js").then(onBindingCreated);
42 WebInspector.fileSystemMapping.addFileMapping(fs.fileSystemPath, "ht tp://127.0.0.1:8000", "/"); 57 WebInspector.fileSystemMapping.addFileMapping(fs.fileSystemPath, "ht tp://127.0.0.1:8000", "/");
43 58
44 function onBindingCreated(binding) 59 function onBindingCreated()
45 { 60 {
46 dumpEditorTabs(); 61 dumpEditorTabs();
62 dumpSourceFrame(networkSourceFrame);
47 next(); 63 next();
48 } 64 }
49 }, 65 },
50 66
51 function removeFileMapping(next) 67 function removeFileMapping(next)
52 { 68 {
53 WebInspector.persistence.addEventListener(WebInspector.Persistence.E vents.BindingRemoved, onBindingRemoved); 69 WebInspector.persistence.addEventListener(WebInspector.Persistence.E vents.BindingRemoved, onBindingRemoved);
54 WebInspector.fileSystemMapping.removeFileMapping(fs.fileSystemPath, "http://127.0.0.1:8000", "/"); 70 WebInspector.fileSystemMapping.removeFileMapping(fs.fileSystemPath, "http://127.0.0.1:8000", "/");
55 71
56 function onBindingRemoved(event) 72 function onBindingRemoved(event)
57 { 73 {
58 var binding = event.data; 74 var binding = event.data;
59 if (binding.network.name() !== "foo.js") 75 if (binding.network.name() !== "foo.js")
60 return 76 return
61 WebInspector.persistence.removeEventListener(WebInspector.Persis tence.Events.BindingRemoved, onBindingRemoved); 77 WebInspector.persistence.removeEventListener(WebInspector.Persis tence.Events.BindingRemoved, onBindingRemoved);
62 dumpEditorTabs(); 78 dumpEditorTabs();
79 dumpSourceFrame(networkSourceFrame);
63 next(); 80 next();
64 } 81 }
65 }, 82 },
66 ]); 83 ]);
67 84
68 function dumpEditorTabs() 85 function dumpEditorTabs()
69 { 86 {
70 var editorContainer = WebInspector.panels.sources._sourcesView._editorCo ntainer; 87 var editorContainer = WebInspector.panels.sources._sourcesView._editorCo ntainer;
71 var openedUISourceCodes = editorContainer._tabIds.keysArray(); 88 var openedUISourceCodes = editorContainer._tabIds.keysArray();
72 openedUISourceCodes.sort((a, b) => a.url().compareTo(b.url())); 89 openedUISourceCodes.sort((a, b) => a.url().compareTo(b.url()));
73 InspectorTest.addResult("Opened tabs: "); 90 InspectorTest.addResult("Opened tabs: ");
74 for (code of openedUISourceCodes) 91 for (code of openedUISourceCodes)
75 InspectorTest.addResult(" " + code.url()); 92 InspectorTest.addResult(" " + code.url());
76 } 93 }
94
95 function dumpSourceFrame(sourceFrame)
96 {
97 InspectorTest.addResult("SourceFrame: " + sourceFrame._url);
98 InspectorTest.addResult(" selection: " + sourceFrame.selection());
99 InspectorTest.addResult(" firstVisibleLine: " + sourceFrame.textEdito r.firstVisibleLine());
100 }
77 }; 101 };
78 </script> 102 </script>
79 </head> 103 </head>
80 <body onload="runTest()"> 104 <body onload="runTest()">
81 <p>Verify that tabs get merged and split when binding is added and removed.</p> 105 <p>Verify that tabs get merged and split when binding is added and removed.</p>
82 </body> 106 </body>
83 </html> 107 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698