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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/workspace-mapping.html

Issue 1523193002: DevTools: merge UISourceCode's parentPath, name, originURL and uri. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined Created 5 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/workspace-test.js"></script> 4 <script src="../http/tests/inspector/workspace-test.js"></script>
5 <script> 5 <script>
6 function test() 6 function test()
7 { 7 {
8 var uiSourceCodes = {}; 8 var uiSourceCodes = {};
9 var projects = {}; 9 var projects = {};
10 var workspace = new WebInspector.Workspace(); 10 var workspace = new WebInspector.Workspace();
11 11
12 function createUISourceCode(projectId, path) 12 function createUISourceCode(projectId, path)
13 { 13 {
14 var project = projects[projectId]; 14 var project = projects[projectId];
15 if (!projects[projectId]) { 15 if (!projects[projectId]) {
16 if (projectId.startsWith("1:")) 16 if (projectId.startsWith("1:"))
17 projectId = projectId.substring(2); 17 projectId = projectId.substring(2);
18 project = new WebInspector.ProjectStore(workspace, projectId, WebIns pector.projectTypes.Network, projectId, ""); 18 project = new WebInspector.ProjectStore(workspace, projectId, WebIns pector.projectTypes.Network, "");
19 workspace.addProject(project); 19 workspace.addProject(project);
20 projects[projectId] = project; 20 projects[projectId] = project;
21 } 21 }
22 var parentPath = path.substring(0, path.lastIndexOf("/")); 22 var uiSourceCode = project.createUISourceCode(path, WebInspector.resourc eTypes.Script);
23 var name = path.substring(path.lastIndexOf("/") + 1);
24 var uiSourceCode = project.createUISourceCode(parentPath, name, path, We bInspector.resourceTypes.Script);
25 project.addUISourceCode(uiSourceCode); 23 project.addUISourceCode(uiSourceCode);
26 } 24 }
27 25
28 var fileSystemMapping = new WebInspector.FileSystemMapping(); 26 var fileSystemMapping = new WebInspector.FileSystemMapping();
29 var fileSystemPath = "/var/www"; 27 var fileSystemPath = "/var/www";
30 var projectId = WebInspector.FileSystemWorkspaceBinding.projectId(fileSystem Path); 28 var projectId = WebInspector.FileSystemWorkspaceBinding.projectId(fileSystem Path);
31 fileSystemMapping.addFileSystem("/var/www"); 29 fileSystemMapping.addFileSystem("/var/www");
32 fileSystemMapping.addFileMapping("/var/www", "http://localhost/", "/localhos t/"); 30 fileSystemMapping.addFileMapping("/var/www", "http://localhost/", "/localhos t/");
33 var fileSystemWorkspaceBinding = new WebInspector.FileSystemWorkspaceBinding (WebInspector.isolatedFileSystemManager, workspace); 31 var fileSystemWorkspaceBinding = new WebInspector.FileSystemWorkspaceBinding (WebInspector.isolatedFileSystemManager, workspace);
34 var networkMapping = new WebInspector.NetworkMapping(WebInspector.targetMana ger, workspace, fileSystemWorkspaceBinding, fileSystemMapping); 32 var networkMapping = new WebInspector.NetworkMapping(WebInspector.targetMana ger, workspace, fileSystemWorkspaceBinding, fileSystemMapping);
35 33
36 function dumpHasMappingForURL(url) 34 function dumpHasMappingForURL(url)
37 { 35 {
38 var result = networkMapping.hasMappingForURL(url) 36 var result = networkMapping.hasMappingForURL(url)
39 if (result) 37 if (result)
40 InspectorTest.addResult(" url " + url + " is mapped."); 38 InspectorTest.addResult(" url " + url + " is mapped.");
41 else 39 else
42 InspectorTest.addResult(" url " + url + " is not mapped."); 40 InspectorTest.addResult(" url " + url + " is not mapped.");
43 } 41 }
44 42
45 function dumpUISourceCodeForURL(url) 43 function dumpUISourceCodeForURL(url)
46 { 44 {
47 var uiSourceCode = networkMapping.uiSourceCodeForURLForAnyTarget(url); 45 var uiSourceCode = networkMapping.uiSourceCodeForURLForAnyTarget(url);
48 InspectorTest.addResult(" url " + url + " is mapped to " + (uiSourceC ode ? uiSourceCode.uri() : null)); 46 InspectorTest.addResult(" url " + url + " is mapped to " + (uiSourceC ode ? uiSourceCode.uri() : null));
49 } 47 }
50 48
51 function dumpURLForPath(fileSystemPath, filePath) 49 function dumpURLForPath(fileSystemPath, filePath)
52 { 50 {
53 var url = networkMapping.urlForPath(fileSystemPath, filePath) 51 var url = networkMapping._urlForPath(fileSystemPath, "file://" + fileSys temPath + "/" + filePath)
54 InspectorTest.addResult(" path " + fileSystemPath + " / " + filePath + " is mapped to " + (url ? url : null)); 52 InspectorTest.addResult(" path " + fileSystemPath + " / " + filePath + " is mapped to " + (url ? url : null));
55 } 53 }
56 54
57 createUISourceCode(projectId, "localhost/index.html"); 55 createUISourceCode(projectId, "file:///var/www/localhost/index.html");
58 56
59 createUISourceCode("1:http://www.example.com", "index.html"); 57 createUISourceCode("1:http://www.example.com", "index.html");
60 createUISourceCode("1:http://localhost", "index.html"); 58 createUISourceCode("1:http://localhost", "index.html");
61 createUISourceCode("1:http://localhost", "foo/index.html"); 59 createUISourceCode("1:http://localhost", "foo/index.html");
62 createUISourceCode("1:https://localhost", "index.html"); 60 createUISourceCode("1:https://localhost", "index.html");
63 61
64 dumpHasMappingForURL("http://www.example.com/index.html"); 62 dumpHasMappingForURL("http://www.example.com/index.html");
65 dumpHasMappingForURL("http://localhost/index.html"); 63 dumpHasMappingForURL("http://localhost/index.html");
66 dumpHasMappingForURL("http://localhost/foo/index.html"); 64 dumpHasMappingForURL("http://localhost/foo/index.html");
67 dumpHasMappingForURL("https://localhost/index.html"); 65 dumpHasMappingForURL("https://localhost/index.html");
(...skipping 12 matching lines...) Expand all
80 dumpURLForPath("/home/foo", "index.html"); 78 dumpURLForPath("/home/foo", "index.html");
81 79
82 InspectorTest.completeTest(); 80 InspectorTest.completeTest();
83 } 81 }
84 </script> 82 </script>
85 </head> 83 </head>
86 <body onload="runTest()"> 84 <body onload="runTest()">
87 <p>Tests workspace mappings</p> 85 <p>Tests workspace mappings</p>
88 </body> 86 </body>
89 </html> 87 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698