OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
4 <style> | 4 <style> |
5 @font-face { | 5 @font-face { |
6 font-family: TestFont; | 6 font-family: TestFont; |
7 src: url('../../resources/DownLoadErrorAhem.ttf'), url(../../resources/Ahem.
ttf); | 7 src: url('../../resources/DownLoadErrorAhem.ttf'), url(../../resources/Ahem.
ttf); |
8 } | 8 } |
9 | 9 |
10 @font-face { | 10 @font-face { |
11 font-family: TestFont; | 11 font-family: TestFont; |
12 src: url('../../resources/DownLoadErrorAhem.otf'); | 12 src: url('../../resources/DownLoadErrorAhem.otf'); |
13 unicode-range: u+61-7a; /* 'a'-'z' */ | 13 unicode-range: u+61-7a; /* 'a'-'z' */ |
14 } | 14 } |
15 </style> | 15 </style> |
16 <script> | 16 <script> |
17 description('Test load events for a font family consists of multiple @font-faces
, including download error.'); | 17 description('Test load events for a font family consists of multiple @font-faces
, including download error.'); |
18 | 18 |
19 window.jsTestIsAsync = true; | 19 window.jsTestIsAsync = true; |
20 | 20 |
21 function runTests() { | 21 function runTests() { |
22 document.fonts.addEventListener('loading', onLoading); | 22 document.fonts.addEventListener('loading', onLoading); |
23 document.fonts.addEventListener('loadingdone', onLoadingDone); | 23 document.fonts.addEventListener('loadingdone', onLoadingDone); |
24 document.fonts.addEventListener('loadingerror', onLoadingError); | 24 document.fonts.addEventListener('loadingerror', onLoadingError); |
25 document.fonts.ready().then(finish); | 25 document.fonts.ready.then(finish); |
26 | 26 |
27 document.fonts.load('10px TestFont', 'abc').catch(function() {}); | 27 document.fonts.load('10px TestFont', 'abc').catch(function() {}); |
28 } | 28 } |
29 | 29 |
30 var event; | 30 var event; |
31 var firedEvents = []; | 31 var firedEvents = []; |
32 | 32 |
33 function onLoading(e) { | 33 function onLoading(e) { |
34 firedEvents.push(e.type); | 34 firedEvents.push(e.type); |
35 } | 35 } |
(...skipping 25 matching lines...) Expand all Loading... |
61 runTests(); | 61 runTests(); |
62 else { | 62 else { |
63 testFailed('document.fonts does not exist'); | 63 testFailed('document.fonts does not exist'); |
64 finishJSTest(); | 64 finishJSTest(); |
65 } | 65 } |
66 </script> | 66 </script> |
67 </head> | 67 </head> |
68 <body> | 68 <body> |
69 </body> | 69 </body> |
70 </html> | 70 </html> |
OLD | NEW |