Index: third_party/WebKit/LayoutTests/inspector/workspace-mapping.html |
diff --git a/third_party/WebKit/LayoutTests/inspector/workspace-mapping.html b/third_party/WebKit/LayoutTests/inspector/workspace-mapping.html |
index 94f8076347fe2b70a0e15f715a5003c8663746c8..a4ced0cd446c1dad80aa20ffbd1dc6e46bd9c824 100644 |
--- a/third_party/WebKit/LayoutTests/inspector/workspace-mapping.html |
+++ b/third_party/WebKit/LayoutTests/inspector/workspace-mapping.html |
@@ -5,77 +5,41 @@ |
<script> |
function test() |
{ |
- var uiSourceCodes = {}; |
var projects = {}; |
var workspace = new WebInspector.Workspace(); |
- function createUISourceCode(projectId, path) |
+ function createUISourceCode(projectId, relativePath) |
{ |
- if (projectId.startsWith("1:")) |
- projectId = projectId.substring(2); |
var project = projects[projectId]; |
if (!projects[projectId]) { |
- project = new WebInspector.ProjectStore(workspace, projectId, WebInspector.projectTypes.Network, ""); |
+ var projectType = projectId.startsWith("file") ? WebInspector.projectTypes.FileSystem : WebInspector.projectTypes.Network; |
+ project = new WebInspector.ProjectStore(workspace, projectId, projectType, ""); |
workspace.addProject(project); |
projects[projectId] = project; |
} |
- var uiSourceCode = project.createUISourceCode(path, WebInspector.resourceTypes.Script); |
+ var uiSourceCode = project.createUISourceCode(projectId +"/" + relativePath, WebInspector.resourceTypes.Script); |
project.addUISourceCode(uiSourceCode); |
} |
- var fileSystemMapping = new WebInspector.FileSystemMapping(); |
- var fileSystemPath = "file:///var/www"; |
- var projectId = WebInspector.FileSystemWorkspaceBinding.projectId(fileSystemPath); |
- fileSystemMapping.addFileSystem("file:///var/www"); |
- fileSystemMapping.addFileMapping("file:///var/www", "http://localhost/", "/localhost/"); |
- var fileSystemWorkspaceBinding = new WebInspector.FileSystemWorkspaceBinding(WebInspector.isolatedFileSystemManager, workspace); |
- var networkMapping = new WebInspector.NetworkMapping(WebInspector.targetManager, workspace, fileSystemWorkspaceBinding, fileSystemMapping); |
- |
- function dumpHasMappingForURL(url) |
- { |
- var result = networkMapping.hasMappingForNetworkURL(url) |
- if (result) |
- InspectorTest.addResult(" url " + url + " is mapped."); |
- else |
- InspectorTest.addResult(" url " + url + " is not mapped."); |
- } |
- |
function dumpUISourceCodeForURL(url) |
{ |
- var uiSourceCode = networkMapping.uiSourceCodeForURLForAnyTarget(url); |
- InspectorTest.addResult(" url " + url + " is mapped to " + (uiSourceCode ? uiSourceCode.url() : null)); |
+ var uiSourceCode = workspace.uiSourceCodeForURL(url); |
+ InspectorTest.addResult("uiSourceCode for url " + url + ": " + (uiSourceCode ? "EXISTS" : "null")); |
} |
- function dumpURLForPath(fileSystemPath, filePath) |
- { |
- var url = networkMapping._networkURLForFileSystemURL(fileSystemPath, fileSystemPath + "/" + filePath) |
- InspectorTest.addResult(" path " + fileSystemPath + " / " + filePath + " is mapped to " + (url ? url : null)); |
- } |
- |
- createUISourceCode(projectId, "file:///var/www/localhost/index.html"); |
+ createUISourceCode("file:///var/www", "localhost/index.html"); |
- createUISourceCode("1:http://www.example.com", "index.html"); |
- createUISourceCode("1:http://localhost", "index.html"); |
- createUISourceCode("1:http://localhost", "foo/index.html"); |
- createUISourceCode("1:https://localhost", "index.html"); |
- |
- dumpHasMappingForURL("http://www.example.com/index.html"); |
- dumpHasMappingForURL("http://localhost/index.html"); |
- dumpHasMappingForURL("http://localhost/foo/index.html"); |
- dumpHasMappingForURL("https://localhost/index.html"); |
- InspectorTest.addResult(""); |
+ createUISourceCode("http://www.example.com", "index.html"); |
+ createUISourceCode("http://localhost", "index.html"); |
+ createUISourceCode("http://localhost", "foo/index.html"); |
+ createUISourceCode("https://localhost", "index.html"); |
dumpUISourceCodeForURL("http://www.example.com/index.html"); |
dumpUISourceCodeForURL("http://localhost/index.html"); |
dumpUISourceCodeForURL("http://localhost/foo/index.html"); |
dumpUISourceCodeForURL("https://localhost/index.html"); |
- InspectorTest.addResult(""); |
- |
- dumpURLForPath("file:///home/example.com", "foo/index.html"); |
- dumpURLForPath("file:///home/example.com", "index.html"); |
- dumpURLForPath("file:///var/www", "localhost/index.html"); |
- dumpURLForPath("file:///var/www", "localhost/foo/index.html"); |
- dumpURLForPath("file:///home/foo", "index.html"); |
+ dumpUISourceCodeForURL("file:///var/www/localhost/index.html"); |
+ dumpUISourceCodeForURL("file:///var/www/localhost/index2.html"); |
InspectorTest.completeTest(); |
} |