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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/css/fontfaceset-add-remove-while-loading.html

Issue 2620293002: Remove CSSFontSelector argument and member from CSSSegmentedFontFace (Closed)
Patch Set: Update test for CL comments Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/css/fontfaceset-add-remove-while-loading-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script> 2 <script src='../../resources/testharness.js'></script>
3 <script src='../../resources/testharnessreport.js'></script>
4
3 <script> 5 <script>
4 description('Tests that FontFaceSet is correctly updated when added or removed a FontFace while loading.');
5
6 window.jsTestIsAsync = true;
7 6
8 function loadingDonePromise() { 7 function loadingDonePromise() {
9 return new Promise(function(resolve) { 8 return new Promise(function(resolve) {
10 function handler(e) { 9 function handler(e) {
11 document.fonts.removeEventListener('loadingdone', handler); 10 document.fonts.removeEventListener('loadingdone', handler);
12 resolve(e); 11 resolve(e);
13 }; 12 };
14 document.fonts.addEventListener('loadingdone', handler); 13 document.fonts.addEventListener('loadingdone', handler);
15 }); 14 });
16 } 15 }
17 16
18 Promise.resolve().then(function() { 17 promise_test(() => {
19 face1 = new FontFace('face1', 'url(../../resources/Ahem.ttf)', {}); 18 let face = new FontFace('face', 'url(../../resources/Ahem.ttf)', {});
20 shouldBeEqualToString('face1.status', 'unloaded'); 19 assert_equals(face.status, 'unloaded');
21 20
22 face1.load(); 21 let faceLoaded = face.load();
23 shouldBeEqualToString('face1.status', 'loading'); 22 assert_equals(face.status, 'loading');
24 shouldBeEqualToString('document.fonts.status', 'loaded'); 23 assert_equals(document.fonts.status, 'loaded')
25 24
26 document.fonts.add(face1); 25 let loadingDone = loadingDonePromise();
27 shouldBeEqualToString('document.fonts.status', 'loading'); 26 document.fonts.add(face);
28 return document.fonts.ready; 27 assert_equals(document.fonts.status, 'loading');
29 }).then(function() {
30 shouldBeEqualToString('face1.status', 'loaded');
31 shouldBeEqualToString('document.fonts.status', 'loaded');
32 28
33 face2 = new FontFace('face2', 'url(../../resources/Ahem.ttf)', {}); 29 return Promise.all(
34 shouldBeEqualToString('face2.status', 'unloaded'); 30 [faceLoaded, loadingDone, document.fonts.ready]).then(() => {
31 assert_equals(document.fonts.status, 'loaded');
32 assert_equals(face.status, 'loaded');
33 });
34 }, 'document.fonts.add() called while a FontFace is loading.');
35 35
36 document.fonts.add(face2); 36 promise_test(() => {
37 var face2loaded = face2.load() 37 assert_equals(document.fonts.status, 'loaded');
38 shouldBeEqualToString('document.fonts.status', 'loading');
39 38
40 var loadingdone = loadingDonePromise(); 39 let face = new FontFace('face', 'url(../../resources/Ahem.ttf)', {});
41 document.fonts.delete(face2); 40 assert_equals(face.status, 'unloaded');
42 shouldBeEqualToString('document.fonts.status', 'loading');
43 shouldBeEqualToString('face2.status', 'loading');
44 41
45 return Promise.all([face2loaded, loadingdone]); 42 document.fonts.add(face);
46 }).then(function() { 43 let faceLoaded = face.load();
47 shouldBeEqualToString('face2.status', 'loaded'); 44 assert_equals(document.fonts.status, 'loading');
48 shouldBeEqualToString('document.fonts.status', 'loaded');
49 45
50 face3 = new FontFace('face3', 'url(../../resources/Ahem.ttf)', {}); 46 let loadingDone = loadingDonePromise();
51 shouldBeEqualToString('face3.status', 'unloaded'); 47 document.fonts.delete(face);
52 48
53 document.fonts.add(face3); 49 // Deleting a font from the document should not change its or the document's
54 face3.load(); 50 // loading status until the loadingdone event is fired.
55 shouldBeEqualToString('document.fonts.status', 'loading'); 51 assert_equals(document.fonts.status, 'loading');
52 assert_equals(face.status, 'loading');
56 53
57 document.fonts.clear(); 54 return Promise.all(
58 shouldBeEqualToString('document.fonts.status', 'loading'); 55 [faceLoaded, loadingDone, document.fonts.ready]).then(() => {
59 shouldBeEqualToString('face3.status', 'loading'); 56 assert_equals(document.fonts.status, 'loaded');
60 return document.fonts.ready; 57 assert_equals(face.status, 'loaded');
61 }).then(function() { 58 });
62 shouldBeEqualToString('document.fonts.status', 'loaded'); 59 }, 'document.fonts.delete() called while a FontFace is loading.');
63 finishJSTest(); 60
64 }).catch(function (err) { 61 promise_test(() => {
65 testFailed('Unexpected rejection: ' + err); 62 assert_equals(document.fonts.status, 'loaded');
66 finishJSTest(); 63
67 }); 64 let face = new FontFace('face', 'url(../../resources/Ahem.ttf)', {});
65 assert_equals(face.status, 'unloaded');
66
67 document.fonts.add(face);
68 let faceLoaded = face.load();
69 assert_equals(document.fonts.status, 'loading');
70
71 let loadingDone = loadingDonePromise();
72 document.fonts.clear();
73 assert_equals(document.fonts.status, 'loading');
74 assert_equals(face.status, 'loading');
75
76 return Promise.all(
77 [faceLoaded, loadingDone, document.fonts.ready]).then(() => {
78 assert_equals(document.fonts.status, 'loaded');
79 assert_equals(face.status, 'loaded');
80 });
81 }, 'document.fonts.clear() called while a FontFace is loading.');
68 82
69 </script> 83 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/css/fontfaceset-add-remove-while-loading-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698