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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/html/dom/reflection.js

Issue 2478613003: Revert of Import wpt@a99ba661fff2fb129894bdff21d63814d9b3f7e9 (Closed)
Patch Set: Created 4 years, 1 month 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/wpt/html/dom/reflection.js
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/html/dom/reflection.js b/third_party/WebKit/LayoutTests/imported/wpt/html/dom/reflection.js
index b105a8b5ad68ee325256fa77045f0885b055af24..72ed01ef7bfa45288127f5844df29653dce95156 100644
--- a/third_party/WebKit/LayoutTests/imported/wpt/html/dom/reflection.js
+++ b/third_party/WebKit/LayoutTests/imported/wpt/html/dom/reflection.js
@@ -567,6 +567,15 @@
// probably safe enough. Just don't read stuff that will change.
ReflectionHarness.currentTestInfo = {data: data, idlName: idlName, idlObj: idlObj, domName: domName, domObj: domObj};
+ ReflectionHarness.testWrapper(function() {
+ ReflectionTests.doReflects(data, idlName, idlObj, domName, domObj);
+ });
+};
+
+/**
+ * Actual implementation of the above.
+ */
+ReflectionTests.doReflects = function(data, idlName, idlObj, domName, domObj) {
// If we don't recognize the type, testing is impossible.
if (this.typeMap[data.type] === undefined) {
if (unimplemented.indexOf(data.type) == -1) {
@@ -582,15 +591,9 @@
}
// Test that typeof idlObj[idlName] is correct. If not, further tests are
- // probably pointless, so bail out if we're not running conformance tests.
- var expectedType = data.isNullable && data.defaultVal === null ? "object"
- : typeInfo.jsType;
- ReflectionHarness.test(function() {
- ReflectionHarness.assertEquals(typeof idlObj[idlName], expectedType);
- }, "typeof IDL attribute");
-
- if (!ReflectionHarness.conformanceTesting &&
- typeof idlObj[idlName] !== expectedType) {
+ // probably pointless, so bail out.
+ var isDefaultValueNull = data.isNullable && data.defaultVal === null;
+ if (!ReflectionHarness.test(typeof idlObj[idlName], isDefaultValueNull ? "object" : typeInfo.jsType, "typeof IDL attribute")) {
return;
}
@@ -600,9 +603,7 @@
defaultVal = typeInfo.defaultVal;
}
if (defaultVal !== null || data.isNullable) {
- ReflectionHarness.test(function() {
- ReflectionHarness.assertEquals(idlObj[idlName], defaultVal);
- }, "IDL get with DOM attribute unset");
+ ReflectionHarness.test(idlObj[idlName], defaultVal, "IDL get with DOM attribute unset");
}
var domTests = typeInfo.domTests.slice(0);
@@ -703,42 +704,50 @@
// the test.
continue;
}
- ReflectionHarness.test(function() {
+ try {
domObj.setAttribute(domName, domTests[i]);
- ReflectionHarness.assertEquals(domObj.getAttribute(domName),
- String(domTests[i]), "getAttribute()");
- ReflectionHarness.assertEquals(idlObj[idlName], domExpected[i],
- "IDL get");
- }, "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]));
+ ReflectionHarness.test(domObj.getAttribute(domName), String(domTests[i]), "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]) + " followed by getAttribute()");
+ ReflectionHarness.test(idlObj[idlName], domExpected[i], "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]) + " followed by IDL get");
+ if (ReflectionHarness.catchUnexpectedExceptions) {
+ ReflectionHarness.success();
+ }
+ } catch (err) {
+ if (ReflectionHarness.catchUnexpectedExceptions) {
+ ReflectionHarness.failure("Exception thrown during tests with setAttribute() to " + ReflectionHarness.stringRep(domTests[i]));
+ } else {
+ throw err;
+ }
+ }
}
}
for (var i = 0; i < idlTests.length; i++) {
- ReflectionHarness.test(function() {
- if ((data.type == "limited long" && idlTests[i] < 0) ||
- (data.type == "limited unsigned long" && idlTests[i] == 0)) {
- ReflectionHarness.assertThrows("IndexSizeError", function() {
- idlObj[idlName] = idlTests[i];
- });
- } else {
+ if ((data.type == "limited long" && idlTests[i] < 0) ||
+ (data.type == "limited unsigned long" && idlTests[i] == 0)) {
+ ReflectionHarness.testException("INDEX_SIZE_ERR", function() {
+ idlObj[idlName] = idlTests[i];
+ }, "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " must throw INDEX_SIZE_ERR");
+ } else {
+ ReflectionHarness.run(function() {
idlObj[idlName] = idlTests[i];
if (data.type == "boolean") {
// Special case yay
- ReflectionHarness.assertEquals(domObj.hasAttribute(domName),
- Boolean(idlTests[i]), "hasAttribute()");
+ ReflectionHarness.test(domObj.hasAttribute(domName), Boolean(idlTests[i]), "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " followed by hasAttribute()");
} else if (idlDomExpected[i] !== null || data.isNullable) {
var expected = idlDomExpected[i] + "";
if (data.isNullable && idlDomExpected[i] === null) {
expected = null;
}
- ReflectionHarness.assertEquals(domObj.getAttribute(domName), expected,
- "getAttribute()");
+ ReflectionHarness.test(domObj.getAttribute(domName), expected, "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " followed by getAttribute()");
}
if (idlIdlExpected[i] !== null || data.isNullable) {
- ReflectionHarness.assertEquals(idlObj[idlName], idlIdlExpected[i], "IDL get");
+ ReflectionHarness.test(idlObj[idlName], idlIdlExpected[i], "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " followed by IDL get");
}
- }
- }, "IDL set to " + ReflectionHarness.stringRep(idlTests[i]));
+ if (ReflectionHarness.catchUnexpectedExceptions) {
+ ReflectionHarness.success();
+ }
+ }, "IDL set to " + ReflectionHarness.stringRep(idlTests[i]) + " should not throw");
+ }
}
};

Powered by Google App Engine
This is Rietveld 408576698