chromium/chrome/test/data/extensions/platform_apps/web_view/geolocation/geolocation_request_gone/guest.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">
      // The window reference of the embedder to send post message reply.
      var embedderWindowChannel = null;

      var g_testName = 'uninitialized';

      var notifyEmbedder = function(msg_array) {
        embedderWindowChannel.postMessage(JSON.stringify(msg_array), '*');
      };

      var onGeolocationSuccess = function(position) {
        var responseArray = [g_testName, 'access-granted'];
        notifyEmbedder(responseArray);
      };

      var onGeolocationFailure = function(error) {
        var responseArray = [g_testName, 'access-denied'];
        notifyEmbedder(responseArray);
      };

      var requestGeolocation = function() {
        navigator.geolocation.getCurrentPosition(onGeolocationSuccess,
                                                 onGeolocationFailure);
      };

      var onPostMessageReceived = function(e) {
        embedderWindowChannel = e.source;
        var data = JSON.parse(e.data);
        console.log('request: ' + data[0]);
        if (data[0] == 'request-geolocation') {
          window.console.log('guest: request-geolocation');
          g_testName = data[1];
          requestGeolocation();
        }
      };
      window.addEventListener('message', onPostMessageReceived, false);
    </script>
  </head>
  <body>
    <div>
      This is a guest that makes a geolocation request.
    </div>
    <script>
      console.log('Guest loaded');
    </script>
  </body>
</html>