Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / fontfaceset-multiple-faces-download-error.html
blob913912749e65f09b432e1ddb062bcdd822a0941c
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <style>
5 @font-face {
6 font-family: TestFont;
7 src: url('../../resources/DownLoadErrorAhem.ttf'), url(../../resources/Ahem.ttf);
10 @font-face {
11 font-family: TestFont;
12 src: url('../../resources/DownLoadErrorAhem.otf');
13 unicode-range: u+61-7a; /* 'a'-'z' */
15 </style>
16 <script>
17 description('Test load events for a font family consists of multiple @font-faces, including download error.');
19 window.jsTestIsAsync = true;
21 function runTests() {
22 document.fonts.addEventListener('loading', onLoading);
23 document.fonts.addEventListener('loadingdone', onLoadingDone);
24 document.fonts.addEventListener('loadingerror', onLoadingError);
25 document.fonts.ready.then(finish);
27 document.fonts.load('10px TestFont', 'abc').catch(function() {});
30 var event;
31 var firedEvents = [];
33 function onLoading(e) {
34 firedEvents.push(e.type);
37 function onLoadingDone(e) {
38 firedEvents.push(e.type);
39 event = e;
40 shouldBe("event.fontfaces.length", "1");
41 shouldBeEqualToString("event.fontfaces[0].unicodeRange", "U+0-10FFFF");
42 shouldBeEqualToString("event.fontfaces[0].status", "loaded");
43 loadingdoneFired = true;
46 function onLoadingError(e) {
47 firedEvents.push(e.type);
48 event = e;
49 shouldBe("event.fontfaces.length", "1");
50 shouldBeEqualToString("event.fontfaces[0].unicodeRange", "U+61-7A");
51 shouldBeEqualToString("event.fontfaces[0].status", "error");
52 shouldBeFalse("document.fonts.check('10px TestFont', 'abc')");
55 function finish() {
56 shouldBe("firedEvents", "['loading', 'loadingdone', 'loadingerror']");
57 finishJSTest();
60 if (document.fonts)
61 runTests();
62 else {
63 testFailed('document.fonts does not exist');
64 finishJSTest();
66 </script>
67 </head>
68 <body>
69 </body>
70 </html>