Skip to content

Commit

Permalink
Add web platform tests for HTMLMediaElement controlsList (web-platfor…
Browse files Browse the repository at this point in the history
…m-tests#29215)

As promised in the intent[1], this CL adds some web platform tests for
the HTMLMediaElement controlsList attribute.

[1] https://groups.google.com/a/chromium.org/g/blink-dev/c/u9jsiarDEOg

Bug: 1211336
Change-Id: Id6d6993a0a378c43c2ff96088137ba0942d96041
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2940166
Reviewed-by: Tommy Steimel <[email protected]>
Reviewed-by: Yoav Weiss <[email protected]>
Commit-Queue: François Beaufort <[email protected]>
Cr-Commit-Position: refs/heads/master@{#889328}

Co-authored-by: Francois Beaufort <[email protected]>
  • Loading branch information
1 parent 637847d commit 48afd78
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions html/dom/elements-embedded.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ var embeddedElements = {
autoplay: "boolean",
loop: "boolean",
controls: "boolean",
controlsList: {type: "tokenlist", domAttrName: "controlsList"},
defaultMuted: {type: "boolean", domAttrName: "muted"},

width: "unsigned long",
Expand Down
31 changes: 31 additions & 0 deletions html/semantics/embedded-content/media-elements/controlsList.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<title>Test controlsList attribute</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
const allowedValues = [
"nodownload",
"nofullscreen",
"noplaybackrate",
"noremoteplayback",
];

function testControlsList(tagName) {
const element = document.createElement(tagName);

// Test that supports() is returning true for allowed values.
for (const value of allowedValues) {
assert_true(
element.controlsList.supports(value),
`tag = ${element.tagName}, value = ${value} must be supported`
);
}
}

["audio", "video"].forEach((tagName) => {
test(
() => testControlsList(tagName),
`Test controlsList allowed values for <${tagName}>`
);
});
</script>

0 comments on commit 48afd78

Please sign in to comment.