Skip to content
Permalink
Browse files
CB-10285 Added tests for PositionError constants
github close #64
  • Loading branch information
alsorokin authored and sgrebnov committed Jan 4, 2016
1 parent 49825f1 commit a754436ee0f051fb2a684f4a59d361647849dd07
Showing 1 changed file with 47 additions and 0 deletions.
@@ -104,6 +104,27 @@ exports.defineAutoTests = function () {
});
});

it("geolocation.spec.9 on failure should return PositionError object with error code constants", function (done) {
// On Windows, this test prompts user for permission to use geolocation and interrupts autotests running.
if (isWindowsStore) {
pending();
}

navigator.geolocation.getCurrentPosition(
fail.bind(this, done),
function(gpsError) {
// W3C specs: http://dev.w3.org/geo/api/spec-source.html#position_error_interface
expect(gpsError.PERMISSION_DENIED).toBe(1);
expect(gpsError.POSITION_UNAVAILABLE).toBe(2);
expect(gpsError.TIMEOUT).toBe(3);
done();
},
{
maximumAge: 0,
timeout: 0
});
});

});

describe('success callback', function () {
@@ -174,6 +195,32 @@ exports.defineAutoTests = function () {
});
});

it("geolocation.spec.10 on failure should return PositionError object with error code constants", function (done) {
// On Windows, this test prompts user for permission to use geolocation and interrupts autotests running.
if (isWindowsStore) {
pending();
}

var context = this;
errorWatch = navigator.geolocation.watchPosition(
fail.bind(this, done, context, 'Unexpected win'),
function(gpsError) {
if (context.done) return;
context.done = true;

// W3C specs: http://dev.w3.org/geo/api/spec-source.html#position_error_interface
expect(gpsError.PERMISSION_DENIED).toBe(1);
expect(gpsError.POSITION_UNAVAILABLE).toBe(2);
expect(gpsError.TIMEOUT).toBe(3);

done();
},
{
maximumAge: 0,
timeout: 0
});
});

});

describe('success callback', function () {

0 comments on commit a754436

Please sign in to comment.