Update web-platform-tests to revision 3137d1d2d7757366a69f8a449b458b5057e0e81e

This commit is contained in:
Ms2ger 2016-12-28 09:51:21 +01:00
parent 81ca858678
commit d6ba94ca28
2339 changed files with 89274 additions and 9328 deletions

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<title>Document#exitFullscreen() when the document is not the active document</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe allowfullscreen></iframe>
<script>
var t = async_test();
onload = t.step_func(() => {
var iframe = document.querySelector("iframe");
var documentBeforeNav = iframe.contentDocument;
iframe.onload = t.step_func(() => {
var p = documentBeforeNav.exitFullscreen();
assert_true(p instanceof Promise, 'exitFullscreen() returns promise');
// The promise should already be rejected, so its reject callback should be
// invoked before a second promise's callback.
p.catch(t.step_func_done());
Promise.resolve().then(t.unreached_func('new promise resolved before exitFullscreen() promise rejected'));
});
// Navigate the iframe
window[0].location.href = '/common/blank.html';
});
</script>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Document.exitFullscreen()</title>
<title>Document#exitFullscreen()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
@ -9,7 +9,7 @@ async_test(function(t)
{
trusted_request(document.querySelector("div"));
document.addEventListener("fullscreenchange", t.step_func(function()
document.addEventListener("fullscreenchange", t.step_func(function(event)
{
if (document.fullscreenElement) {
document.exitFullscreen();

View file

@ -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>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<title>Document#exitFullscreen() called twice</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");
document.onfullscreenchange = t.step_func(() => {
// We are now in fullscreen.
assert_equals(document.fullscreenElement, div);
document.onfullscreenchange = t.step_func(() => {
assert_equals(document.fullscreenElement, null);
// Done, but ensure that there's only one fullscreenchange event.
document.onfullscreenchange = t.unreached_func("second fullscreenchange event");
setTimeout(t.step_func_done(), 0);
});
// Exit fullscreen twice.
document.exitFullscreen();
assert_equals(document.fullscreenElement, div, "fullscreenElement after first exitFullscreen()");
document.exitFullscreen();
assert_equals(document.fullscreenElement, div, "fullscreenElement after second exitFullscreen()");
});
document.onfullscreenerror = t.unreached_func("fullscreenerror event");
trusted_request(div);
});
</script>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Document.fullscreenElement</title>
<title>Document#fullscreenElement</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<title>Document#fullscreenEnabled when the document is not the active document</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe allowfullscreen></iframe>
<script>
var t = async_test();
onload = t.step_func(() => {
var iframe = document.querySelector("iframe");
var documentBeforeNav = iframe.contentDocument;
iframe.onload = t.step_func_done(() => {
assert_false(documentBeforeNav.fullscreenEnabled);
});
// Navigate the iframe
window[0].location.href = '/common/blank.html';
});
</script>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Document.fullscreenEnabled</title>
<title>Document#fullscreenEnabled</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Document.onfullscreenchange</title>
<title>Document#onfullscreenchange</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Document.onfullscreenerror</title>
<title>Document#onfullscreenerror</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<title>Element ready check for sibling of fullscreen element</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<div id="a"></div>

View file

@ -8,21 +8,26 @@
<script>
// Verify that an iframe can itself go fullscreen, and that this doesn't
// influence the iframe ancestor test of the element ready check.
async_test(function(t)
{
var iframe = document.querySelector("iframe");
document.onfullscreenchange = t.step_func(function()
{
assert_equals(document.fullscreenElement, iframe, "fullscreen element");
var div = document.createElement("div");
// This adds the div to the iframe element itself, not to the iframe's
// contentDocument. It's done here because the HTML parser treats the
// content of iframe as a text node.
iframe.appendChild(div);
trusted_request(div, iframe.contentDocument.body);
document.onfullscreenchange = t.unreached_func("second fullscreenchange event");
document.onfullscreenerror = t.step_func_done();
async_test(t => {
var iframe = document.querySelector("iframe");
document.onfullscreenchange = t.step_func(() => {
assert_equals(document.fullscreenElement, iframe, "fullscreen element");
// This adds the div to the iframe element itself, not to the iframe's
// contentDocument. It's done here because the HTML parser treats the
// content of iframe as a text node.
var div = document.createElement("div");
iframe.appendChild(div);
document.onfullscreenchange = t.step_func_done(() => {
assert_equals(document.fullscreenElement, div);
});
trusted_request(iframe);
document.onfullscreenerror = t.unreached_func("fullscreenerror event");
trusted_request(div, iframe.contentDocument.body);
});
trusted_request(iframe);
});
</script>

View file

@ -6,12 +6,15 @@
<div id="log"></div>
<iframe><!-- script inserts child here --></iframe>
<script>
async_test(function(t)
{
var div = document.createElement("div");
document.querySelector("iframe").appendChild(div);
document.onfullscreenchange = t.unreached_func("fullscreenchange event");
document.onfullscreenerror = t.step_func_done();
trusted_request(div, document.body);
async_test(t => {
const div = document.createElement("div");
document.querySelector("iframe").appendChild(div);
document.onfullscreenchange = t.step_func_done(() => {
assert_equals(document.fullscreenElement, div);
});
document.onfullscreenerror = t.unreached_func("fullscreenerror event");
trusted_request(div, document.body);
});
</script>

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<title>Element#requestFullscreen() and Document#exitFullscreen() in iframe</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<iframe allowfullscreen></iframe>
<script>
async_test(t => {
const iframe = document.querySelector('iframe');
const iframeDoc = iframe.contentDocument;
const iframeBody = iframeDoc.body;
let count = 0;
document.onfullscreenchange = iframeDoc.onfullscreenchange = t.step_func(event => {
count++;
assert_between_inclusive(count, 1, 4, 'number of fullscreenchange events');
const expected = {
target: count == 1 || count == 4 ? document : iframeDoc,
outerFullscreenElement: count <= 2 ? iframe : null,
innerFullscreenElement: count <= 2 ? iframeBody : null,
};
assert_equals(event.target, expected.target, 'event target');
assert_equals(document.fullscreenElement, expected.outerFullscreenElement, 'outer fullscreenElement');
assert_equals(iframeDoc.fullscreenElement, expected.innerFullscreenElement, 'inner fullscreenElement');
if (count == 2) {
iframeDoc.exitFullscreen();
} else if (count == 4) {
// Done, but set timeout to fail on extra events.
setTimeout(t.step_func_done());
}
});
document.onfullscreenerror = t.unreached_func('fullscreenerror event');
iframeDoc.onfullscreenerror = t.unreached_func('iframe fullscreenerror event');
trusted_request(iframeBody, document.body);
});
</script>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<title>Element#requestFullscreen() followed by moving the element within the document</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<div id="target"></div>
<div id="moveto"></div>
<script>
async_test(t => {
const target = document.getElementById("target");
const moveTo = document.getElementById("moveto");
document.onfullscreenchange = t.step_func_done(() => {
assert_equals(document.fullscreenElement, target);
assert_equals(target.parentNode, moveTo);
});
document.onfullscreenerror = t.unreached_func("fullscreenchange event");
trusted_click(t.step_func(() => {
target.requestFullscreen();
moveTo.appendChild(target);
}), document.body);
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<title>Element#requestFullscreen() followed by moving the element into an iframe</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<div id="target"></div>
<iframe allowfullscreen></iframe>
<script>
async_test(t => {
const target = document.getElementById("target");
const iframeDoc = document.querySelector("iframe").contentDocument;
iframeDoc.onfullscreenchange = t.unreached_func("fullscreenchange event in iframe");
iframeDoc.onfullscreenerror = t.unreached_func("fullscreenerror event in iframe");
document.onfullscreenchange = t.unreached_func("fullscreenchange event");
document.onfullscreenerror = t.step_func_done(() => {
assert_equals(document.fullscreenElement, null);
assert_equals(iframeDoc.fullscreenElement, null);
});
trusted_click(t.step_func(() => {
target.requestFullscreen();
iframeDoc.body.appendChild(target);
}), document.body);
});
</script>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<title>Element#requestFullscreen() in iframe followed by removing the iframe</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<iframe allowfullscreen></iframe>
<script>
async_test(t => {
const iframe = document.querySelector("iframe");
const iframeDocument = iframe.contentDocument;
document.onfullscreenchange = t.unreached_func("fullscreenchange event");
document.onfullscreenerror = t.unreached_func("fullscreenerror event");
iframeDocument.onfullscreenchange = t.unreached_func("iframe fullscreenchange event");
iframeDocument.onfullscreenerror = t.unreached_func("iframe fullscreenerror event");
trusted_click(t.step_func(() => {
iframeDocument.body.requestFullscreen();
iframe.remove();
// No events will be fired, end test after 100ms.
setTimeout(t.step_func_done(() => {
assert_equals(document.fullscreenElement, null);
assert_equals(iframeDocument.fullscreenElement, null);
}), 100);
}), document.body);
});
</script>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<title>Element#requestFullscreen() followed by removing the element</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<div id="target"></div>
<script>
async_test(t => {
const target = document.getElementById("target");
document.onfullscreenchange = t.unreached_func("fullscreenchange event");
document.onfullscreenerror = t.step_func_done(() => {
assert_equals(document.fullscreenElement, null);
});
trusted_click(t.step_func(() => {
target.requestFullscreen();
target.remove();
}), document.body);
});
</script>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Element.requestFullscreen()</title>
<title>Element#requestFullscreen()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Element.requestFullscreen() for non-top element in fullscreen element stack</title>
<title>Element#requestFullscreen() for non-top element in fullscreen element stack</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<title>Element#requestFullscreen() when not allowed to request fullscreen</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
async_test(t => {
const div = document.querySelector("div");
document.addEventListener("fullscreenerror", t.step_func_done(event => {
assert_equals(event.target, document, "event.target");
assert_false(event.bubbles, "event.bubbles");
assert_false(event.cancelable, "event.cancelable");
}));
div.requestFullscreen();
});
</script>

View file

@ -0,0 +1,30 @@
<!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="../trusted-click.js"></script>
<div id="log"></div>
<div id="target"></div>
<script>
async_test(t => {
var target = document.getElementById("target");
document.onfullscreenchange = t.step_func(() => {
assert_equals(document.fullscreenElement, target);
// The next requestFullscreen() should fire no events due to "If element is
// doc's fullscreen element, terminate these subsubsteps."
document.onfullscreenchange = t.unreached_func("fullscreenchange event");
trusted_click(t.step_func(() => {
target.requestFullscreen();
// Wait until after the next animation frame.
requestAnimationFrame(t.step_func_done());
}), target);
});
document.onfullscreenerror = t.unreached_func("fullscreenerror event");
trusted_request(target);
});
</script>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Element.requestFullscreen() for SVG rect element</title>
<title>Element#requestFullscreen() for SVG rect element</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Element.requestFullscreen() for SVG svg element</title>
<title>Element#requestFullscreen() for SVG svg element</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>

View file

@ -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>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Element.requestFullscreen() for top element in fullscreen element stack</title>
<title>Element#requestFullscreen() for top element in fullscreen element stack</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<title>Element#requestFullscreen() twice</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");
document.onfullscreenchange = t.step_func(() => {
assert_equals(document.fullscreenElement, div);
// Done, but ensure that there's only one fullscreenchange event.
document.onfullscreenchange = t.unreached_func("second fullscreenchange event");
setTimeout(t.step_func_done(), 0);
});
document.onfullscreenerror = t.unreached_func("fullscreenerror event");
trusted_click(t.step_func(() => {
// Request fullscreen twice.
div.requestFullscreen();
assert_equals(document.fullscreenElement, null, "fullscreenElement after first requestFullscreen()");
div.requestFullscreen();
assert_equals(document.fullscreenElement, null, "fullscreenElement after second requestFullscreen()");
}), document.body);
});
</script>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<title>Element#requestFullscreen() on two elements in the same document</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<div id="a"></div>
<div id="b"></div>
<script>
async_test(t => {
// Request fullscreen on both elements, but in reverse tree order.
const a = document.getElementById('a');
const b = document.getElementById('b');
// Expect two fullscreenchange events, with document.fullscreenElement
// changing in the same order as the requests.
const order = [];
document.onfullscreenchange = t.step_func(() => {
assert_in_array(document.fullscreenElement, [a, b]);
order.push(document.fullscreenElement.id);
if (order.length == 2) {
assert_array_equals(order, ['b', 'a'],
'fullscreenElement IDs in fullscreenchange events');
t.done();
}
});
document.onfullscreenerror = t.unreached_func('fullscreenerror event');
trusted_click(t.step_func(() => {
b.requestFullscreen();
a.requestFullscreen();
}), document.body);
});
</script>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<title>Element#requestFullscreen() on two elements in different iframes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<iframe id="a" allowfullscreen></iframe>
<iframe id="b" allowfullscreen></iframe>
<script>
async_test(t => {
// Request fullscreen on the body elements of both iframes, but in reverse
// tree order.
const a = document.getElementById('a');
const b = document.getElementById('b');
// Expect two fullscreenchange events, with document.fullscreenElement
// changing in the same order as the requests. (Events should also fire on the
// iframes' documents, but this is not covered by this test.)
const order = [];
document.onfullscreenchange = t.step_func(() => {
assert_in_array(document.fullscreenElement, [a, b]);
order.push(document.fullscreenElement.id);
if (order.length == 2) {
assert_array_equals(order, ['b', 'a'],
'fullscreenElement IDs in fullscreenchange events');
t.done();
}
});
document.onfullscreenerror = t.unreached_func('fullscreenerror event');
trusted_click(t.step_func(() => {
b.contentDocument.body.requestFullscreen();
a.contentDocument.body.requestFullscreen();
}), document.body);
});
</script>

View file

@ -0,0 +1,38 @@
<!doctype html>
<title>Historical Fullscreen features</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
[
"onwebkitfullscreenchange",
"onwebkitfullscreenerror",
"webkitCurrentFullScreenElement",
"webkitFullscreenElement",
"webkitFullscreenEnabled",
"webkitIsFullScreen",
"webkitRequestFullScreen",
"webkitRequestFullscreen",
"webkitDisplayingFullscreen",
"webkitEnterFullScreen",
"webkitEnterFullscreen",
"webkitExitFullScreen",
"webkitExitFullscreen",
"webkitSupportsFullscreen",
].forEach(function(member) {
["webkit", "moz", "ms"].forEach(function(prefix) {
var alias = member.replace("webkit", prefix);
var clarifyTestName = (alias.indexOf('FullScreen') != -1 ? ' (uppercase S)' : '');
test(function() {
assert_false(alias in document.createElement('video'));
}, '<video> member must not be supported: ' + alias + clarifyTestName);
test(function() {
assert_false(alias in document);
}, 'Document member must not be supported: ' + alias + clarifyTestName);
// Some of the combinations tested here have never been supported, but
// it is convenient to just test all names on both <video> and document.
});
});
</script>