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

Side by Side Diff: LayoutTests/fast/css/fontfaceset-events.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 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../resources/js-test.js"></script> 3 <script src="../../resources/js-test.js"></script>
4 <style> 4 <style>
5 @font-face { 5 @font-face {
6 font-family: 'ahem'; 6 font-family: 'ahem';
7 src: url(../../resources/Ahem.ttf); 7 src: url(../../resources/Ahem.ttf);
8 } 8 }
9 </style> 9 </style>
10 <script> 10 <script>
11 description('Test that the event handlers of FontFaceSet are called in the corre ct order.'); 11 description('Test that the event handlers of FontFaceSet are called in the corre ct order.');
12 12
13 window.jsTestIsAsync = true; 13 window.jsTestIsAsync = true;
14 14
15 var event; 15 var event;
16 var numberOfEvents = 0; 16 var numberOfEvents = 0;
17 17
18 function handleEvent(e) { 18 function handleEvent(e) {
19 event = e; 19 event = e;
20 shouldBeEqualToString('event.type', ['loading', 'loadingdone'][numberOfEvent s]); 20 shouldBeEqualToString('event.type', ['loading', 'loadingdone'][numberOfEvent s]);
21 numberOfEvents++; 21 numberOfEvents++;
22 } 22 }
23 23
24 function runTests() { 24 function runTests() {
25 document.fonts.onloading = handleEvent; 25 document.fonts.onloading = handleEvent;
26 document.fonts.onloadingdone = handleEvent; 26 document.fonts.onloadingdone = handleEvent;
27 document.fonts.onloadingerror = handleEvent; 27 document.fonts.onloadingerror = handleEvent;
28 28
29 document.fonts.ready().then(function() { 29 document.fonts.ready.then(function() {
30 shouldBe('numberOfEvents', '2'); 30 shouldBe('numberOfEvents', '2');
31 finishJSTest(); 31 finishJSTest();
32 }); 32 });
33 } 33 }
34 34
35 if (document.fonts) 35 if (document.fonts)
36 runTests(); 36 runTests();
37 else { 37 else {
38 testFailed('document.fonts does not exist'); 38 testFailed('document.fonts does not exist');
39 finishJSTest(); 39 finishJSTest();
40 } 40 }
41 </script> 41 </script>
42 </head> 42 </head>
43 <body> 43 <body>
44 <div style="font-family: ahem">Hello, world!</div> 44 <div style="font-family: ahem">Hello, world!</div>
45 </body> 45 </body>
46 </html> 46 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/css/fontfaceset-download-error-expected.txt ('k') | LayoutTests/fast/css/fontfaceset-events-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698