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

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, 4 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') | Source/core/css/FontFaceSet.cpp » ('J')
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..6f0195d7db878e83fe9628f83ed71c519491e56e
--- /dev/null
+++ b/LayoutTests/fast/css/fontfaceset-ready.html
@@ -0,0 +1,31 @@
+<!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);
+ face.load();
+ var newReady = document.fonts.ready;
dominicc (has gone to gerrit) 2015/09/02 00:14:06 Exactly when does document.fonts.ready get reset?
Kunihiko Sakamoto 2015/09/02 05:05:42 That is when face.load() is called. Added another
+ assert_not_equals(newReady, oldReady,
dominicc (has gone to gerrit) 2015/09/02 00:14:06 Because resetting [[ReadyPromise]] happens at the
Kunihiko Sakamoto 2015/09/02 05:05:41 Done.
+ 'FontFaceSet.ready should be replaced when a FontFace in it started loading');
+ return newReady;
+ }).then(function(fonts) {
+ assert_equals(face.status, 'loaded',
+ 'FontFaceSet.ready should be resolved after all fonts have been loaded');
+ });
+}, 'FontFaceSet.ready attribute');
+
+</script>
« no previous file with comments | « no previous file | Source/core/css/FontFaceSet.h » ('j') | Source/core/css/FontFaceSet.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698