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

Unified Diff: third_party/WebKit/LayoutTests/fast/css/fontfaceset-set-operations.html

Issue 1409433003: CSS Font Loading: make FontFaceSet Setlike (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert FastAlloc Created 5 years, 2 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 | third_party/WebKit/LayoutTests/fast/css/fontfaceset-set-operations-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/css/fontfaceset-set-operations.html
diff --git a/third_party/WebKit/LayoutTests/fast/css/fontfaceset-set-operations.html b/third_party/WebKit/LayoutTests/fast/css/fontfaceset-set-operations.html
index 48c2fa090aed9460275d69ec5cde536be9ce6831..8587d4573e9d4912d8255f4640b482b02d5dcd4a 100644
--- a/third_party/WebKit/LayoutTests/fast/css/fontfaceset-set-operations.html
+++ b/third_party/WebKit/LayoutTests/fast/css/fontfaceset-set-operations.html
@@ -20,23 +20,10 @@
<script>
description('Tests Set operations of FontFaceSet.');
-function runTests() {
- nonCssConnectedFace = new FontFace("MyFont", "local(Arial)", {});
-
- shouldBe('document.fonts.size', '3');
+thisArg = {};
+faces = []
- thisArg = {};
- faces = [];
- document.fonts.forEach(function(face, faceAgain, set) {
- if (faces.length == 0) {
- callbackArgs = arguments;
- thisValue = this;
- shouldBeTrue('callbackArgs[0] === callbackArgs[1]');
- shouldBeTrue('callbackArgs[2] === document.fonts');
- shouldBeTrue('thisValue === thisArg');
- }
- faces.push(face);
- }, thisArg);
+function checkResults() {
shouldBe('faces.length', '3');
shouldBeEqualToString('faces[0].family', 'Font1');
@@ -46,6 +33,49 @@ function runTests() {
shouldBeTrue('document.fonts.has(faces[0])');
shouldBeTrue('document.fonts.has(faces[1])');
shouldBeTrue('document.fonts.has(faces[2])');
+}
+
+function callback(face, faceAgain, set) {
+ if (faces.length == 0) {
+ callbackArgs = arguments;
+ thisValue = this;
+ shouldBeType('callbackArgs[0]', 'FontFace');
+ shouldBeTrue('callbackArgs[0] === callbackArgs[1]');
+ shouldBeTrue('callbackArgs[2] === document.fonts');
+ shouldBeTrue('thisValue === thisArg');
+ }
+ faces.push(face);
+}
+
+function runTests() {
+ nonCssConnectedFace = new FontFace("MyFont", "local(Arial)", {});
+
+ shouldBe('document.fonts.size', '3');
+
+ debug('check forEach');
+ document.fonts.forEach(callback, thisArg);
+ checkResults();
+
+ debug('check keys');
+ faces = [];
+ for (face of document.fonts.keys())
+ faces.push(face);
+ checkResults();
+
+ debug('check values');
+ faces = [];
+ for (face of document.fonts.values())
+ faces.push(face);
+ checkResults();
+
+ debug('check entries');
+ faces = [];
+ for (entry of document.fonts.entries()) {
+ shouldBeTrue('entry[0] === entry[1]');
+ faces.push(entry[1]);
+ }
+ checkResults();
+
shouldBeFalse('document.fonts.has(nonCssConnectedFace)');
shouldThrow('document.fonts.has("Font1")', '"TypeError: Failed to execute \'has\' on \'FontFaceSet\': The argument is not a FontFace."');
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/css/fontfaceset-set-operations-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698