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

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

Issue 1906593002: [Extensions] Finish freezing schema (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 apiFeatures = chrome.test.getApiFeatures(); 5 var apiFeatures = chrome.test.getApiFeatures();
6 6
7 // Returns a list of all chrome.foo.bar API paths available to an app. 7 // Returns a list of all chrome.foo.bar API paths available to an app.
8 function getApiPaths() { 8 function getApiPaths() {
9 var apiPaths = []; 9 var apiPaths = [];
10 var apiDefinitions = chrome.test.getApiDefinitions(); 10 var apiDefinitions = chrome.test.getApiDefinitions();
11 apiDefinitions.forEach(function(module) { 11 apiDefinitions.forEach(function(module) {
12 var namespace = module.namespace; 12 var namespace = module.namespace;
13 var apiFeature = apiFeatures[namespace]; 13 var apiFeature = apiFeatures[namespace];
14 if (Array.isArray(apiFeature)) 14 if (Array.isArray(apiFeature))
15 apiFeature = apiFeatures[namespace][0]; 15 apiFeature = apiFeatures[namespace][0];
16 16
17 // Skip internal APIs. 17 // Skip internal APIs.
18 if (apiFeature.internal) 18 if (apiFeature.internal)
19 return; 19 return;
20 20
21 // Get the API functions and events. 21 // Get the API functions and events.
22 [module.functions, module.events].forEach(function(section) { 22 [module.functions, module.events].forEach(function(section) {
23 if (typeof(section) == "undefined") 23 if (typeof(section) == "undefined")
24 return; 24 return;
25 section.forEach(function(entry) { 25 // Pieces of the module don't inherit from Array/Object.
26 Array.prototype.forEach.call(section, function(entry) {
26 apiPaths.push(namespace + "." + entry.name); 27 apiPaths.push(namespace + "." + entry.name);
27 }); 28 });
28 }); 29 });
29 30
30 // Get the API properties. 31 // Get the API properties.
31 if (module.properties) { 32 if (module.properties) {
32 Object.getOwnPropertyNames(module.properties).forEach(function(propName) { 33 Object.getOwnPropertyNames(module.properties).forEach(function(propName) {
33 apiPaths.push(namespace + "." + propName); 34 apiPaths.push(namespace + "." + propName);
34 }); 35 });
35 } 36 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 console.log("failures on:\n" + failures.join("\n") + 74 console.log("failures on:\n" + failures.join("\n") +
74 "\n\n\n>>> See comment in stubs_apitest.cc for a " + 75 "\n\n\n>>> See comment in stubs_apitest.cc for a " +
75 "hint about fixing this failure.\n\n"); 76 "hint about fixing this failure.\n\n");
76 chrome.test.notifyFail("failed"); 77 chrome.test.notifyFail("failed");
77 } 78 }
78 } 79 }
79 80
80 chrome.app.runtime.onLaunched.addListener(function() { 81 chrome.app.runtime.onLaunched.addListener(function() {
81 doTest(); 82 doTest();
82 }); 83 });
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/content_setting.js ('k') | extensions/renderer/resources/binding.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698