chromium/chrome/test/data/extensions/platform_apps/web_view/geolocation/geolocation_access_iframe.html

<!--
Copyright 2013 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<html>
  <head>
    <script type="text/javascript">
      var onGeolocationSuccess = function(position) {
        console.log('iframe.onGeolocationSuccess');
        window.top['onIframeGeolocationSuccess'](position);
      };
      var onGeolocationFailure = function(err) {
        console.log('iframe.onGeolocationFailure');
        window.top['onIframeGeolocationFailure']();
      };
      var startTest = function() {
        console.log('iframe.startTest');
        // Ask for a cached geolocation, we already should have fetched
        // fresh geolocation for the top level frame (guest). Asking for fresh
        // location from <iframe> again makes Geolocation flaky and sad (b/c of
        // ui_test_utils::OverrideGeolocation()).
        navigator.geolocation.getCurrentPosition(
            onGeolocationSuccess,
            onGeolocationFailure,
            // maximumAge > test timeout.
            {maximumAge: 100000, timeout: 10000});
      };
    </script>
  </head>
  <body bgcolor="red">
    <div>An &lt;iframe&gt; that requests geolocation.</div>
    <script>
      console.log('<iframe> loaded');
      startTest();
    </script>
  </body>
</html>