<!DOCTYPE html>
<title>Test that documentPictureInPicture.requestWindow()
  rejects from a PiP window</title>
<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>
<body>
<script>
promise_test(async (t) => {
  await test_driver.bless('request PiP window from top window');
  const pipWindow = await documentPictureInPicture.requestWindow();

  await test_driver.bless('request PiP window from PiP window', pipWindow);
  await promise_rejects_dom(t, 'NotAllowedError', pipWindow.DOMException,
      pipWindow.documentPictureInPicture.requestWindow());
});
</script>
</body>
