blob: a4ced0cd446c1dad80aa20ffbd1dc6e46bd9c824 [file] [log] [blame]
<html>
<head>
<script src="../http/tests/inspector/inspector-test.js"></script>
<script src="../http/tests/inspector/workspace-test.js"></script>
<script>
function test()
{
var projects = {};
var workspace = new WebInspector.Workspace();
function createUISourceCode(projectId, relativePath)
{
var project = projects[projectId];
if (!projects[projectId]) {
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(projectId +"/" + relativePath, WebInspector.resourceTypes.Script);
project.addUISourceCode(uiSourceCode);
}
function dumpUISourceCodeForURL(url)
{
var uiSourceCode = workspace.uiSourceCodeForURL(url);
InspectorTest.addResult("uiSourceCode for url " + url + ": " + (uiSourceCode ? "EXISTS" : "null"));
}
createUISourceCode("file:///var/www", "localhost/index.html");
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");
dumpUISourceCodeForURL("file:///var/www/localhost/index.html");
dumpUISourceCodeForURL("file:///var/www/localhost/index2.html");
InspectorTest.completeTest();
}
</script>
</head>
<body onload="runTest()">
<p>Tests workspace mappings</p>
</body>
</html>