chromium/third_party/blink/web_tests/http/tests/navigation/resources/frame-with-anchor.html

<!DOCTYPE html>
<html>
<head>
  <script src="../../../js-test-resources/js-test.js"></script>
  <script>
    function runTest() {
      description('Tests that loading a frame with a URL that contains a fragment pointed at a named anchor actually scrolls to that anchor.');

      // Check scroll position in a timeout to make sure that the anchor has
      // been scrolled to.
      setTimeout(function() {
          // Make sure that the body is taller than the viewport (i.e. scrolling is
          // required).
          shouldBeTrue('document.documentElement.offsetHeight > document.documentElement.clientHeight');
          
          // We should be scrolled at least a little bit
          shouldBeTrue('document.scrollingElement.scrollTop > 0');
          
          // And the bottom of the viewable area should be at least 2000 pixels from the top, due to the spacer element above.
          shouldBeTrue('document.scrollingElement.scrollTop + document.body.clientHeight > 2000');
          
          finishJSTest();          
      }, 0);
    }
    
    var jsTestIsAsync = true;
  </script>  
</head>
<body onload="runTest()">
<p id="description"></p>
<div id="console"></div>

<div style="height: 2000px">
  <!-- Spacer to make sure that the named anchor below requires scrolling -->
</div>

<a name="anchor1">This is an anchor point named "anchor1</a>.
</body>
</html>