Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / webfont / webfont-performance-duration.html
blobb998ce592ebd0d6f4410ce3b46cdc8e334253333
1 <!DOCTYPE html>
2 <script src="/js-test-resources/js-test.js"></script>
4 <div id="target">Hello webfont</div>
6 <script>
7 if (window.testRunner)
8 testRunner.waitUntilDone();
10 var waitMillisBeforeFetching = 300;
11 var entry;
12 var fontFace = new FontFace('ahem', "url('../../../../misc/resources/acid3/font.ttf')");
13 document.fonts.add(fontFace);
15 new Promise(function(resolve) {
16 setTimeout(resolve, waitMillisBeforeFetching);
17 }).then(function() {
18 var target = document.getElementById('target');
19 target.style['font-family'] = 'ahem';
20 return fontFace.loaded;
21 }).then(function() {
22 var name = document.location.origin + '/misc/resources/acid3/font.ttf';
23 entry = window.performance.getEntriesByName(name)[0];
24 shouldBeTrue('entry.startTime >= waitMillisBeforeFetching');
25 if (window.testRunner)
26 testRunner.notifyDone();
27 });
28 </script>