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

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 testcase 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-merge-editor-tabs-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(onFileSystemSourceCode)
41 .then(onFileSystemTab);
42
43 function onFileSystemSourceCode(code)
44 {
45 code.setWorkingCopy("\n\nwindow.foo = ()=>'foo2';");
46 return InspectorTest.showUISourceCodePromise(code);
47 }
48
49 function onFileSystemTab(sourceFrame)
50 {
51 fileSystemSourceFrame = sourceFrame;
52 fileSystemSourceFrame.setSelection(new WebInspector.TextRange(2, 0, 2, 5));
53 fileSystemSourceFrame.scrollToLine(2);
54 dumpSourceFrame(fileSystemSourceFrame);
34 dumpEditorTabs(); 55 dumpEditorTabs();
35 next(); 56 next();
36 } 57 }
37 }, 58 },
38 59
39 function addFileMapping(next) 60 function addFileMapping(next)
40 { 61 {
41 InspectorTest.waitForBinding("foo.js").then(onBindingCreated); 62 InspectorTest.waitForBinding("foo.js").then(onBindingCreated);
42 WebInspector.fileSystemMapping.addFileMapping(fs.fileSystemPath, "ht tp://127.0.0.1:8000", "/"); 63 WebInspector.fileSystemMapping.addFileMapping(fs.fileSystemPath, "ht tp://127.0.0.1:8000", "/");
43 64
44 function onBindingCreated(binding) 65 function onBindingCreated()
45 { 66 {
46 dumpEditorTabs(); 67 dumpEditorTabs();
68 dumpSourceFrame(networkSourceFrame);
47 next(); 69 next();
48 } 70 }
49 }, 71 },
50 72
51 function removeFileMapping(next) 73 function removeFileMapping(next)
52 { 74 {
53 WebInspector.persistence.addEventListener(WebInspector.Persistence.E vents.BindingRemoved, onBindingRemoved); 75 WebInspector.persistence.addEventListener(WebInspector.Persistence.E vents.BindingRemoved, onBindingRemoved);
54 WebInspector.fileSystemMapping.removeFileMapping(fs.fileSystemPath, "http://127.0.0.1:8000", "/"); 76 WebInspector.fileSystemMapping.removeFileMapping(fs.fileSystemPath, "http://127.0.0.1:8000", "/");
55 77
56 function onBindingRemoved(event) 78 function onBindingRemoved(event)
57 { 79 {
58 var binding = event.data; 80 var binding = event.data;
59 if (binding.network.name() !== "foo.js") 81 if (binding.network.name() !== "foo.js")
60 return 82 return
61 WebInspector.persistence.removeEventListener(WebInspector.Persis tence.Events.BindingRemoved, onBindingRemoved); 83 WebInspector.persistence.removeEventListener(WebInspector.Persis tence.Events.BindingRemoved, onBindingRemoved);
62 dumpEditorTabs(); 84 dumpEditorTabs();
85 dumpSourceFrame(networkSourceFrame);
63 next(); 86 next();
64 } 87 }
65 }, 88 },
66 ]); 89 ]);
67 90
68 function dumpEditorTabs() 91 function dumpEditorTabs()
69 { 92 {
70 var editorContainer = WebInspector.panels.sources._sourcesView._editorCo ntainer; 93 var editorContainer = WebInspector.panels.sources._sourcesView._editorCo ntainer;
71 var openedUISourceCodes = editorContainer._tabIds.keysArray(); 94 var openedUISourceCodes = editorContainer._tabIds.keysArray();
72 openedUISourceCodes.sort((a, b) => a.url().compareTo(b.url())); 95 openedUISourceCodes.sort((a, b) => a.url().compareTo(b.url()));
73 InspectorTest.addResult("Opened tabs: "); 96 InspectorTest.addResult("Opened tabs: ");
74 for (code of openedUISourceCodes) 97 for (code of openedUISourceCodes)
75 InspectorTest.addResult(" " + code.url()); 98 InspectorTest.addResult(" " + code.url());
76 } 99 }
100
101 function dumpSourceFrame(sourceFrame)
102 {
103 InspectorTest.addResult("SourceFrame: " + sourceFrame._url);
104 InspectorTest.addResult(" selection: " + sourceFrame.selection());
105 InspectorTest.addResult(" firstVisibleLine: " + sourceFrame.textEdito r.firstVisibleLine());
106 InspectorTest.addResult(" isDirty: " + sourceFrame.uiSourceCode().isD irty());
107 }
77 }; 108 };
78 </script> 109 </script>
79 </head> 110 </head>
80 <body onload="runTest()"> 111 <body onload="runTest()">
81 <p>Verify that tabs get merged and split when binding is added and removed.</p> 112 <p>Verify that tabs get merged and split when binding is added and removed.</p>
82 </body> 113 </body>
83 </html> 114 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-merge-editor-tabs-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698