Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/permission-denied-stops-watches.js

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 description("Tests that when Geolocation permission is denied, watches are stopp ed, as well as one-shots.");
2
3 var error;
4
5 geolocationServiceMock.then(mock => {
6
7 // Configure the mock Geolocation service to report a position to cause perm ission
8 // to be requested, then deny it.
9 mock.setGeolocationPermission(false);
10 mock.setGeolocationPosition(51.478, -0.166, 100.0);
11
12 var errorCallbackInvoked = false;
13 navigator.geolocation.watchPosition(function(p) {
14 testFailed('Success callback invoked unexpectedly');
15 finishJSTest();
16 }, function(e) {
17 if (errorCallbackInvoked) {
18 testFailed('Error callback invoked unexpectedly : ' + error.message) ;
19 finishJSTest();
20 }
21 errorCallbackInvoked = true;
22
23 error = e;
24 shouldBe('error.code', 'error.PERMISSION_DENIED');
25 shouldBe('error.message', '"User denied Geolocation"');
26
27 // Update the mock Geolocation service to report a new position, then
28 // yield to allow a chance for the success callback to be invoked.
29 mock.setGeolocationPosition(55.478, -0.166, 100);
30 window.setTimeout(finishJSTest, 0);
31 });
32 });
33
34 window.jsTestIsAsync = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698