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

Screen orientation lock: remove bad 'hidden' tests #38511

Merged
merged 3 commits into from
Feb 20, 2023
Merged
Changes from 2 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
34 changes: 4 additions & 30 deletions screen-orientation/hidden_document.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,22 @@

promise_test(async (t) => {
const { minimize, restore } = window_state_context(t);
t.add_cleanup(makeCleanup());

await minimize();

assert_equals(document.visibilityState, "hidden", "Document must be hidden");
await promise_rejects_dom(t, "SecurityError", screen.orientation.lock("landscape") );
const opposite = getOppositeOrientation();
await promise_rejects_dom(t, "SecurityError", screen.orientation.lock(opposite) );
}, "hidden documents must reject went trying to call lock or unlock");

promise_test(async (t) => {
const { minimize, restore } = window_state_context(t);
t.add_cleanup(restore);
marcoscaceres marked this conversation as resolved.
Show resolved Hide resolved
marcoscaceres marked this conversation as resolved.
Show resolved Hide resolved

await minimize();

assert_equals(document.visibilityState, "hidden", "Document must be hidden");
assert_throws_dom("SecurityError", () => screen.orientation.unlock());
}, "hidden documents must reject went trying to call unlock");

promise_test(async (t) => {
const { minimize, restore } = window_state_context(t);
t.add_cleanup(makeCleanup());
await screen.orientation.lock(getOppositeOrientation());

await minimize();

assert_equals(document.visibilityState, "hidden", "Document must be hidden");
assert_throws_dom("SecurityError", () => screen.orientation.unlock());
}, "hidden documents must not unlock the screen orientation");

promise_test(async (t) => {
const { minimize, restore } = window_state_context(t);
t.add_cleanup(makeCleanup());
await screen.orientation.lock(getOppositeOrientation());

await minimize();

assert_equals(document.visibilityState, "hidden");
await promise_rejects_dom(t, "SecurityError", screen.orientation.lock(getOppositeOrientation()));

// Maximize, now everything should work as expected.
await restore();

assert_equals(document.visibilityState, "visible");
await screen.orientation.lock(getOppositeOrientation());
screen.orientation.unlock();
}, "Once maximized, a minimized window can lock or unlock the screen orientation again");
</script>