Commit f9d3f0ab authored by Keith Cirkel's avatar Keith Cirkel Committed by aborovova@mozilla.com
Browse files

Bug 1966338 [wpt PR 52527] - add tests for canonicalisation of the video preload attribute,

Automatic update from web-platform-tests
add tests for canonicalisation of the video preload attribute (#52527)

--

wpt-commits: 3b98b229846386fa60eec6ecb6ef93074033c4c5
wpt-pr: 52527

Differential Revision: https://phabricator.services.mozilla.com/D250623
parent 47e2efc7
Loading
Loading
Loading
Loading
+4 −4
Changes for testing/web-platform/tests/html/dom/elements-embedded.js: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -88,8 +88,8 @@ var embeddedElements = {
    // HTMLMediaElement
    src: "url",
    crossOrigin: {type: "enum", keywords: ["anonymous", "use-credentials"], nonCanon:{"": "anonymous"}, isNullable: true, defaultVal: null, invalidVal: "anonymous"},
    // As with "keytype", we have no missing value default defined here.
    preload: {type: "enum", keywords: ["none", "metadata", "auto"], nonCanon: {"": "auto"}, defaultVal: null},
    // Missing/Invalid value is implementation defined but must be one of the keywords
    preload: {type: "enum", keywords: ["none", "metadata", "auto"], nonCanon: {"": "auto"}, defaultVal: ["none", "metadata", "auto"]},
    autoplay: "boolean",
    loop: "boolean",
    controls: "boolean",
@@ -105,8 +105,8 @@ var embeddedElements = {
    // HTMLMediaElement
    src: "url",
    crossOrigin: {type: "enum", keywords: ["anonymous", "use-credentials"], nonCanon:{"": "anonymous"}, isNullable: true, defaultVal: null, invalidVal: "anonymous"},
    // As with "keytype", we have no missing value default defined here.
    preload: {type: "enum", keywords: ["none", "metadata", "auto"], nonCanon: {"": "auto"}, defaultVal: null},
    // Missing/Invalid value is implementation defined but must be one of the keywords
    preload: {type: "enum", keywords: ["none", "metadata", "auto"], nonCanon: {"": "auto"}, defaultVal: ["none", "metadata", "auto"]},
    autoplay: "boolean",
    loop: "boolean",
    controls: "boolean",
+2 −0
Changes for testing/web-platform/tests/html/dom/new-harness.js: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -8,4 +8,6 @@ ReflectionHarness.test = function(fun, description) {

ReflectionHarness.assertEquals = assert_equals;

ReflectionHarness.assertInArray = assert_in_array;

ReflectionHarness.assertThrows = assert_throws_dom;
+20 −0
Changes for testing/web-platform/tests/html/dom/original-harness.js: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -130,6 +130,26 @@ ReflectionHarness.assertEquals = function(expected, actual, description) {
  }
}

/**
 * If answer.includes(question), output a success, else report a failure with the
 * given description.  Currently success and failure both increment counters,
 * and failures output a message to a <ul>.  Which <ul> is decided by the type
 * parameter -- different attribute types are separated for readability.
 *
 * @public
 */
ReflectionHarness.assertInArray = function(expected, actual, description) {
  if (actual.includes(expected)) {
    this.increment(this.passed);
  } else {
    this.increment(this.failed);
    this.reportFailure(this.currentTestDescription +
        (description ? " followed by " + description : "") +
        ' (expected one of ' + this.stringRep(actual) + ', got ' +
        this.stringRep(expected) + ')');
  }
}

/**
 * If calling fn causes a DOMException of the type given by the string
 * exceptionName (e.g., "IndexSizeError"), output a success.  Otherwise, report
+21 −2
Changes for testing/web-platform/tests/html/dom/reflection.js: 21 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -186,7 +186,8 @@ var maxUnsigned = 4294967295;
 *
 *   "jsType": What typeof idlObj[idlName] is supposed to be.
 *   "defaultVal": The default value to be returned if the attribute is not
 *       present and no default is specifically set for this attribute.
 *       present and no default is specifically set for this attribute. If
 *       it is an array then any value in the array is acceptable.
 *   "domTests": What values to test with setAttribute().
 *   "domExpected": What values to expect with IDL get after setAttribute().
 *       Defaults to the same as domTests.
@@ -761,7 +762,12 @@ ReflectionTests.reflects = function(data, idlName, idlObj, domName, domObj) {
    }
    if (!data.customGetter && (defaultVal !== null || data.isNullable)) {
        ReflectionHarness.test(function() {
          // Tests can pass an array of acceptable values
          if (Array.isArray(defaultVal)) {
            ReflectionHarness.assertInArray(idlObj[idlName], defaultVal);
          } else {
            ReflectionHarness.assertEquals(idlObj[idlName], defaultVal);
          }
        }, "IDL get with DOM attribute unset");
    }

@@ -947,8 +953,14 @@ ReflectionTests.reflects = function(data, idlName, idlObj, domName, domObj) {
            domObj.setAttribute(domName, domTests[i]);
            ReflectionHarness.assertEquals(domObj.getAttribute(domName),
                String(domTests[i]), "getAttribute()");
            // Tests can pass an array of acceptable values
            if (Array.isArray(domExpected[i])) {
              ReflectionHarness.assertInArray(idlObj[idlName], domExpected[i],
                  "IDL get");
            } else {
              ReflectionHarness.assertEquals(idlObj[idlName], domExpected[i],
                  "IDL get");
            }
        }, "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]));
    }

@@ -986,7 +998,14 @@ ReflectionTests.reflects = function(data, idlName, idlObj, domName, domObj) {
                    ReflectionHarness.assertEquals(domObj.getAttribute(domName), expected,
                                                   "getAttribute()");
                }
                if (idlIdlExpected[i] !== null || data.isNullable) {
                // Ensure enumerated attributes never reflect in their non-canonical representations
                if (data.type == "enum" && data.nonCanon[idlObj[idlName]]) {
                  ReflectionHarness.assertEquals(idlObj[idlName], data.nonCanon[idlObj[idlName]], "IDL get canonical");
                }
                // Tests can pass an array of acceptable values
                if (Array.isArray(idlIdlExpected[i])) {
                    ReflectionHarness.assertInArray(idlObj[idlName], idlIdlExpected[i], "IDL get");
                } else if (idlIdlExpected[i] !== null || data.isNullable) {
                    ReflectionHarness.assertEquals(idlObj[idlName], idlIdlExpected[i], "IDL get");
                }
            }