Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/resources/idlharness.js |
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/resources/idlharness.js b/third_party/WebKit/LayoutTests/imported/web-platform-tests/resources/idlharness.js |
index 75ec97e771c069415e8cc63acdf2e184425a57da..b6a16af41502e7423c5351e385125eba470fb9ac 100644 |
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/resources/idlharness.js |
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/resources/idlharness.js |
@@ -97,6 +97,16 @@ function awaitNCallbacks(n, cb, ctx) { |
}; |
} |
+var fround = (function(){ |
+ if (Math.fround) return Math.fround; |
+ |
+ var arr = new Float32Array(1); |
+ return function fround(n) { |
+ arr[0] = n; |
+ return arr[0]; |
+ }; |
+})(); |
+ |
/// IdlArray /// |
// Entry point |
self.IdlArray = function() |
@@ -457,19 +467,42 @@ IdlArray.prototype.assert_type_is = function(value, type) |
return; |
case "float": |
- case "double": |
+ assert_equals(typeof value, "number"); |
+ assert_equals(value, fround(value), "float rounded to 32-bit float should be itself"); |
+ assert_not_equals(value, Infinity); |
+ assert_not_equals(value, -Infinity); |
+ assert_not_equals(value, NaN); |
+ return; |
+ |
case "DOMHighResTimeStamp": |
+ case "double": |
+ assert_equals(typeof value, "number"); |
+ assert_not_equals(value, Infinity); |
+ assert_not_equals(value, -Infinity); |
+ assert_not_equals(value, NaN); |
+ return; |
+ |
case "unrestricted float": |
+ assert_equals(typeof value, "number"); |
+ assert_equals(value, fround(value), "unrestricted float rounded to 32-bit float should be itself"); |
+ return; |
+ |
case "unrestricted double": |
- // TODO: distinguish these cases |
assert_equals(typeof value, "number"); |
return; |
case "DOMString": |
+ assert_equals(typeof value, "string"); |
+ return; |
+ |
case "ByteString": |
+ assert_equals(typeof value, "string"); |
+ assert_regexp_match(value, /^[\x00-\x7F]*$/); |
+ return; |
+ |
case "USVString": |
- // TODO: https://github.com/w3c/testharness.js/issues/92 |
assert_equals(typeof value, "string"); |
+ assert_regexp_match(value, /^([\x00-\ud7ff\ue000-\uffff]|[\ud800-\udbff][\udc00-\udfff])*$/); |
return; |
case "object": |