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

Side by Side Diff: LayoutTests/fast/css/fontloader-multiple-families.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: TestFont1; 6 font-family: TestFont1;
7 src: local('Courier New'); 7 src: local('Courier New');
8 } 8 }
9 9
10 @font-face { 10 @font-face {
11 font-family: TestFont2; 11 font-family: TestFont2;
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 fonts.loadFont() with multiple font families.' ); 17 description('Test load events for fonts.loadFont() with multiple font families.' );
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 TestFont1, TestFont2'}); 26 document.fonts.load('10px TestFont1, TestFont2');
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 TestFont1')"); 42 shouldBeTrue("document.fonts.check('10px TestFont1')");
43 shouldBeTrue("document.fonts.checkFont('10px TestFont2')"); 43 shouldBeTrue("document.fonts.check('10px TestFont2')");
44 shouldBeTrue("document.fonts.checkFont('10px TestFont1, TestFont2')"); 44 shouldBeTrue("document.fonts.check('10px TestFont1, TestFont2')");
45 } 45 }
46 46
47 function onLoadingError(e) { 47 function onLoadingError(e) {
48 firedEvents.push(e.type); 48 firedEvents.push(e.type);
49 } 49 }
50 50
51 function finish() { 51 function finish() {
52 shouldBe("firedEvents", "['loading', 'loadingdone']"); 52 shouldBe("firedEvents", "['loading', 'loadingdone']");
53 finishJSTest(); 53 finishJSTest();
54 } 54 }
55 55
56 if (document.fonts) 56 if (document.fonts)
57 runTests(); 57 runTests();
58 else { 58 else {
59 testFailed('document.fonts does not exist'); 59 testFailed('document.fonts does not exist');
60 finishJSTest(); 60 finishJSTest();
61 } 61 }
62 </script> 62 </script>
63 </head> 63 </head>
64 <body> 64 <body>
65 <script src="../js/resources/js-test-post.js"></script> 65 <script src="../js/resources/js-test-post.js"></script>
66 </body> 66 </body>
67 </html> 67 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698