Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: LayoutTests/http/tests/webfont/webfont-performance-duration.html

Issue 816923002: Switch FontFaceSet#ready from a method to an attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="/js-test-resources/js-test.js"></script> 2 <script src="/js-test-resources/js-test.js"></script>
3 <style> 3 <style>
4 @font-face { 4 @font-face {
5 font-family: ahem; 5 font-family: ahem;
6 src: url('../../../../misc/resources/acid3/font.ttf'); 6 src: url('../../../../misc/resources/acid3/font.ttf');
7 } 7 }
8 </style> 8 </style>
9 9
10 <div id="target">Hello webfont</div> 10 <div id="target">Hello webfont</div>
11 11
12 <script> 12 <script>
13 if (window.testRunner) 13 if (window.testRunner)
14 testRunner.waitUntilDone(); 14 testRunner.waitUntilDone();
15 15
16 var waitMillisBeforeFetching = 300; 16 var waitMillisBeforeFetching = 300;
17 var entry; 17 var entry;
18 18
19 (new Promise(function(resolve) { 19 (new Promise(function(resolve) {
20 setTimeout(function() { 20 setTimeout(function() {
21 var target = document.getElementById('target'); 21 var target = document.getElementById('target');
22 target.style['font-family'] = 'ahem'; 22 target.style['font-family'] = 'ahem';
23 resolve(); 23 resolve();
24 }, waitMillisBeforeFetching); 24 }, waitMillisBeforeFetching);
25 })).then(function() { 25 })).then(function() {
26 return document.fonts.ready(); 26 return document.fonts.ready;
27 }).then(function() { 27 }).then(function() {
28 setTimeout(function() { 28 setTimeout(function() {
29 var name = document.location.origin + '/misc/resources/acid3/font.ttf'; 29 var name = document.location.origin + '/misc/resources/acid3/font.ttf';
30 entry = window.performance.getEntriesByName(name)[0]; 30 entry = window.performance.getEntriesByName(name)[0];
31 shouldBeTrue('entry.startTime >= waitMillisBeforeFetching'); 31 shouldBeTrue('entry.startTime >= waitMillisBeforeFetching');
32 if (window.testRunner) 32 if (window.testRunner)
33 testRunner.notifyDone(); 33 testRunner.notifyDone();
34 }, 100); 34 }, 100);
35 }); 35 });
36 </script> 36 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698