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

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

Issue 1327083002: Revert "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 '''
19 <style> 18 <style>
20 @font-face { 19 @font-face {
21 font-family: 'Ahem'; 20 font-family: 'Ahem';
22 src: url(/root_dart/tests/html/Ahem.ttf); 21 src: url(../../resources/Ahem.ttf);
23 font-style: italic; 22 font-style: italic;
24 font-weight: 300; 23 font-weight: 300;
25 unicode-range: U+0-3FF; 24 unicode-range: U+0-3FF;
26 font-variant: small-caps; 25 font-variant: small-caps;
27 -webkit-font-feature-settings: "dlig" 1; 26 -webkit-font-feature-settings: "dlig" 1;
28 /* font-stretch property is not supported */ 27 /* font-stretch property is not supported */
29 } 28 }
30 </style> 29 </style>
31 ''', 30 ''', treeSanitizer: new NullTreeSanitizer());
32 treeSanitizer: new NullTreeSanitizer());
33 document.head.append(style); 31 document.head.append(style);
34 32
33
35 test('document fonts - temporary', () { 34 test('document fonts - temporary', () {
36 var atLeastOneFont = false; 35 var atLeastOneFont = false;
37 var loaded = [];
38 document.fonts.forEach((FontFace fontFace, _, __) { 36 document.fonts.forEach((FontFace fontFace, _, __) {
39 atLeastOneFont = true; 37 atLeastOneFont = true;
40 Future f1 = fontFace.loaded; 38 Future f1 = fontFace.loaded;
41 Future f2 = fontFace.loaded; 39 Future f2 = fontFace.loaded;
42 loaded.add(fontFace.load()); 40 expect(f1, equals(f2)); // Repeated calls should answer the same Future.
43 loaded.add(f1); 41
44 loaded.add(f2); 42 expect(fontFace.load(), throws);
45 }); 43 });
46 expect(atLeastOneFont, isTrue); 44 expect(atLeastOneFont, isTrue);
47 return Future.wait(loaded).then(expectAsync((_) {
48 document.fonts.forEach((fontFace, _, __) {
49 expect(fontFace.status, 'loaded');
50 });
51 }));
52 }); 45 });
53 } 46 }
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