<!DOCTYPE html><!-- webkit-test-runner [ TabsToLinks=true SpatialNavigationEnabled=true ] -->
<html>
  <!--
    This test ensures the basic traversal correctness of Spatial Navigation
    algorithm: iframes without any focusable content should be ignored.

    * Pre-conditions:
    1) DRT support for SNav enable/disable.

    * Navigation steps:
    1) Loads this page, focus goes to "start" automatically.
    2) Focus moves from "start" to "end" bypassing the two iframes
       in between them, once both have no focusable elements inside.
  -->
  <head>
    <script src="../../resources/js-test-pre.js"></script>
    <script src="resources/spatial-navigation-utils.js"></script>
    <script type="application/javascript">

    var resultMap = [
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "start"],
      ["DONE", "DONE"]
    ];

    if (window.testRunner) {
      testRunner.dumpAsText();
      testRunner.waitUntilDone();
    }

    function runTest()
    {
      // starting the test itself: get to a known place.
      document.getElementById("start").focus();

      initTest(resultMap, testCompleted);
    }

    function testCompleted()
    {
      if (window.testRunner)
        testRunner.notifyDone();
    }

    window.onload = runTest;
    </script>
    <script src="../resources/js-test-post.js"></script>
  </head>
  <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
    <div><a id="start" href="a">a</a></div>

    <iframe width="80" height="80" scrolling="auto" src="data:text/html,
      <body>
        <img width=120 height=200 src='resources/green.png'>
      </body>
    "></iframe><br>

    <iframe scrolling="auto" src="data:text/html,
      <body>
        <img width=120 height=200 src='resources/green.png'>
      </body>
    "></iframe><br>

    <a id="end" href="a">e</a>
    <div id="console"></div>
    This is to test that an iframe with no focusable content still scrolls
  </body>
</html>
