Update web-platform-tests to revision 2d68590d46a990bf28a08d6384a59962d2e56bf6

This commit is contained in:
WPT Sync Bot 2019-03-14 21:30:32 -04:00
parent bc03d32142
commit ad4cc3691e
135 changed files with 1613 additions and 341 deletions

View file

@ -1,4 +1,3 @@
spec: https://w3c.github.io/screen-orientation/
suggested_reviewers:
- haoxli
- marcoscaceres

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<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>
<script>
import { getOppositeOrientation } from "/screen-orientation/resources/orientation-utils.js";
promise_test(async t => {
await test_driver.bless("request full screen", () => {
return document.documentElement.requestFullscreen();
});
const newOrientation = getOppositeOrientation();
// This will reject, because the event will call lock() again.
const pMustReject = screen.orientation.lock(newOrientation);
// This one resolves, because we are re-locking.
const pMustResolve = new Promise(r => {
screen.orientation.onchange = () => {
r(orientation.lock("any"));
};
});
await promise_rejects(t, new TypeError(), pMustReject);
await pMustResolve;
screen.orientation.unlock();
return document.exitFullscreen();
}, "Re-locking orientation during event dispatch must reject existing orientationPendingPromise");
</script>

View file

@ -0,0 +1,17 @@
export async function loadIframe(src = "/screen-orientation/resources/blank.html") {
const iframe = document.createElement("iframe");
iframe.src = src;
document.body.appendChild(iframe);
return new Promise(r => {
if (iframe.contentDocument.readyState === "complete") {
return r(iframe);
}
iframe.onload = () => r(iframe);
});
}
export function getOppositeOrientation() {
const { type: currentOrientation } = screen.orientation;
const isPortrait = currentOrientation.includes("portrait");
return (newOrientation = `${isPortrait ? "landscape" : "portrait"}`);
}