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."'); |