<html>
<head>
<script src="../../resources/js-test.js"></script>
<style>
@font-face {
font-family: TestFont;
src: local('Courier New'), local('Cousine-Regular');
}
@font-face {
font-family: TestFont;
src: url(../../resources/Ahem.ttf);
unicode-range: u+41-5a; /* 'A'-'Z' */
}
@font-face {
font-family: TestFont;
src: url('resources/DownLoadErrorAhem.otf');
unicode-range: u+61-7a; /* 'a'-'z' */
}
</style>
<script>
description('Tests load() method of FontFaceSet.');
window.jsTestIsAsync = true;
function step1() {
document.fonts.load('10px TestFont', 'ABC.').then(step2);
}
function step2(v) {
value = v;
shouldBe('value.length', '2');
shouldBeEqualToString('value[0].unicodeRange', 'U+0-10FFFF');
shouldBeEqualToString('value[1].unicodeRange', 'U+41-5A');
shouldBeEqualToString('value[0].status', 'loaded');
shouldBeEqualToString('value[1].status', 'loaded');
document.fonts.load('10px TestFont', 'abc.').catch(step3);
}
function step3(v) {
value = v;
shouldBeEqualToString('value.name', 'NetworkError');
document.fonts.load('InvalidFontDescription', 'abc.').catch(step4);
}
function step4(v) {
value = v;
shouldBeEqualToString('value.name', 'SyntaxError');
finishJSTest();
}
if (document.fonts)
step1();
else {
testFailed('document.fonts does not exist');
finishJSTest();
}
</script>
</head>
<body>
</body>
</html>