https://github.com/web-platform-tests/wpt
Raw File
Tip revision: a619744eead89c5105c98040bf77f11c40eaa311 authored by Geoffrey Sneddon on 09 October 2018, 17:34:30 UTC
Only run Windows CI for tools/ changes
Tip revision: a619744
onchange-event-subframe.html
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<iframe id="testIframe" sandbox="allow-scripts allow-same-origin"
  style="display:none" src="resources/iframe-listen-orientation-change.html">
</iframe>

<script>
promise_test(async t => {
  let orientations = [
    'portrait-primary',
    'portrait-secondary',
    'landscape-primary',
    'landscape-secondary'
  ];
  if (screen.orientation.type.includes('portrait')) {
    orientations = orientations.reverse();
  }
  const messageWatcher = new EventWatcher(t, window, "message");

  for (const orientation of orientations) {
    await screen.orientation.lock(orientation);
    const message = await messageWatcher.wait_for("message");
    assert_equals(message.data, orientation, "subframe receives orientation change event");
  }
  screen.orientation.unlock();
}, "Test subframes receive orientation change events");
</script>
back to top