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

Side by Side Diff: LayoutTests/fast/css/fontloader-multiple-faces.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: TestFont; 6 font-family: TestFont;
7 src: local('Courier New'); 7 src: local('Courier New');
8 } 8 }
9 9
10 @font-face { 10 @font-face {
11 font-family: TestFont; 11 font-family: TestFont;
12 src: url(../../resources/Ahem.ttf); 12 src: url(../../resources/Ahem.ttf);
13 unicode-range: u+61-7a; /* 'a'-'z' */ 13 unicode-range: u+61-7a; /* 'a'-'z' */
14 } 14 }
15 </style> 15 </style>
16 <script> 16 <script>
17 description('Test load events for a font family consists of multiple @font-faces .'); 17 description('Test load events for a font family consists of multiple @font-faces .');
18 18
19 window.jsTestIsAsync = true; 19 window.jsTestIsAsync = true;
20 20
21 function runTests() { 21 function runTests() {
22 document.fonts.addEventListener('loading', onLoading); 22 document.fonts.addEventListener('loading', onLoading);
23 document.fonts.addEventListener('loadingdone', onLoadingDone); 23 document.fonts.addEventListener('loadingdone', onLoadingDone);
24 document.fonts.notifyWhenFontsReady(finish); 24 document.fonts.ready().then(finish);
25 25
26 document.fonts.loadFont({font: '10px TestFont'}); 26 document.fonts.load('10px TestFont');
27 } 27 }
28 28
29 var event; 29 var event;
30 var firedEvents = []; 30 var firedEvents = [];
31 31
32 function onLoading(e) { 32 function onLoading(e) {
33 firedEvents.push(e.type); 33 firedEvents.push(e.type);
34 } 34 }
35 35
36 function onLoadingDone(e) { 36 function onLoadingDone(e) {
37 firedEvents.push(e.type); 37 firedEvents.push(e.type);
38 event = e; 38 event = e;
39 shouldBe("event.fontfaces.length", "2"); 39 shouldBe("event.fontfaces.length", "2");
40 shouldBeEqualToString("event.fontfaces[0].status", "loaded"); 40 shouldBeEqualToString("event.fontfaces[0].status", "loaded");
41 shouldBeEqualToString("event.fontfaces[1].status", "loaded"); 41 shouldBeEqualToString("event.fontfaces[1].status", "loaded");
42 shouldBeTrue("document.fonts.checkFont('10px TestFont')"); 42 shouldBeTrue("document.fonts.check('10px TestFont')");
43 } 43 }
44 44
45 function onLoadingError(e) { 45 function onLoadingError(e) {
46 firedEvents.push(e.type); 46 firedEvents.push(e.type);
47 } 47 }
48 48
49 function finish() { 49 function finish() {
50 shouldBe("firedEvents", "['loading', 'loadingdone']"); 50 shouldBe("firedEvents", "['loading', 'loadingdone']");
51 finishJSTest(); 51 finishJSTest();
52 } 52 }
53 53
54 if (document.fonts) 54 if (document.fonts)
55 runTests(); 55 runTests();
56 else { 56 else {
57 testFailed('document.fonts does not exist'); 57 testFailed('document.fonts does not exist');
58 finishJSTest(); 58 finishJSTest();
59 } 59 }
60 </script> 60 </script>
61 </head> 61 </head>
62 <body> 62 <body>
63 <script src="../js/resources/js-test-post.js"></script> 63 <script src="../js/resources/js-test-post.js"></script>
64 </body> 64 </body>
65 </html> 65 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698