Home | History | Annotate | Download | only in script-tests
      1 description("Tests Geolocation error callback using the mock service.");
      2 
      3 var mockCode = 2;
      4 var mockMessage = "debug";
      5 
      6 if (window.layoutTestController) {
      7     layoutTestController.setGeolocationPermission(true);
      8     layoutTestController.setMockGeolocationError(mockCode, mockMessage);
      9 } else
     10     debug('This test can not be run without the LayoutTestController');
     11 
     12 var error;
     13 navigator.geolocation.getCurrentPosition(function(p) {
     14     testFailed('Success callback invoked unexpectedly');
     15     finishJSTest();
     16 }, function(e) {
     17     error = e;
     18     shouldBe('error.code', 'mockCode');
     19     shouldBe('error.message', 'mockMessage');
     20     shouldBe('error.UNKNOWN_ERROR', 'undefined');
     21     shouldBe('error.PERMISSION_DENIED', '1');
     22     shouldBe('error.POSITION_UNAVAILABLE', '2');
     23     shouldBe('error.TIMEOUT', '3');
     24     finishJSTest();
     25 });
     26 
     27 window.jsTestIsAsync = true;
     28 window.successfullyParsed = true;
     29