blob: 56eca0763dbf9073baacafd482561d343ee6603e [file] [log] [blame]
[email protected]df7846b2009-09-09 16:27:321<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2<html>
3<head>
tkentc5e88f02017-02-06 22:47:314<script src="../resources/js-test.js"></script>
Reilly Grantbe310ab2017-07-11 01:51:265<script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
6<script src="file:///gen/device/geolocation/public/interfaces/geolocation.mojom.js"></script>
Julie Jeongeun Kim162c2d282019-03-13 07:23:527<script src="file:///gen/third_party/blink/public/mojom/geolocation/geolocation_service.mojom.js"></script>
8<script src="file:///gen/third_party/blink/public/mojom/permissions/permission.mojom.js"></script>
sammce6687802016-05-13 04:06:579<script src="resources/geolocation-mock.js"></script>
[email protected]df7846b2009-09-09 16:27:3210</head>
11<body>
tkent98122ee2017-02-02 07:38:5112<script>
13description("Tests that when an exception is thrown in the success callback, the error callback is not invoked. Note that this test throws an exception which is not caught.");
14
15var mockLatitude = 51.478;
16var mockLongitude = -0.166;
17var mockAccuracy = 100;
18
19var position;
20
Reilly Grantbe310ab2017-07-11 01:51:2621let mock = geolocationMock;
22mock.setGeolocationPermission(true);
23mock.setGeolocationPosition(mockLatitude,
24 mockLongitude,
25 mockAccuracy);
26navigator.geolocation.getCurrentPosition(function(p) {
27 position = p;
28 shouldBe('position.coords.latitude', 'mockLatitude');
29 shouldBe('position.coords.longitude', 'mockLongitude');
30 shouldBe('position.coords.accuracy', 'mockAccuracy');
tkent98122ee2017-02-02 07:38:5131
Reilly Grantbe310ab2017-07-11 01:51:2632 // Yield to allow for the error callback to be invoked. The timer
33 // must be started before the exception is thrown.
34 window.setTimeout(assertWeGotException, 0);
35 expectError();
tkent98122ee2017-02-02 07:38:5136
Reilly Grantbe310ab2017-07-11 01:51:2637 throw new Error('Exception in success callback');
38}, function(e) {
39 testFailed('Error callback invoked unexpectedly');
40 finishJSTest();
Maxim Kolosovskiy2291dbc2017-12-08 10:48:5441});
tkent98122ee2017-02-02 07:38:5142
43function assertWeGotException()
44{
45 shouldHaveHadError();
46 finishJSTest();
47}
48
49window.jsTestIsAsync = true;
50</script>
[email protected]df7846b2009-09-09 16:27:3251</body>
52</html>