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

Side by Side Diff: LayoutTests/fast/css/fontloader-events.html

Issue 23717059: [Font Load Events] Implement FontFaceSet methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months 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 | Annotate | Revision Log
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../js/resources/js-test-pre.js"></script> 3 <script src="../js/resources/js-test-pre.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.notifyWhenFontsReady(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 <script src="../js/resources/js-test-post.js"></script> 45 <script src="../js/resources/js-test-post.js"></script>
46 </body> 46 </body>
47 </html> 47 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/css/fontloader-download-error.html ('k') | LayoutTests/fast/css/fontloader-loadingdone.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698