| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../js/resources/js-test-pre.js"></script> | 3 <script src="../js/resources/js-test-pre.js"></script> |
| 4 <style> | 4 <style> |
| 5 body { | 5 body { |
| 6 font-family: serif; | 6 font-family: serif; |
| 7 } | 7 } |
| 8 @font-face { | 8 @font-face { |
| 9 font-family: 'ahem'; | 9 font-family: 'ahem'; |
| 10 src: url(../../resources/Ahem.ttf); | 10 src: url(../../resources/Ahem.ttf); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 window.jsTestIsAsync = true; | 22 window.jsTestIsAsync = true; |
| 23 | 23 |
| 24 function runTests() { | 24 function runTests() { |
| 25 document.fonts.onloadingdone = function() { | 25 document.fonts.onloadingdone = function() { |
| 26 debug('loadingdone'); | 26 debug('loadingdone'); |
| 27 testDiv = document.getElementById('test'); | 27 testDiv = document.getElementById('test'); |
| 28 shouldBeEqualToString('window.getComputedStyle(testDiv, 0).width', '48px
'); | 28 shouldBeEqualToString('window.getComputedStyle(testDiv, 0).width', '48px
'); |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 document.fonts.notifyWhenFontsReady(function() { | 31 document.fonts.ready().then(function() { |
| 32 debug('notifyWhenFontsReady() callback'); | 32 debug('ready() promise fulfilled'); |
| 33 shouldBeEqualToString('window.getComputedStyle(testDiv, 0).width', '48px
'); | 33 shouldBeEqualToString('window.getComputedStyle(testDiv, 0).width', '48px
'); |
| 34 finishJSTest(); | 34 finishJSTest(); |
| 35 }); | 35 }); |
| 36 } | 36 } |
| 37 | 37 |
| 38 if (document.fonts) | 38 if (document.fonts) |
| 39 runTests(); | 39 runTests(); |
| 40 else { | 40 else { |
| 41 testFailed('document.fonts does not exist'); | 41 testFailed('document.fonts does not exist'); |
| 42 finishJSTest(); | 42 finishJSTest(); |
| 43 } | 43 } |
| 44 </script> | 44 </script> |
| 45 </head> | 45 </head> |
| 46 <body> | 46 <body> |
| 47 <div id=test> | 47 <div id=test> |
| 48 <a href="#"> | 48 <a href="#"> |
| 49 <span>aaa</span> | 49 <span>aaa</span> |
| 50 </a> | 50 </a> |
| 51 </div> | 51 </div> |
| 52 <script src="../js/resources/js-test-post.js"></script> | 52 <script src="../js/resources/js-test-post.js"></script> |
| 53 </body> | 53 </body> |
| 54 </html> | 54 </html> |
| OLD | NEW |