Automatic update from web-platform-tests [PEPC] Refactor HTMLPermissionElement to HTMLCapabilityElementBase This CL refactors the Page Embedded Permission Control (PEPC) implementation in Blink. 1. Renames HTMLPermissionElement logic to HTMLCapabilityElementBase to serve as an abstract base class. 2. Decouples HTMLGeolocationElement, HTMLUserMediaElement, and HTMLInstallElement from generic type parsing. 3. Updates HTMLPermissionElement to inherit from HTMLCapabilityElementBase, preserving the existing behavior for the <permission> element as a temporary measure before deprecation. NO_IFTTT=False positive. Bug: 448593977 Change-Id: Ica85ccc4745e4765a3457e1a62551de5864e00d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7368050 Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: Dave Tapuska <dtapuska@chromium.org> Cr-Commit-Position: refs/heads/main@{#1584921} -- wpt-commits: 8783150e0968d4d7616ad8d75e444d078b8d43ff wpt-pr: 57793
77 lines
2.6 KiB
HTML
77 lines
2.6 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>Usermedia Element: display style validation</title>
|
|
<link
|
|
rel="help"
|
|
href="https://github.com/WICG/PEPC/blob/main/explainer.md#locking-the-pepc-style"
|
|
/>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
function createUsermediaElementWithStyle(displayValue, type) {
|
|
const element = document.createElement("usermedia");
|
|
|
|
element.setAttribute("type", type);
|
|
element.style.display = displayValue;
|
|
document.body.appendChild(element);
|
|
return element;
|
|
}
|
|
|
|
const testCases = [
|
|
["block", ""],
|
|
["inline-block", ""],
|
|
["flex", ""],
|
|
["inline-flex", ""],
|
|
["inline", "style_invalid"],
|
|
["contents", "style_invalid"],
|
|
["inline-table", "style_invalid"],
|
|
["list-item", "style_invalid"],
|
|
["ruby", "style_invalid"],
|
|
["ruby-text", "style_invalid"],
|
|
["table", "style_invalid"],
|
|
["table-caption", "style_invalid"],
|
|
["table-cell", "style_invalid"],
|
|
["table-column", "style_invalid"],
|
|
["table-column-group", "style_invalid"],
|
|
["table-footer-group", "style_invalid"],
|
|
["table-header-group", "style_invalid"],
|
|
["table-row", "style_invalid"],
|
|
["table-row-group", "style_invalid"],
|
|
];
|
|
|
|
const usermediaTypes = ["camera", "microphone", "camera microphone"];
|
|
|
|
testCases.forEach((testCase, index) =>
|
|
testCase.push(usermediaTypes[index % usermediaTypes.length]),
|
|
);
|
|
async_test((t) => {
|
|
let completedTests = 0;
|
|
|
|
testCases.forEach(([displayValue, expectedInvalidReason, type]) => {
|
|
const element = createUsermediaElementWithStyle(displayValue, type);
|
|
element.onvalidationstatuschange = t.step_func(() => {
|
|
// These two invalid reasons are expected when the usermedia element was just created.
|
|
if (
|
|
element.invalidReason == "unsuccessful_registration" ||
|
|
element.invalidReason == "intersection_changed"
|
|
) {
|
|
return;
|
|
}
|
|
assert_equals(
|
|
element.invalidReason,
|
|
expectedInvalidReason,
|
|
`display: ${displayValue} should be ${expectedInvalidReason === "" ? "valid" : "invalid"}`,
|
|
);
|
|
element.remove();
|
|
if (++completedTests === testCases.length) t.done();
|
|
});
|
|
});
|
|
}, "Usermedia element display style validation");
|
|
</script>
|
|
</body>
|
|
</html>
|