Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / webfont / webfont-performance-duration.html
1 <!DOCTYPE html>
2 <script src="/js-test-resources/js-test.js"></script>
3 <style>
4 @font-face {
5     font-family: ahem;
6     src: url('../../../../misc/resources/acid3/font.ttf');
7 }
8 </style>
9
10 <div id="target">Hello webfont</div>
11
12 <script>
13 if (window.testRunner)
14     testRunner.waitUntilDone();
15
16 var waitMillisBeforeFetching = 300;
17 var entry;
18
19 (new Promise(function(resolve) {
20     setTimeout(function() {
21         var target = document.getElementById('target');
22         target.style['font-family'] = 'ahem';
23         resolve();
24     }, waitMillisBeforeFetching);
25 })).then(function() {
26     return document.fonts.ready();
27 }).then(function() {
28     setTimeout(function() {
29         var name = document.location.origin + '/misc/resources/acid3/font.ttf';
30         entry = window.performance.getEntriesByName(name)[0];
31         shouldBeTrue('entry.startTime >= waitMillisBeforeFetching');
32         if (window.testRunner)
33             testRunner.notifyDone();
34     }, 100);
35 });
36 </script>