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

Side by Side Diff: tests/html/fontface_loaded_test.dart

Issue 1310363006: Patched in Dartium JsInterop (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « tests/compiler/dart2js/js_backend_cps_ir_basic_test.dart ('k') | tests/html/html.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library fontface_loaded_test; 1 library fontface_loaded_test;
2 2
3 import 'package:unittest/unittest.dart'; 3 import 'package:unittest/unittest.dart';
4 import 'package:unittest/html_config.dart'; 4 import 'package:unittest/html_config.dart';
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:isolate'; 7 import 'dart:isolate';
8 import 'dart:html'; 8 import 'dart:html';
9 9
10 class NullTreeSanitizer implements NodeTreeSanitizer { 10 class NullTreeSanitizer implements NodeTreeSanitizer {
11 void sanitizeTree(Node node) {} 11 void sanitizeTree(Node node) {}
12 } 12 }
13 13
14 main() { 14 main() {
15 useHtmlConfiguration(); 15 useHtmlConfiguration();
16 16
17 var style = new Element.html(''' 17 var style = new Element.html(
18 '''
18 <style> 19 <style>
19 @font-face { 20 @font-face {
20 font-family: 'Ahem'; 21 font-family: 'Ahem';
21 src: url(../../resources/Ahem.ttf); 22 src: url(/root_dart/tests/html/Ahem.ttf);
22 font-style: italic; 23 font-style: italic;
23 font-weight: 300; 24 font-weight: 300;
24 unicode-range: U+0-3FF; 25 unicode-range: U+0-3FF;
25 font-variant: small-caps; 26 font-variant: small-caps;
26 -webkit-font-feature-settings: "dlig" 1; 27 -webkit-font-feature-settings: "dlig" 1;
27 /* font-stretch property is not supported */ 28 /* font-stretch property is not supported */
28 } 29 }
29 </style> 30 </style>
30 ''', treeSanitizer: new NullTreeSanitizer()); 31 ''',
32 treeSanitizer: new NullTreeSanitizer());
31 document.head.append(style); 33 document.head.append(style);
32 34
33
34 test('document fonts - temporary', () { 35 test('document fonts - temporary', () {
35 var atLeastOneFont = false; 36 var atLeastOneFont = false;
37 var loaded = [];
36 document.fonts.forEach((FontFace fontFace, _, __) { 38 document.fonts.forEach((FontFace fontFace, _, __) {
37 atLeastOneFont = true; 39 atLeastOneFont = true;
38 Future f1 = fontFace.loaded; 40 Future f1 = fontFace.loaded;
39 Future f2 = fontFace.loaded; 41 Future f2 = fontFace.loaded;
40 expect(f1, equals(f2)); // Repeated calls should answer the same Future. 42 loaded.add(fontFace.load());
41 43 loaded.add(f1);
42 expect(fontFace.load(), throws); 44 loaded.add(f2);
43 }); 45 });
44 expect(atLeastOneFont, isTrue); 46 expect(atLeastOneFont, isTrue);
47 return Future.wait(loaded).then(expectAsync((_) {
48 document.fonts.forEach((fontFace, _, __) {
49 expect(fontFace.status, 'loaded');
50 });
51 }));
45 }); 52 });
46 } 53 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/js_backend_cps_ir_basic_test.dart ('k') | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698