Skip to content

Commit

Permalink
Merge 8a0efec into 7f2990a
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffcarp committed Dec 8, 2016
2 parents 7f2990a + 8a0efec commit 41d9178
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This is a testharness.js-based test.
FAIL Timing of fullscreenchange and resize events assert_array_equals: event order lengths differ, expected 2 got 1
Harness: the test ran to completion.

33 changes: 33 additions & 0 deletions fullscreen/api/document-exit-fullscreen-timing-manual.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<title>Document#exitFullscreen() timing</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<script>
async_test(t => {
const div = document.querySelector('div');
trusted_request(div);

document.onfullscreenchange = t.step_func(() => {
// We are now in fullscreen. Exit again.
assert_equals(document.fullscreenElement, div);
document.exitFullscreen();

// If fullscreenchange is an animation frame event, then animation frame
// callbacks should be run after it is fired, before the timer callback.
// The resize event should fire before the fullscreenchange event.
const events = [];
const callback = t.step_func(event => {
events.push(event.type);
if (event.type == 'fullscreenchange') {
setTimeout(t.unreached_func('timer callback'));
requestAnimationFrame(t.step_func_done(() => {
assert_array_equals(events, ['resize', 'fullscreenchange'], 'event order');
}));
}
});
document.onfullscreenchange = window.onresize = callback;
});
}, 'Timing of fullscreenchange and resize events');
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This is a testharness.js-based test.
FAIL Timing of fullscreenchange and resize events assert_unreached: timer callback Reached unreachable code
PASS Timing of fullscreenerror event
Harness: the test ran to completion.

37 changes: 37 additions & 0 deletions fullscreen/api/element-request-fullscreen-timing-manual.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<title>Element#requestFullscreen() timing</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<script>
async_test(t => {
trusted_request(document.querySelector('div'));

// If fullscreenchange is an animation frame event, then animation frame
// callbacks should be run after it is fired, before the timer callback.
// The resize event should fire before the fullscreenchange event.
const events = [];
const callback = t.step_func(event => {
events.push(event.type);
if (event.type == 'fullscreenchange') {
setTimeout(t.unreached_func('timer callback'));
requestAnimationFrame(t.step_func_done(() => {
assert_array_equals(events, ['resize', 'fullscreenchange'], 'event order');
}));
}
});
document.onfullscreenchange = window.onresize = callback;
}, 'Timing of fullscreenchange and resize events');

async_test(t => {
document.createElement('a').requestFullscreen();

// If fullscreenerror is an animation frame event, then animation frame
// callbacks should be run after it is fired, before the timer callback.
document.onfullscreenerror = t.step_func(() => {
setTimeout(t.unreached_func('timer callback'));
requestAnimationFrame(t.step_func_done());
});
}, 'Timing of fullscreenerror event');
</script>

0 comments on commit 41d9178

Please sign in to comment.