3 <script src=
"../http/tests/inspector/inspector-test.js"></script>
4 <script type=
"text/javascript">
8 function parseAndDumpURL(url
)
10 var parsedURL
= new WebInspector
.ParsedURL(url
);
12 InspectorTest
.addResult("Parsing url: " + url
);
13 InspectorTest
.addResult(" isValid: " + parsedURL
.isValid
);
14 InspectorTest
.addResult(" scheme: " + parsedURL
.scheme
);
15 InspectorTest
.addResult(" host: " + parsedURL
.host
);
16 InspectorTest
.addResult(" port: " + parsedURL
.port
);
17 InspectorTest
.addResult(" path: " + parsedURL
.path
);
18 InspectorTest
.addResult(" queryParams: " + parsedURL
.queryParams
);
19 InspectorTest
.addResult(" fragment: " + parsedURL
.fragment
);
20 InspectorTest
.addResult(" folderPathComponents: " + parsedURL
.folderPathComponents
);
21 InspectorTest
.addResult(" lastPathComponent: " + parsedURL
.lastPathComponent
);
22 var splittedURL
= WebInspector
.ParsedURL
.splitURLIntoPathComponents(url
);
23 InspectorTest
.addResult(" splittedURL: " + JSON
.stringify(splittedURL
));
26 parseAndDumpURL("http://example.com/?queryParam1=value1&queryParam2=value2#fragmentWith/Many//Slashes");
27 parseAndDumpURL("http://example.com/foo.html?queryParam1=value1&queryParam2=value2#fragmentWith/Many//Slashes");
28 parseAndDumpURL("http://example.com/foo/bar.html?queryParam1=value1&queryParam2=value2#fragmentWith/Many//Slashes");
29 parseAndDumpURL("http://example.com/foo/bar/baz.html?queryParam1=value1&queryParam2=value2#fragmentWith/Many//Slashes");
31 // Test how double (and more than double) slashes are parsed.
32 parseAndDumpURL("http://example.com//?queryParam1=value1");
33 parseAndDumpURL("http://example.com//foo.html");
34 parseAndDumpURL("http://example.com//foo/bar.html");
35 parseAndDumpURL("http://example.com/foo//bar.html");
36 parseAndDumpURL("http://example.com//foo//bar.html");
37 parseAndDumpURL("http://example.com//foo/bar/baz.html");
38 parseAndDumpURL("http://example.com/foo//bar/baz.html");
39 parseAndDumpURL("http://example.com/foo/bar//baz.html");
40 parseAndDumpURL("http://example.com///foo/bar/baz.html");
41 parseAndDumpURL("http://example.com/foo////bar/baz.html");
42 parseAndDumpURL("http://example.com/foo/bar/////baz.html");
44 InspectorTest
.completeTest();
49 <body onload=
"runTest()">
50 <p>Tests inspector ParsedURL class
</p>