text: description("Tests that when Geolocation permission has been denied prior to a call to a Geolocation method, the error callback is invoked with code PERMISSION_DENIED, when the Geolocation service has a good position.");
  
  if (!window.testRunner || !window.internals)
      debug('This test can not run without testRunner or internals');
  
  internals.setGeolocationClientMock(document);
  
  // Prime the Geolocation instance by denying permission.
  internals.setGeolocationPermission(document, false);
  internals.setGeolocationPosition(document, 51.478, -0.166, 100);
  
  var error;
  navigator.geolocation.getCurrentPosition(function(p) {
      testFailed('Success callback invoked unexpectedly');
      finishJSTest();
  }, function(e) {
      error = e;
      shouldBe('error.code', 'error.PERMISSION_DENIED');
      shouldBe('error.message', '"User denied Geolocation"');
      debug('');
      continueTest();
  });
  
  function continueTest()
  {
      // Make another request, with permission already denied.
      navigator.geolocation.getCurrentPosition(function(p) {
          testFailed('Success callback invoked unexpectedly');
          finishJSTest();
      }, function(e) {
          error = e;
          shouldBe('error.code', 'error.PERMISSION_DENIED');
          shouldBe('error.message', '"User denied Geolocation"');
          finishJSTest();
      });
  }
  
  window.jsTestIsAsync = true;
  