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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/permissions/resources/test-query.js

Issue 2458453002: [sensors] Add Permission guard to the generic sensor apis.
Patch Set: Fix mikhail's comments Created 4 years, 1 month 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
1 if (self.importScripts) { 1 if (self.importScripts) {
2 importScripts('helpers.js'); 2 importScripts('helpers.js');
3 3
4 if (get_current_scope() == 'ServiceWorker') 4 if (get_current_scope() == 'ServiceWorker')
5 importScripts('../../serviceworker/resources/worker-testharness.js'); 5 importScripts('../../serviceworker/resources/worker-testharness.js');
6 else 6 else
7 importScripts('../../resources/testharness.js'); 7 importScripts('../../resources/testharness.js');
8 } 8 }
9 9
10 async_test(function(test) { 10 async_test(function(test) {
(...skipping 17 matching lines...) Expand all
28 navigator.permissions.query({name:'geolocation'}).then(function(result) { 28 navigator.permissions.query({name:'geolocation'}).then(function(result) {
29 assert_true(result instanceof PermissionStatus); 29 assert_true(result instanceof PermissionStatus);
30 assert_equals(result.state, 'denied'); 30 assert_equals(result.state, 'denied');
31 test.done(); 31 test.done();
32 }).catch(function() { 32 }).catch(function() {
33 assert_unreached('querying geolocation permission should not fail.') 33 assert_unreached('querying geolocation permission should not fail.')
34 }); 34 });
35 }, 'Test geolocation permission in ' + get_current_scope() + ' scope.'); 35 }, 'Test geolocation permission in ' + get_current_scope() + ' scope.');
36 36
37 async_test(function(test) { 37 async_test(function(test) {
38 navigator.permissions.query({name:'sensors'}).then(function(result) {
39 assert_true(result instanceof PermissionStatus);
40 assert_equals(result.state, 'denied');
41 test.done();
42 }).catch(function() {
43 assert_unreached('querying sensors permission should not fail.')
44 });
45 }, 'Test sensors permission in ' + get_current_scope() + ' scope.');
46
47 async_test(function(test) {
38 navigator.permissions.query({name:'midi'}).then(function(result) { 48 navigator.permissions.query({name:'midi'}).then(function(result) {
39 assert_true(result instanceof PermissionStatus); 49 assert_true(result instanceof PermissionStatus);
40 assert_equals(result.state, 'denied'); 50 assert_equals(result.state, 'denied');
41 51
42 // Test for sysex=false. 52 // Test for sysex=false.
43 return navigator.permissions.query({name:'midi', sysex: false}); 53 return navigator.permissions.query({name:'midi', sysex: false});
44 }).then(function(result) { 54 }).then(function(result) {
45 assert_true(result instanceof PermissionStatus); 55 assert_true(result instanceof PermissionStatus);
46 assert_equals(result.state, 'denied'); 56 assert_equals(result.state, 'denied');
47 57
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 }).then(function(result) { 94 }).then(function(result) {
85 assert_true(result instanceof PermissionStatus); 95 assert_true(result instanceof PermissionStatus);
86 assert_equals(result.state, 'denied'); 96 assert_equals(result.state, 'denied');
87 test.done(); 97 test.done();
88 }).catch(function() { 98 }).catch(function() {
89 assert_unreached('querying push permission should not fail.') 99 assert_unreached('querying push permission should not fail.')
90 }); 100 });
91 }, 'Test push permission in ' + get_current_scope() + ' scope.'); 101 }, 'Test push permission in ' + get_current_scope() + ' scope.');
92 102
93 done(); 103 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698