OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../js-test-resources/js-test.js"></script> | 3 <script src="../../js-test-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(slow-ahem-loading.cgi); | 7 src: url(slow-ahem-loading.cgi); |
8 } | 8 } |
9 </style> | 9 </style> |
10 <script> | 10 <script> |
11 description('Test for FontFaceSet.status attribute'); | 11 description('Test for FontFaceSet.status attribute'); |
12 | 12 |
13 window.jsTestIsAsync = true; | 13 window.jsTestIsAsync = true; |
14 | 14 |
15 function runTests() { | 15 function runTests() { |
16 shouldBeFalse("document.fonts.check('10px TestFont')"); | 16 shouldBeFalse("document.fonts.check('10px TestFont')"); |
17 shouldBeEqualToString("document.fonts.status", "loaded"); | 17 shouldBeEqualToString("document.fonts.status", "loaded"); |
18 document.fonts.load('10px TestFont').then(onsuccess); | 18 document.fonts.load('10px TestFont').then(onsuccess); |
19 shouldBeEqualToString("document.fonts.status", "loading"); | 19 shouldBeEqualToString("document.fonts.status", "loading"); |
20 } | 20 } |
21 | 21 |
22 function onsuccess() { | 22 function onsuccess() { |
23 shouldBeTrue("document.fonts.check('10px TestFont')"); | 23 shouldBeTrue("document.fonts.check('10px TestFont')"); |
24 shouldBeEqualToString("document.fonts.status", "loaded"); | |
25 document.fonts.ready().then(onFontsReady); | 24 document.fonts.ready().then(onFontsReady); |
26 } | 25 } |
27 | 26 |
28 function onFontsReady() { | 27 function onFontsReady() { |
29 shouldBeEqualToString("document.fonts.status", "loaded"); | 28 shouldBeEqualToString("document.fonts.status", "loaded"); |
30 finishJSTest(); | 29 finishJSTest(); |
31 } | 30 } |
32 | 31 |
33 if (document.fonts) | 32 if (document.fonts) |
34 runTests(); | 33 runTests(); |
35 else { | 34 else { |
36 testFailed('document.fonts does not exist'); | 35 testFailed('document.fonts does not exist'); |
37 finishJSTest(); | 36 finishJSTest(); |
38 } | 37 } |
39 </script> | 38 </script> |
40 </head> | 39 </head> |
41 <body> | 40 <body> |
42 </body> | 41 </body> |
43 </html> | 42 </html> |
OLD | NEW |