<!DOCTYPE html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>

promise_test(async t => {
  let sandboxFlags = 'allow-scripts allow-same-origin';
  let w = window.open(`resources/attempt-portal-load.html?pipe=header(Content-Security-Policy,sandbox ${sandboxFlags})`);
  await new Promise((resolve, reject) => w.addEventListener('load', resolve));
  let result = await Promise.race([
      w.portalLoaded.then(() => 'loaded'),
      new Promise(resolve => t.step_timeout(() => resolve('timed out'), 5000))]);
  assert_equals(result, 'timed out', 'expected portal not to load due to sandbox flags');
});
</script>
</body>
