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

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/resources/idlharness.js

Issue 1923043002: Import web-platform-tests@028d354aba4c8ee6700def957a45f3927241d8b0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix expectations after the test harness was updated Created 4 years, 8 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
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":

Powered by Google App Engine
This is Rietveld 408576698