forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test that element.requestFullscreen() consumes user activation
This makes a bunch of other tests redundant, as they're also calling requestFullscreen() twice, and should all fail in exactly the same way. element-request-fullscreen-same-manual.html is also converted to ensure that a second call in a new click does work, to ensure the failure isn't because the element is the same as the fullscreen element. Follows whatwg/fullscreen#153.
- Loading branch information
Showing
9 changed files
with
53 additions
and
309 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
fullscreen/api/element-request-fullscreen-consume-user-activation.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<title>Element#requestFullscreen() consumes user activation</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<div id="log"></div> | ||
<script> | ||
promise_test(async (t) => { | ||
t.add_cleanup(() => { document.exitFullscreen() }); | ||
|
||
const div = document.querySelector("div"); | ||
|
||
const promises = []; | ||
|
||
await test_driver.bless("fullscreen", () => { | ||
// Request fullscreen twice in a row. The first request should consume the | ||
// user activation and succeed, and the second request should fail because | ||
// of the user activation requirement. | ||
const p1 = div.requestFullscreen(); | ||
const p2 = div.requestFullscreen(); | ||
promises.push(p1); | ||
promises.push(promise_rejects_js(t, TypeError, p2)); | ||
}); | ||
|
||
await Promise.all(promises); | ||
}); | ||
</script> |
25 changes: 25 additions & 0 deletions
25
fullscreen/api/element-request-fullscreen-same-element.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<title>Element#requestFullscreen() on the current fullscreen element</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<div id="log"></div> | ||
<script> | ||
promise_test(async (t) => { | ||
t.add_cleanup(() => { document.exitFullscreen() }); | ||
|
||
// Use the body element as the fullscreen element, because the second | ||
// test_driver.bless() call needs to insert a button inside of it, which | ||
// can't be clicked if another element is already fullscreen. | ||
const target = document.body; | ||
|
||
// First enter fullscreen. | ||
await test_driver.bless("fullscreen", () => target.requestFullscreen()); | ||
assert_equals(document.fullscreenElement, target, "fullscreen element after first request"); | ||
|
||
// Now request fullscreen again, which should be a no-op. | ||
await test_driver.bless("fullscreen", () => target.requestFullscreen()); | ||
assert_equals(document.fullscreenElement, target, "fullscreen element after second request"); | ||
}); | ||
</script> |
30 changes: 0 additions & 30 deletions
30
fullscreen/api/element-request-fullscreen-same-manual.html
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
fullscreen/api/element-request-fullscreen-twice-manual.html
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
fullscreen/api/element-request-fullscreen-twice-manual.tentative.html
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
fullscreen/api/element-request-fullscreen-two-elements-manual.html
This file was deleted.
Oops, something went wrong.
56 changes: 0 additions & 56 deletions
56
fullscreen/api/element-request-fullscreen-two-elements-manual.tentative.html
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
fullscreen/api/element-request-fullscreen-two-iframes-manual.html
This file was deleted.
Oops, something went wrong.
65 changes: 0 additions & 65 deletions
65
fullscreen/api/element-request-fullscreen-two-iframes-manual.tentative.html
This file was deleted.
Oops, something went wrong.