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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/persistence/persistence-sync-content-nodejs.html

Issue 2747863007: DevTools: clean up tests to not depend on NetworkProject.addFile method (Closed)
Patch Set: typo Created 3 years, 9 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
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="../isolated-filesystem-test.js"></script> 5 <script src="../isolated-filesystem-test.js"></script>
6 <script src="./persistence-test.js"></script> 6 <script src="./persistence-test.js"></script>
7 <script> 7 <script>
8 8
9 function test() 9 async function test()
10 { 10 {
11 // Pretend we are running under V8 front-end. 11 // Pretend we are running under V8 front-end.
12 SDK.targetManager.mainTarget().setIsNodeJSForTest(); 12 SDK.targetManager.mainTarget().setIsNodeJSForTest();
13 13
14 var content = [ 14 var content = [
15 '', 15 '',
16 '', 16 '',
17 'var express = require("express");', 17 'var express = require("express");',
18 '//TODO' 18 '//TODO'
19 ].join("\n"); 19 ].join("\n");
20 20
21 var fsContent = Persistence.Persistence._NodeShebang + content; 21 var fsContent = Persistence.Persistence._NodeShebang + content;
22 var nodeContent = Persistence.Persistence._NodePrefix + content + Persistenc e.Persistence._NodeSuffix; 22 var nodeContent = Persistence.Persistence._NodePrefix + content + Persistenc e.Persistence._NodeSuffix;
23 23
24 InspectorTest.addResult("Initial fileSystem content:"); 24 InspectorTest.addResult("Initial fileSystem content:");
25 InspectorTest.addResult(indent(fsContent)); 25 InspectorTest.addResult(indent(fsContent));
26 InspectorTest.addResult("\n Initial network content:"); 26 InspectorTest.addResult("\n Initial network content:");
27 InspectorTest.addResult(indent(nodeContent)); 27 InspectorTest.addResult(indent(nodeContent));
28 28
29 // Add network UISourceCode. 29 await InspectorTest.addScriptUISourceCode("http://127.0.0.1:8000/nodejs.js", nodeContent);
30 var networkProject = Bindings.NetworkProject.forTarget(SDK.targetManager.mai nTarget());
31 var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(SDK.targetManager.m ainTarget());
32 var mainFrame = resourceTreeModel.mainFrame;
33 var contentProvider = new Common.StaticContentProvider("http://127.0.0.1:800 0/nodejs.js", Common.resourceTypes.Script, () => Promise.resolve(nodeContent));
34 networkProject.addFile(contentProvider, mainFrame, false);
35 30
36 // Add filesystem UISourceCode and mapping. 31 // Add filesystem UISourceCode and mapping.
37 var fs = new InspectorTest.TestFileSystem("file:///var/www"); 32 var fs = new InspectorTest.TestFileSystem("file:///var/www");
38 var fsEntry = fs.root.addFile("nodejs.js", fsContent); 33 var fsEntry = fs.root.addFile("nodejs.js", fsContent);
39 fs.addFileMapping("http://127.0.0.1:8000", "/"); 34 fs.addFileMapping("http://127.0.0.1:8000", "/");
40 fs.reportCreated(function() { }); 35 fs.reportCreated(function() { });
41 36
42 var binding; 37 var binding;
43 InspectorTest.waitForBinding("nodejs.js").then(onBindingCreated); 38 InspectorTest.waitForBinding("nodejs.js").then(onBindingCreated);
44 39
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 { 112 {
118 return content.split("\n").map(line => " " + line).join("\n"); 113 return content.split("\n").map(line => " " + line).join("\n");
119 } 114 }
120 }; 115 };
121 </script> 116 </script>
122 </head> 117 </head>
123 <body onload="runTest()"> 118 <body onload="runTest()">
124 <p>Verify that syncing Node.js contents works fine.</p> 119 <p>Verify that syncing Node.js contents works fine.</p>
125 </body> 120 </body>
126 </html> 121 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698