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

Side by Side Diff: chrome/test/data/extensions/api_test/permissions/host_subsets/background.js

Issue 2360073002: [Extensions] Isolate ExtensionFunction results_ and error_ (Closed)
Patch Set: errorwithargs Created 4 years, 2 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var ERROR = 'Optional permissions must be listed in extension manifest.'; 5 var ERROR = 'Optional permissions must be listed in extension manifest.';
6 var test = chrome.test; 6 var test = chrome.test;
7 7
8 // The URL patterns that we've supposedly been granted access to so far. Use 8 // The URL patterns that we've supposedly been granted access to so far. Use
9 // this to verify queried hosts for each test. 9 // this to verify queried hosts for each test.
10 var grantedHosts = []; 10 var grantedHosts = [];
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 chrome.permissions.request({origins: [host]}, 58 chrome.permissions.request({origins: [host]},
59 test.callback(function(granted) { 59 test.callback(function(granted) {
60 if (granted) 60 if (granted)
61 pushUniqueValue(grantedHosts, host); 61 pushUniqueValue(grantedHosts, host);
62 if (expectedGranted) { 62 if (expectedGranted) {
63 test.assertTrue( 63 test.assertTrue(
64 granted, 64 granted,
65 "Access to " + host + " was not granted, but should have been"); 65 "Access to " + host + " was not granted, but should have been");
66 } else { 66 } else {
67 test.assertFalse( 67 test.assertFalse(
68 granted, 68 !!granted,
69 "Access to " + host + " was granted, but should not have been"); 69 "Access to " + host + " was granted, but should not have been");
70 } 70 }
71 checkGrantedHosts(callback); 71 checkGrantedHosts(callback);
72 }, expectedError)); 72 }, expectedError));
73 }; 73 };
74 } 74 }
75 75
76 // Returns a function which removes access to a host, and afterwards checks 76 // Returns a function which removes access to a host, and afterwards checks
77 // that our expected host permissions agree with Chrome's. 77 // that our expected host permissions agree with Chrome's.
78 function removeHost(host, expectedRemoved) { 78 function removeHost(host, expectedRemoved) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 requestHost('ftp://ftp.example.com/*', true), 184 requestHost('ftp://ftp.example.com/*', true),
185 contains('ftp://ftp.example.com/*', true), 185 contains('ftp://ftp.example.com/*', true),
186 removeHost('ftp://ftp.example.com/*', true), 186 removeHost('ftp://ftp.example.com/*', true),
187 contains('ftp://ftp.example.com/*', false), 187 contains('ftp://ftp.example.com/*', false),
188 188
189 // And finally... 189 // And finally...
190 test.succeed]); 190 test.succeed]);
191 } 191 }
192 192
193 test.runTests([main]); 193 test.runTests([main]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698