https://github.com/web-platform-tests/wpt
Raw File
Tip revision: b7b803ba171367071f288c5ab8a3fa09c62339bd authored by Hiroshige Hayashizaki on 25 December 2018, 02:04:03 UTC
[wpt/referrer-policy] Fix same-origin-downgrade in spec.src.json
Tip revision: b7b803b
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