1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
5 <script src=
"../../resources/js-test.js"></script>
6 <script src=
"resources/utilities.js"></script>
11 description("Canonical URL should have a lowercase hostname for server based protocols.")
13 var protocolTestSet
= [
23 var urls
= ['lowercase', 'CamelCase', 'UnicodeFĂȘte'];
24 var urlExpectationsLowercase
= ['lowercase', 'camelcase', 'xn--unicodefte-t7a'];
25 var urlExpectationsUppercase
= ['lowercase', 'CamelCase', 'UnicodeF%C3%AAte'];
28 for (var protocolIndex
= 0; protocolIndex
< protocolTestSet
.length
; ++protocolIndex
) {
29 var protocol
= protocolTestSet
[protocolIndex
][0];
30 var hostnameShouldBeLowercase
= protocolTestSet
[protocolIndex
][1];
32 for (var urlIndex
= 0; urlIndex
< urls
.length
; ++urlIndex
) {
33 var url
= protocol
+ '://' + urls
[urlIndex
] + '/';
34 src
= canonicalize(url
);
36 if (hostnameShouldBeLowercase
)
37 expected
= protocol
+ '://' + urlExpectationsLowercase
[urlIndex
] + '/';
39 expected
= protocol
+ '://' + urlExpectationsUppercase
[urlIndex
] + '/';
41 shouldBe('src', 'expected');
45 successfullyParsed
= true;