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

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

Issue 1313853003: CSS Font Loading: FontFaceSet.ready should return the same promise each time (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/css/FontFaceSet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/css/fontfaceset-ready.html
diff --git a/LayoutTests/fast/css/fontfaceset-ready.html b/LayoutTests/fast/css/fontfaceset-ready.html
new file mode 100644
index 0000000000000000000000000000000000000000..c55b7f3c4e7776f40143a4f02d16a9d7e9286889
--- /dev/null
+++ b/LayoutTests/fast/css/fontfaceset-ready.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<title>FontFaceSet.ready attribute</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+
+promise_test(function(t) {
+ assert_equals(document.fonts.ready, document.fonts.ready,
+ 'FontFaceSet.ready should return the same promise');
+
+ var face = new FontFace('test', 'url(../../resources/Ahem.ttf)');
+
+ return document.fonts.ready
+ .then(function(fonts) {
+ assert_equals(fonts, document.fonts,
+ 'FontFaceSet.ready should be resolved with the FontFaceSet');
+
+ var oldReady = document.fonts.ready;
+ document.fonts.add(face);
+ assert_equals(document.fonts.ready, oldReady,
+ 'FontFaceSet.ready should not be replaced when FontFace added to it is not loading');
+ assert_equals(document.fonts.status, 'loaded',
+ 'FontFaceSet.status after adding unloaded FontFace');
+ face.load();
+ var newReady = document.fonts.ready;
+ assert_not_equals(newReady, oldReady,
+ 'FontFaceSet.ready should be replaced when a FontFace in it started loading');
+ assert_equals(document.fonts.status, 'loading',
+ 'FontFaceSet.status after calling load() on a FontFace in it');
+ return newReady;
+ }).then(function(fonts) {
+ assert_equals(face.status, 'loaded',
+ 'FontFaceSet.ready should be resolved after all fonts have been loaded');
+ assert_equals(document.fonts.status, 'loaded',
+ 'FontFaceSet.status after FontFaceSet.ready is resolved');
+ });
+}, 'FontFaceSet.ready attribute');
+
+</script>
« no previous file with comments | « no previous file | Source/core/css/FontFaceSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698