| <!DOCTYPE html> |
| <script src="/js-test-resources/js-test.js"></script> |
| |
| <div id="target">Hello webfont</div> |
| |
| <script> |
| jsTestIsAsync = true; |
| |
| var waitMillisBeforeFetching = 300; |
| var entry; |
| var fontFace = new FontFace('ahem', "url('../../../../misc/resources/acid3/font.ttf')"); |
| document.fonts.add(fontFace); |
| |
| new Promise(function(resolve) { |
| setTimeout(resolve, waitMillisBeforeFetching); |
| }).then(function() { |
| var target = document.getElementById('target'); |
| target.style['font-family'] = 'ahem'; |
| return fontFace.loaded; |
| }).then(function() { |
| var name = document.location.origin + '/misc/resources/acid3/font.ttf'; |
| entry = window.performance.getEntriesByName(name)[0]; |
| shouldBeTrue('entry.startTime >= waitMillisBeforeFetching'); |
| finishJSTest(); |
| }); |
| </script> |