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

Side by Side Diff: chrome/test/data/extensions/api_test/stubs/content_script.js

Issue 7029031: Content settings extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync & review Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/extensions/api_test/content_settings/standard/test.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 // Helper function to log message to both the local console and to the 2 // Helper function to log message to both the local console and to the
3 // background page, so that the latter can output the message via the 3 // background page, so that the latter can output the message via the
4 // chrome.test.log() function. 4 // chrome.test.log() function.
5 function logToConsoleAndStdout(msg) { 5 function logToConsoleAndStdout(msg) {
6 console.log(msg); 6 console.log(msg);
7 chrome.extension.sendRequest("log: " + msg); 7 chrome.extension.sendRequest("log: " + msg);
8 } 8 }
9 9
10 // We ask the background page to get the extension API to test against. When it 10 // We ask the background page to get the extension API to test against. When it
11 // responds we start the test. 11 // responds we start the test.
12 console.log("asking for api ..."); 12 console.log("asking for api ...");
13 chrome.extension.sendRequest("getApi", function(apis) { 13 chrome.extension.sendRequest("getApi", function(apis) {
14 console.log("got api response"); 14 console.log("got api response");
15 var privilegedPaths = []; 15 var privilegedPaths = [];
16 var unprivilegedPaths = []; 16 var unprivilegedPaths = [];
17 apis.forEach(function(module) { 17 apis.forEach(function(module) {
18 var namespace = module.namespace; 18 var namespace = module.namespace;
19 if (!module.unprivileged) { 19 if (!module.unprivileged) {
20 privilegedPaths.push(namespace); 20 privilegedPaths.push(namespace);
21 return; 21 return;
22 } 22 }
23 23
24 ["functions", "events"].forEach(function(section) { 24 ["functions", "events"].forEach(function(section) {
25 if (typeof(module[section]) == "undefined") 25 if (typeof(module[section]) == "undefined")
26 return; 26 return;
27 module[section].forEach(function(entry) { 27 module[section].forEach(function(entry) {
28 var path = namespace + "." + entry.name; 28 var path = namespace + "." + entry.name;
29 if (entry.unprivileged) { 29 if (entry.unprivileged) {
30 unprivilegedPaths.push(path); 30 unprivilegedPaths.push(path);
31 } else { 31 } else {
32 privilegedPaths.push(path); 32 privilegedPaths.push(path);
33 } 33 }
34 }); 34 });
35 }); 35 });
36 36
37 if (module.properties) { 37 if (module.properties) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (success) { 153 if (success) {
154 reportSuccess(); 154 reportSuccess();
155 } else { 155 } else {
156 logToConsoleAndStdout("failures on:\n" + failures.join("\n") + 156 logToConsoleAndStdout("failures on:\n" + failures.join("\n") +
157 "\n\n\n>>> See comment in stubs_apitest.cc for a " + 157 "\n\n\n>>> See comment in stubs_apitest.cc for a " +
158 "hint about fixing this failure.\n\n"); 158 "hint about fixing this failure.\n\n");
159 reportFailure(); 159 reportFailure();
160 } 160 }
161 } 161 }
162 162
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/content_settings/standard/test.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698