blob: 091111c30a4c1e60b65bf5b5114255e8c29fa25a [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="../js/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="../js/resources/js-test-post.js"></script>
</body>
</html>