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

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

Issue 1726323002: Have Permission{Manager,Service} use Origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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
OLDNEW
1 if (self.importScripts) { 1 if (self.importScripts) {
2 importScripts('../../resources/helpers.js'); 2 importScripts('../../resources/helpers.js');
3 importScripts('testrunner-helpers.js'); 3 importScripts('testrunner-helpers.js');
4 4
5 if (get_current_scope() == 'ServiceWorker') 5 if (get_current_scope() == 'ServiceWorker')
6 importScripts('../../../serviceworker/resources/worker-testharness.js'); 6 importScripts('../../../serviceworker/resources/worker-testharness.js');
7 else 7 else
8 importScripts('../../../resources/testharness.js'); 8 importScripts('../../../resources/testharness.js');
9 } 9 }
10 10
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 }, 33 },
34 { 34 {
35 // request() is expected to show a UI then return the new permission status. 35 // request() is expected to show a UI then return the new permission status.
36 // In layout tests no UI is shown so it boils down to returning the permissi on 36 // In layout tests no UI is shown so it boils down to returning the permissi on
37 // status. The tests only check that behaviour given that trying to simulate 37 // status. The tests only check that behaviour given that trying to simulate
38 // user decision would simply test the test infrastructure. 38 // user decision would simply test the test infrastructure.
39 test: async_test('Test basic request behaviour in ' + get_current_scope() + ' scope.'), 39 test: async_test('Test basic request behaviour in ' + get_current_scope() + ' scope.'),
40 fn: function(callback) { 40 fn: function(callback) {
41 navigator.permissions.request({name:'geolocation'}).then(function(result) { 41 navigator.permissions.request({name:'geolocation'}).then(function(result) {
42 console.trace("Origin in test-request.js is: '" + location.origin + "'");
43 console.debug("Origin in test-request.js is: '" + location.origin + "'");
42 assert_true(result instanceof PermissionStatus); 44 assert_true(result instanceof PermissionStatus);
43 assert_equals(result.state, 'denied'); 45 assert_equals(result.state, 'denied');
44 return setPermission('geolocation', 'granted', location.origin, locati on.origin); 46 return setPermission('geolocation', 'granted', location.origin, locati on.origin);
45 }).then(function() { 47 }).then(function() {
48 console.trace("Origin in test-request.js is: '" + location.origin + "'");
49 console.debug("Origin in test-request.js is: '" + location.origin + "'");
46 return navigator.permissions.request({name:'geolocation'}); 50 return navigator.permissions.request({name:'geolocation'});
47 }).then(function(result) { 51 }).then(function(result) {
52 console.trace("Origin in test-request.js is: '" + location.origin + "'");
53 console.debug("Origin in test-request.js is: '" + location.origin + "'");
48 assert_true(result instanceof PermissionStatus); 54 assert_true(result instanceof PermissionStatus);
49 assert_equals(result.state, 'granted'); 55 assert_equals(result.state, 'granted');
50 navigator.permissions.revoke({name:'geolocation'}).then(callback); 56 navigator.permissions.revoke({name:'geolocation'}).then(callback);
51 }).catch(function(error) { 57 }).catch(function(error) {
58 console.trace("Origin in test-request.js is: '" + location.origin + "'");
59 console.debug("Origin in test-request.js is: '" + location.origin + "'");
52 assert_unreached(error); 60 assert_unreached(error);
53 callback(); 61 callback();
54 }); 62 });
55 } 63 }
56 }]; 64 }];
57 65
58 function runTest(i) { 66 function runTest(i) {
59 tests[i].test.step(function() { 67 tests[i].test.step(function() {
60 tests[i].fn(function() { 68 tests[i].fn(function() {
61 tests[i].test.done(); 69 tests[i].test.done();
62 if (i + 1 < tests.length) { 70 if (i + 1 < tests.length) {
63 runTest(i + 1); 71 runTest(i + 1);
64 } else { 72 } else {
65 done(); 73 done();
66 } 74 }
67 }); 75 });
68 }); 76 });
69 } 77 }
70 runTest(0); 78 runTest(0);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698