Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in test_driver.bless() #49719

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions fullscreen/rendering/backdrop-object.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
background: blue;
}
</style>
<object width="200" type="image/svg+xml" data="/images/100px-green-rect.svg"></object>
<object width="200" type="image/svg+xml"></object>

<script>
const object = document.querySelector("object");
Promise.all([
new Promise((resolve, reject) => document.addEventListener("fullscreenchange", resolve)),
new Promise((resolve, reject) => object.addEventListener("load", resolve))
]).then(() => document.documentElement.classList.remove('reftest-wait'));

test_driver.bless('fullscreen', () => object.requestFullscreen());
test_driver.bless('fullscreen')
.then(() => {object.data="/images/100px-green-rect.svg";})
.then(() => new Promise((resolve) => object.addEventListener("load", resolve)))
.then(() => object.requestFullscreen())
.then(() => new Promise((resolve) => document.addEventListener("fullscreenchange", resolve)))
.then(() => document.documentElement.classList.remove('reftest-wait'));
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,39 @@
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<body></body>

<body>
<script type=module>
import inputTypes from "./input-types.js";

for (const inputType of inputTypes) {
test(() => {
const input = document.createElement("input");
input.setAttribute("type", inputType);
// File pickers can't be closed.
const types = inputTypes.filter((t) => t != 'file');

function createElement(t,type) {
const input = document.createElement("input");
input.setAttribute("type", type);
document.body.appendChild(input);
t.add_cleanup(() => input.remove());
return input;
}
for (const inputType of types) {
promise_test(async (t) => {
const input = createElement(t,inputType);
assert_throws_dom('NotAllowedError', () => { input.showPicker(); });
}, `input[type=${inputType}] showPicker() requires a user gesture`);
}

for (const inputType of inputTypes) {
promise_test(async t => {
const input = document.createElement("input");
input.setAttribute("type", inputType);

promise_test(async (t) => {
const input = createElement(t,inputType);
await test_driver.bless('show picker');
input.showPicker();
input.blur();
}, `input[type=${inputType}] showPicker() does not throw when user activation is active`);
}

for (const inputType of inputTypes) {
promise_test(async () => {
const input = document.createElement('input');
input.setAttribute('type', inputType);

promise_test(async (t) => {
const input = createElement(t,inputType);
await test_driver.bless('show picker');
input.showPicker();
input.blur();

assert_false(navigator.userActivation.isActive);
}, `input[type=${inputType}] showPicker() consumes user activation`);
}
Expand Down
4 changes: 2 additions & 2 deletions resources/testdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@
let wait_click = new Promise(resolve => button.addEventListener("click", resolve));

return test_driver.click(button)
.then(wait_click)
.then(function() {
.then(() => wait_click)
.then(() => {
button.remove();

if (typeof action === "function") {
Expand Down