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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/file-system-project.html

Issue 2533073003: [DevTools] Remove workspace-test.js part1. (Closed)
Patch Set: Created 4 years 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="../http/tests/inspector/inspector-test.js"></script> 3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script src="../http/tests/inspector/debugger-test.js"></script> 4 <script src="../http/tests/inspector/debugger-test.js"></script>
5 <script src="../http/tests/inspector/workspace-test.js"></script>
6 <script src="../http/tests/inspector/isolated-filesystem-test.js"></script> 5 <script src="../http/tests/inspector/isolated-filesystem-test.js"></script>
7 <script> 6 <script>
8 function test() 7 function test()
9 { 8 {
9 function fileSystemUISourceCodes()
10 {
11 var uiSourceCodes = [];
12 var fileSystemProjects = Workspace.workspace.projectsForType(Workspace.p rojectTypes.FileSystem);
13 for (var project of fileSystemProjects)
14 uiSourceCodes = uiSourceCodes.concat(project.uiSourceCodes());
15 return uiSourceCodes;
16 }
17
18 function dumpUISourceCode(uiSourceCode, callback)
19 {
20 InspectorTest.addResult("UISourceCode: " + uiSourceCode.url().replace(/. *LayoutTests/, "LayoutTests"));
21 if (uiSourceCode.contentType() === Common.resourceTypes.Script || uiSour ceCode.contentType() === Common.resourceTypes.Document)
22 InspectorTest.addResult("UISourceCode is content script: " + (uiSour ceCode.project().type() === Workspace.projectTypes.ContentScripts));
23 uiSourceCode.requestContent().then(didRequestContent);
24
25 function didRequestContent(content, contentEncoded)
26 {
27 InspectorTest.addResult("Highlighter type: " + Bindings.NetworkProje ct.uiSourceCodeMimeType(uiSourceCode));
28 InspectorTest.addResult("UISourceCode content: " + content);
29 callback();
30 }
31 }
32
10 function dumpUISourceCodes(uiSourceCodes, next) 33 function dumpUISourceCodes(uiSourceCodes, next)
11 { 34 {
12 innerDumpUISourceCodes(uiSourceCodes, 0, next); 35 innerDumpUISourceCodes(uiSourceCodes, 0, next);
13 36
14 function innerDumpUISourceCodes(uiSourceCodes, startIndex, next) 37 function innerDumpUISourceCodes(uiSourceCodes, startIndex, next)
15 { 38 {
16 InspectorTest.addResult(""); 39 InspectorTest.addResult("");
17 if (startIndex === uiSourceCodes.length) { 40 if (startIndex === uiSourceCodes.length) {
18 next(); 41 next();
19 return; 42 return;
20 } 43 }
21 44
22 InspectorTest.dumpUISourceCode(uiSourceCodes[startIndex], innerDumpU ISourceCodes.bind(this, uiSourceCodes, startIndex + 1, next)); 45 dumpUISourceCode(uiSourceCodes[startIndex], innerDumpUISourceCodes.b ind(this, uiSourceCodes, startIndex + 1, next));
23 } 46 }
24 } 47 }
25 48
26 function dumpUISourceCodeLocations(uiSourceCodes, lineNumber) 49 function dumpUISourceCodeLocations(uiSourceCodes, lineNumber)
27 { 50 {
28 InspectorTest.addResult("Dumping uiSourceCode location link texts:"); 51 InspectorTest.addResult("Dumping uiSourceCode location link texts:");
29 for (var i = 0; i < uiSourceCodes.length; ++i) { 52 for (var i = 0; i < uiSourceCodes.length; ++i) {
30 var uiSourceCode = uiSourceCodes[i]; 53 var uiSourceCode = uiSourceCodes[i];
31 var uiLocation = uiSourceCode.uiLocation(lineNumber); 54 var uiLocation = uiSourceCode.uiLocation(lineNumber);
32 InspectorTest.addResult(" - " + uiLocation.linkText()); 55 InspectorTest.addResult(" - " + uiLocation.linkText());
33 } 56 }
34 } 57 }
35 58
36 function dumpWorkspaceUISourceCodes() 59 function dumpWorkspaceUISourceCodes()
37 { 60 {
38 InspectorTest.addResult("Dumping uiSourceCodes origin URLs:"); 61 InspectorTest.addResult("Dumping uiSourceCodes origin URLs:");
39 var uiSourceCodes = InspectorTest.fileSystemUISourceCodes(); 62 var uiSourceCodes = fileSystemUISourceCodes();
40 for (var i = 0; i < uiSourceCodes.length; ++i) 63 for (var i = 0; i < uiSourceCodes.length; ++i)
41 InspectorTest.addResult(" - " + uiSourceCodes[i].url()); 64 InspectorTest.addResult(" - " + uiSourceCodes[i].url());
42 } 65 }
43 66
44 function createFileSystem(name, callback) 67 function createFileSystem(name, callback)
45 { 68 {
46 var fs = new InspectorTest.TestFileSystem(name); 69 var fs = new InspectorTest.TestFileSystem(name);
47 fs.root.mkdir("html").addFile("foo.js", ""); 70 fs.root.mkdir("html").addFile("foo.js", "");
48 fs.root.mkdir(".git").addFile("foogit.js", ""); 71 fs.root.mkdir(".git").addFile("foogit.js", "");
49 fs.root.addFile("bar.js", ""); 72 fs.root.addFile("bar.js", "");
(...skipping 29 matching lines...) Expand all
79 if (--count) 102 if (--count)
80 return; 103 return;
81 Workspace.workspace.removeEventListener(Workspace.Workspace.Even ts.UISourceCodeAdded, onUISourceCode); 104 Workspace.workspace.removeEventListener(Workspace.Workspace.Even ts.UISourceCodeAdded, onUISourceCode);
82 onUISourceCodesLoaded(); 105 onUISourceCodesLoaded();
83 } 106 }
84 107
85 var uiSourceCodes; 108 var uiSourceCodes;
86 109
87 function onUISourceCodesLoaded() 110 function onUISourceCodesLoaded()
88 { 111 {
89 uiSourceCodes = InspectorTest.fileSystemUISourceCodes(); 112 uiSourceCodes = fileSystemUISourceCodes();
90 dumpUISourceCodes(uiSourceCodes, uiSourceCodesDumped); 113 dumpUISourceCodes(uiSourceCodes, uiSourceCodesDumped);
91 } 114 }
92 115
93 function uiSourceCodesDumped() 116 function uiSourceCodesDumped()
94 { 117 {
95 dumpUISourceCodeLocations(uiSourceCodes, 5); 118 dumpUISourceCodeLocations(uiSourceCodes, 5);
96 Workspace.workspace.addEventListener(Workspace.Workspace.Events. WorkingCopyCommitted, contentCommitted, this); 119 Workspace.workspace.addEventListener(Workspace.Workspace.Events. WorkingCopyCommitted, contentCommitted, this);
97 uiSourceCodes[0].addRevision("<Modified UISourceCode content>"); 120 uiSourceCodes[0].addRevision("<Modified UISourceCode content>");
98 } 121 }
99 122
100 function contentCommitted() 123 function contentCommitted()
101 { 124 {
102 InspectorTest.addResult("After revision added:"); 125 InspectorTest.addResult("After revision added:");
103 InspectorTest.dumpUISourceCode(uiSourceCodes[0], finalize); 126 dumpUISourceCode(uiSourceCodes[0], finalize);
104 } 127 }
105 128
106 function finalize() 129 function finalize()
107 { 130 {
108 fs1.reportRemoved(); 131 fs1.reportRemoved();
109 fs2.reportRemoved(); 132 fs2.reportRemoved();
110 next(); 133 next();
111 } 134 }
112 }, 135 },
113 136
(...skipping 25 matching lines...) Expand all
139 next(); 162 next();
140 } 163 }
141 }, 164 },
142 165
143 function testExcludesViaDelegate(next) 166 function testExcludesViaDelegate(next)
144 { 167 {
145 createFileSystem("file:///var/www3", dumpExcludes); 168 createFileSystem("file:///var/www3", dumpExcludes);
146 169
147 function dumpExcludes(fs) 170 function dumpExcludes(fs)
148 { 171 {
149 InspectorTest.fileSystemUISourceCodes()[0].project().excludeFold er("file:///var/www3/html2/"); 172 fileSystemUISourceCodes()[0].project().excludeFolder("file:///va r/www3/html2/");
150 InspectorTest.addResult(""); 173 InspectorTest.addResult("");
151 InspectorTest.addResult("-- Excluded /html2/ --"); 174 InspectorTest.addResult("-- Excluded /html2/ --");
152 dumpWorkspaceUISourceCodes(); 175 dumpWorkspaceUISourceCodes();
153 fs.reportRemoved(); 176 fs.reportRemoved();
154 next(); 177 next();
155 } 178 }
156 }, 179 },
157 180
158 function testExcludesViaProject(next) 181 function testExcludesViaProject(next)
159 { 182 {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 } 281 }
259 }, 282 },
260 ]); 283 ]);
261 }; 284 };
262 </script> 285 </script>
263 </head> 286 </head>
264 <body onload="runTest()"> 287 <body onload="runTest()">
265 <p>Tests file system project.</p> 288 <p>Tests file system project.</p>
266 </body> 289 </body>
267 </html> 290 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698