Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <!DOCTYPE html> |
|
Takashi Toyoshima
2016/09/16 05:40:50
I slightly prefer to keep the original test case (
Kunihiko Sakamoto
2016/09/20 02:27:25
Done.
| |
| 2 <head> | |
| 3 <script src="../../js-test-resources/js-test.js"></script> | |
| 4 <style> | 2 <style> |
| 5 @font-face { | 3 @font-face { |
| 6 font-family: 'TestFont'; | 4 font-family: 'TestFont'; |
| 7 src: url(slow-ahem-loading.cgi); | 5 src: url(slow-ahem-loading.cgi); |
| 8 } | 6 } |
| 9 </style> | 7 </style> |
| 8 <style id="RemoveMe"> | |
| 9 @font-face { | |
| 10 font-family: 'TestFont2'; | |
| 11 src: url(slow-ahem-loading.cgi?2); | |
| 12 } | |
| 13 </style> | |
| 14 <script src="../../resources/testharness.js"></script> | |
| 15 <script src="../../resources/testharnessreport.js"></script> | |
| 10 <script> | 16 <script> |
| 11 description('Test for FontFaceSet.status attribute'); | |
| 12 | 17 |
| 13 window.jsTestIsAsync = true; | 18 promise_test(function(t) { |
| 19 assert_false(document.fonts.check('10px TestFont')); | |
| 20 assert_equals(document.fonts.status, "loaded"); | |
| 21 var loadPromise = document.fonts.load('10px TestFont'); | |
| 22 document.fonts.load('10px TestFont2'); | |
| 23 assert_equals(document.fonts.status, "loading"); | |
| 14 | 24 |
| 15 function runTests() { | 25 var style = document.getElementById('RemoveMe'); |
| 16 shouldBeFalse("document.fonts.check('10px TestFont')"); | 26 style.parentNode.removeChild(style); |
| 17 shouldBeEqualToString("document.fonts.status", "loaded"); | |
| 18 document.fonts.load('10px TestFont').then(onsuccess); | |
| 19 shouldBeEqualToString("document.fonts.status", "loading"); | |
| 20 } | |
| 21 | 27 |
| 22 function onsuccess() { | 28 return loadPromise |
| 23 shouldBeTrue("document.fonts.check('10px TestFont')"); | 29 .then(function() { |
| 24 document.fonts.ready.then(onFontsReady); | 30 assert_true(document.fonts.check('10px TestFont')); |
| 25 } | 31 return document.fonts.ready; |
| 32 }).then(function() { | |
| 33 assert_equals(document.fonts.status, "loaded"); | |
| 34 }); | |
| 35 }, 'FontFaceSet.status attribute'); | |
| 26 | 36 |
| 27 function onFontsReady() { | |
| 28 shouldBeEqualToString("document.fonts.status", "loaded"); | |
| 29 finishJSTest(); | |
| 30 } | |
| 31 | |
| 32 if (document.fonts) | |
| 33 runTests(); | |
| 34 else { | |
| 35 testFailed('document.fonts does not exist'); | |
| 36 finishJSTest(); | |
| 37 } | |
| 38 </script> | 37 </script> |
| 39 </head> | |
| 40 <body> | |
| 41 </body> | |
| 42 </html> | |
| OLD | NEW |