Skip to content

Commit

Permalink
Screen orientation lock: remove bad 'hidden' tests (#38511)
Browse files Browse the repository at this point in the history
* Screen orientation lock: remove bad 'hidden' tests

* Update screen-orientation/hidden_document.html

* Update screen-orientation/hidden_document.html
  • Loading branch information
marcoscaceres committed Mar 28, 2023
1 parent 0c26fc8 commit fa7ba7a
Showing 1 changed file with 3 additions and 30 deletions.
33 changes: 3 additions & 30 deletions screen-orientation/hidden_document.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@

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) => {
Expand All @@ -29,33 +31,4 @@
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>

0 comments on commit fa7ba7a

Please sign in to comment.