OLD | NEW |
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 type="text/javascript"> | 4 <script type="text/javascript"> |
5 | 5 |
6 function test() | 6 function test() |
7 { | 7 { |
8 function parseAndDumpURL(url) | 8 function parseAndDumpURL(url) |
9 { | 9 { |
10 var parsedURL = new WebInspector.ParsedURL(url); | 10 var parsedURL = new WebInspector.ParsedURL(url); |
11 | 11 |
12 InspectorTest.addResult("Parsing url: " + url); | 12 InspectorTest.addResult("Parsing url: " + url); |
13 InspectorTest.addResult(" isValid: " + parsedURL.isValid); | 13 InspectorTest.addResult(" isValid: " + parsedURL.isValid); |
14 InspectorTest.addResult(" scheme: " + parsedURL.scheme); | 14 InspectorTest.addResult(" scheme: " + parsedURL.scheme); |
15 InspectorTest.addResult(" host: " + parsedURL.host); | 15 InspectorTest.addResult(" host: " + parsedURL.host); |
16 InspectorTest.addResult(" port: " + parsedURL.port); | 16 InspectorTest.addResult(" port: " + parsedURL.port); |
17 InspectorTest.addResult(" path: " + parsedURL.path); | 17 InspectorTest.addResult(" path: " + parsedURL.path); |
18 InspectorTest.addResult(" queryParams: " + parsedURL.queryParams); | 18 InspectorTest.addResult(" queryParams: " + parsedURL.queryParams); |
19 InspectorTest.addResult(" fragment: " + parsedURL.fragment); | 19 InspectorTest.addResult(" fragment: " + parsedURL.fragment); |
20 InspectorTest.addResult(" folderPathComponents: " + parsedURL.folderPat
hComponents); | 20 InspectorTest.addResult(" folderPathComponents: " + parsedURL.folderPat
hComponents); |
21 InspectorTest.addResult(" lastPathComponent: " + parsedURL.lastPathComp
onent); | 21 InspectorTest.addResult(" lastPathComponent: " + parsedURL.lastPathComp
onent); |
22 var splittedURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url)
; | |
23 InspectorTest.addResult(" splittedURL: " + JSON.stringify(splittedURL))
; | |
24 } | 22 } |
25 | 23 |
26 parseAndDumpURL("http://example.com/?queryParam1=value1&queryParam2=value2#f
ragmentWith/Many//Slashes"); | 24 parseAndDumpURL("http://example.com/?queryParam1=value1&queryParam2=value2#f
ragmentWith/Many//Slashes"); |
27 parseAndDumpURL("http://example.com/foo.html?queryParam1=value1&queryParam2=
value2#fragmentWith/Many//Slashes"); | 25 parseAndDumpURL("http://example.com/foo.html?queryParam1=value1&queryParam2=
value2#fragmentWith/Many//Slashes"); |
28 parseAndDumpURL("http://example.com/foo/bar.html?queryParam1=value1&queryPar
am2=value2#fragmentWith/Many//Slashes"); | 26 parseAndDumpURL("http://example.com/foo/bar.html?queryParam1=value1&queryPar
am2=value2#fragmentWith/Many//Slashes"); |
29 parseAndDumpURL("http://example.com/foo/bar/baz.html?queryParam1=value1&quer
yParam2=value2#fragmentWith/Many//Slashes"); | 27 parseAndDumpURL("http://example.com/foo/bar/baz.html?queryParam1=value1&quer
yParam2=value2#fragmentWith/Many//Slashes"); |
30 | 28 |
31 // Test how double (and more than double) slashes are parsed. | 29 // Test how double (and more than double) slashes are parsed. |
32 parseAndDumpURL("http://example.com//?queryParam1=value1"); | 30 parseAndDumpURL("http://example.com//?queryParam1=value1"); |
33 parseAndDumpURL("http://example.com//foo.html"); | 31 parseAndDumpURL("http://example.com//foo.html"); |
34 parseAndDumpURL("http://example.com//foo/bar.html"); | 32 parseAndDumpURL("http://example.com//foo/bar.html"); |
35 parseAndDumpURL("http://example.com/foo//bar.html"); | 33 parseAndDumpURL("http://example.com/foo//bar.html"); |
36 parseAndDumpURL("http://example.com//foo//bar.html"); | 34 parseAndDumpURL("http://example.com//foo//bar.html"); |
37 parseAndDumpURL("http://example.com//foo/bar/baz.html"); | 35 parseAndDumpURL("http://example.com//foo/bar/baz.html"); |
38 parseAndDumpURL("http://example.com/foo//bar/baz.html"); | 36 parseAndDumpURL("http://example.com/foo//bar/baz.html"); |
39 parseAndDumpURL("http://example.com/foo/bar//baz.html"); | 37 parseAndDumpURL("http://example.com/foo/bar//baz.html"); |
40 parseAndDumpURL("http://example.com///foo/bar/baz.html"); | 38 parseAndDumpURL("http://example.com///foo/bar/baz.html"); |
41 parseAndDumpURL("http://example.com/foo////bar/baz.html"); | 39 parseAndDumpURL("http://example.com/foo////bar/baz.html"); |
42 parseAndDumpURL("http://example.com/foo/bar/////baz.html"); | 40 parseAndDumpURL("http://example.com/foo/bar/////baz.html"); |
43 | 41 |
44 InspectorTest.completeTest(); | 42 InspectorTest.completeTest(); |
45 } | 43 } |
46 | 44 |
47 </script> | 45 </script> |
48 </head> | 46 </head> |
49 <body onload="runTest()"> | 47 <body onload="runTest()"> |
50 <p>Tests inspector ParsedURL class</p> | 48 <p>Tests inspector ParsedURL class</p> |
51 </body> | 49 </body> |
52 </html> | 50 </html> |
OLD | NEW |