blob: ed31f26d9037add1068749927987687bb5230ad2 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/mojo-helpers.js"></script>
<script src="resources/geolocation-mock.js"></script>
</head>
<body>
<script>
description("Tests that navigator.geolocation.watchPosition returns unique results within its script execution context.");
if (!window.testRunner || !window.mojo)
debug('This test can not run without testRunner or mojo');
var watchID1;
var watchID2;
var watchID3;
geolocationServiceMock.then(mock => {
mock.setGeolocationPosition(51.478, -0.166, 100.0);
watchID1 = navigator.geolocation.watchPosition(function() { });
watchID2 = navigator.geolocation.watchPosition(function() { });
watchID3 = navigator.geolocation.watchPosition(function() { });
shouldBeTrue("watchID1 > 0");
shouldBeTrue("watchID2 > 0");
shouldBeTrue("watchID3 > 0");
shouldBeTrue("watchID1 !== watchID2");
shouldBeTrue("watchID1 !== watchID3");
shouldBeTrue("watchID2 !== watchID3");
finishJSTest();
});
window.jsTestIsAsync = true;
</script>
</body>
</html>