blob: 5c53e40394ab26d5e877ba509ee79958a2892e58 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="../../resources/js-test-pre.js"></script>
<script src="resources/utilities.js"></script>
</head>
<body>
<script>
description("Canonical URL should have a lowercase hostname for server based protocols.")
var protocolTestSet = [
['ws', true],
['wss', true],
['ftp', true],
['wss', true],
['http', true],
['file', true],
['https', true],
['ghost', false]];
var urls = ['lowercase', 'CamelCase', 'UnicodeFĂȘte'];
var urlExpectationsLowercase = ['lowercase', 'camelcase', 'xn--unicodefte-t7a'];
var urlExpectationsUppercase = ['lowercase', 'CamelCase', 'UnicodeF%C3%AAte'];
for (var protocolIndex = 0; protocolIndex < protocolTestSet.length; ++protocolIndex) {
var protocol = protocolTestSet[protocolIndex][0];
var hostnameShouldBeLowercase = protocolTestSet[protocolIndex][1];
for (var urlIndex = 0; urlIndex < urls.length; ++urlIndex) {
var url = protocol + '://' + urls[urlIndex] + '/';
src = canonicalize(url);
if (hostnameShouldBeLowercase)
expected = protocol + '://' + urlExpectationsLowercase[urlIndex] + '/';
else
expected = protocol + '://' + urlExpectationsUppercase[urlIndex] + '/';
shouldBe('src', 'expected');
}
}
successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>