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

Unified Diff: LayoutTests/fast/css/fontfaceset-load.html

Issue 196383035: Fix promise resolution of FontFaceSet#load() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/css/fontfaceset-load-expected.txt » ('j') | Source/bindings/v8/V8Binding.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/css/fontfaceset-load.html
diff --git a/LayoutTests/fast/css/fontfaceset-load.html b/LayoutTests/fast/css/fontfaceset-load.html
new file mode 100644
index 0000000000000000000000000000000000000000..0b7b10468be022a2803457caa4b5c6bafeed9ae8
--- /dev/null
+++ b/LayoutTests/fast/css/fontfaceset-load.html
@@ -0,0 +1,63 @@
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+<style>
+@font-face {
+ font-family: TestFont;
+ src: local('Courier New');
+}
+
+@font-face {
+ font-family: TestFont;
+ src: url(../../resources/Ahem.ttf);
+ unicode-range: u+41-5a; /* 'A'-'Z' */
+}
+
+@font-face {
+ font-family: TestFont;
+ src: url('resources/DownLoadErrorAhem.otf');
+ unicode-range: u+61-7a; /* 'a'-'z' */
+}
+</style>
+<script>
+description('Tests load() method of FontFaceSet.');
+
+window.jsTestIsAsync = true;
+
+function step1() {
+ document.fonts.load('10px TestFont', 'ABC.').then(step2);
+}
+
+function step2(v) {
+ value = v;
+ shouldBe('value.length', '2');
+ shouldBeEqualToString('value[0].unicodeRange', 'U+0-10FFFF');
+ shouldBeEqualToString('value[1].unicodeRange', 'U+41-5A');
+ shouldBeEqualToString('value[0].status', 'loaded');
+ shouldBeEqualToString('value[1].status', 'loaded');
+ document.fonts.load('10px TestFont', 'abc.').catch(step3);
+}
+
+function step3(v) {
+ value = v;
+ shouldBeEqualToString('value.name', 'NetworkError');
+ document.fonts.load('InvalidFontDescription', 'abc.').catch(step4);
+}
+
+function step4(v) {
+ value = v;
+ shouldBeEqualToString('value.name', 'SyntaxError');
+ finishJSTest();
+}
+
+if (document.fonts)
+ step1();
+else {
+ testFailed('document.fonts does not exist');
+ finishJSTest();
+}
+</script>
+</head>
+<body>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/css/fontfaceset-load-expected.txt » ('j') | Source/bindings/v8/V8Binding.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698