<html>
<head>
    <style>
        iframe { width: 400px; height: 300px;}
    </style>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script>
      setup({explicit_timeout: true});

      async_test(function(t) {
        window.addEventListener("message", t.step_func_done(function(e) {
            assert_equals(e.data, "BLOCKED", "The message should say 'BLOCKED'.");
          }));
      }, "The sandboxed iframe should post a message saying the top navigation was blocked when no user gesture.");
    </script>
</head>
<body>
    <p>This tests that an iframe in sandbox with 'allow-top-navigation-by-user-activation'
    can navigate the top level page, if it is trigged by a user gesture.</p>
    <p>Click on the button in the iframe and it should navigate the top page.</p>
    <iframe id="i" sandbox="allow-scripts allow-top-navigation-by-user-activation" src="support/iframe-that-performs-top-navigation.html"></iframe>
</body>
</html>
