Bug 1526700 [wpt PR 15267] - Add screen orientation test: fire event before promise is resolved, a=testonly
authorJohanna <Johanna-hub@users.noreply.github.com>
Tue, 19 Feb 2019 14:39:38 +0000
changeset 519252 5aad8dd39c85abafba35a7b71514efb2a9ad1ada
parent 519251 8196d285222a5994380b23d9887dca0d38c2efd1
child 519253 ad47847d2f63a779b2c9df0648df729cf13dcf57
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1526700, 15267
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1526700 [wpt PR 15267] - Add screen orientation test: fire event before promise is resolved, a=testonly Automatic update from web-platform-tests Add screen orientation test: fire event before promise is resolved (#15267) -- wpt-commits: 8ed64687560332642c7b34ebd16011ae5b01d99a wpt-pr: 15267
testing/web-platform/tests/screen-orientation/event-before-promise.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/screen-orientation/event-before-promise.html
@@ -0,0 +1,23 @@
+<!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>
+  promise_test(async t => {
+    await test_driver.bless("request full screen", () => {
+      return document.documentElement.requestFullscreen();
+    });
+
+    const promiseToChange = new Promise(resolve => {
+      screen.orientation.addEventListener("change", resolve);
+    });
+
+    const result = await Promise.race([
+      screen.orientation.lock("landscape"),
+      promiseToChange
+    ]);
+
+    assert_true(result instanceof Event, "Expected an instance of Event");
+  }, "The 'change' event must fire before the [[orientationPendingPromise]] is resolved.");
+</script>