OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../js-test-resources/js-test-pre.js"></script> | 3 <script src="../../js-test-resources/js-test-pre.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.loading 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 shouldBe("document.fonts.checkFont('10px TestFont')", "false"); | 16 shouldBeFalse("document.fonts.check('10px TestFont')"); |
17 shouldBe("document.fonts.loading", "false"); | 17 shouldBeEqualToString("document.fonts.status", "loaded"); |
18 document.fonts.loadFont({ font: '10px TestFont', onsuccess: onsuccess }); | 18 document.fonts.load('10px TestFont').then(onsuccess); |
19 shouldBe("document.fonts.loading", "true"); | 19 shouldBeEqualToString("document.fonts.status", "loading"); |
20 } | 20 } |
21 | 21 |
22 function onsuccess() { | 22 function onsuccess() { |
23 shouldBe("document.fonts.checkFont('10px TestFont')", "true"); | 23 shouldBeTrue("document.fonts.check('10px TestFont')"); |
24 shouldBe("document.fonts.loading", "true"); | 24 shouldBeEqualToString("document.fonts.status", "loaded"); |
25 document.fonts.notifyWhenFontsReady(onFontsReady); | 25 document.fonts.ready().then(onFontsReady); |
26 } | 26 } |
27 | 27 |
28 function onFontsReady() { | 28 function onFontsReady() { |
29 shouldBe("document.fonts.loading", "false"); | 29 shouldBeEqualToString("document.fonts.status", "loaded"); |
30 finishJSTest(); | 30 finishJSTest(); |
31 } | 31 } |
32 | 32 |
33 if (document.fonts) | 33 if (document.fonts) |
34 runTests(); | 34 runTests(); |
35 else { | 35 else { |
36 testFailed('document.fonts does not exist'); | 36 testFailed('document.fonts does not exist'); |
37 finishJSTest(); | 37 finishJSTest(); |
38 } | 38 } |
39 </script> | 39 </script> |
40 </head> | 40 </head> |
41 <body> | 41 <body> |
42 <script src="../../js-test-resources/js-test-post.js"></script> | 42 <script src="../../js-test-resources/js-test-post.js"></script> |
43 </body> | 43 </body> |
44 </html> | 44 </html> |
OLD | NEW |