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

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

Issue 1057283002: Permissions: use newly supported required attribute on Dictionary properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | Source/modules/permissions/PermissionDescriptor.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
11 // Querying a random permission name should fail.
12 navigator.permissions.query({name:'foobar'}).then(function(result) {
13 assert_unreached('querying a random permission should fail');
14 }, function(error) {
15 assert_equals(error.name, 'TypeError');
16
17 // Querying a permission without a name should fail.
18 return navigator.permissions.query({});
19 }).then(function(result) {
20 assert_unreached('querying a permission without a name should fail');
21 }, function(error) {
22 assert_equals(error.name, 'TypeError');
23 test.done();
24 });
25 }, 'Test PermissionDescription WebIDL rules in ' + get_current_scope() + ' scope .');
26
27 async_test(function(test) {
11 navigator.permissions.query({name:'geolocation'}).then(function(result) { 28 navigator.permissions.query({name:'geolocation'}).then(function(result) {
12 // TODO(mlamouri): test values when some instrumentation are available. 29 // TODO(mlamouri): test values when some instrumentation are available.
13 assert_true(result instanceof PermissionStatus); 30 assert_true(result instanceof PermissionStatus);
14 test.done(); 31 test.done();
15 }).catch(function() { 32 }).catch(function() {
16 assert_unreached('querying geolocation permission should not fail.') 33 assert_unreached('querying geolocation permission should not fail.')
17 }); 34 });
18 }, 'Test geolocation permission in ' + get_current_scope() + ' scope.'); 35 }, 'Test geolocation permission in ' + get_current_scope() + ' scope.');
19 36
20 async_test(function(test) { 37 async_test(function(test) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 }).then(function(result) { 86 }).then(function(result) {
70 // TODO(mlamouri): test values when some instrumentation are available. 87 // TODO(mlamouri): test values when some instrumentation are available.
71 assert_true(result instanceof PermissionStatus); 88 assert_true(result instanceof PermissionStatus);
72 test.done(); 89 test.done();
73 }).catch(function() { 90 }).catch(function() {
74 assert_unreached('querying push permission should not fail.') 91 assert_unreached('querying push permission should not fail.')
75 }); 92 });
76 }, 'Test push permission in ' + get_current_scope() + ' scope.'); 93 }, 'Test push permission in ' + get_current_scope() + ' scope.');
77 94
78 done(); 95 done();
OLDNEW
« no previous file with comments | « no previous file | Source/modules/permissions/PermissionDescriptor.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698