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

Side by Side Diff: chrome/renderer/resources/extensions/test_custom_bindings.js

Issue 12522004: Lazily load extension API schemas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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/renderer/extensions/dispatcher.cc ('k') | tools/json_schema_compiler/compiler.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // test_custom_bindings.js 5 // test_custom_bindings.js
6 // mini-framework for ExtensionApiTest browser tests 6 // mini-framework for ExtensionApiTest browser tests
7 7
8 var binding = require('binding').Binding.create('test'); 8 var binding = require('binding').Binding.create('test');
9 9
10 var chrome = requireNative('chrome').GetChrome(); 10 var chrome = requireNative('chrome').GetChrome();
11 var GetExtensionAPIDefinition = 11 var GetExtensionAPIDefinitions =
12 requireNative('apiDefinitions').GetExtensionAPIDefinition; 12 requireNative('apiDefinitions').GetExtensionAPIDefinitions;
13 var GetAvailability = requireNative('v8_context').GetAvailability;
13 14
14 binding.registerCustomHook(function(api) { 15 binding.registerCustomHook(function(api) {
15 var chromeTest = api.compiledApi; 16 var chromeTest = api.compiledApi;
16 var apiFunctions = api.apiFunctions; 17 var apiFunctions = api.apiFunctions;
17 18
18 chromeTest.tests = chromeTest.tests || []; 19 chromeTest.tests = chromeTest.tests || [];
19 20
20 var currentTest = null; 21 var currentTest = null;
21 var lastTest = null; 22 var lastTest = null;
22 var testsFailed = 0; 23 var testsFailed = 0;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 apiFunctions.setHandleRequest('callbackFail', function(expectedError, func) { 277 apiFunctions.setHandleRequest('callbackFail', function(expectedError, func) {
277 return chromeTest.callback(func, expectedError); 278 return chromeTest.callback(func, expectedError);
278 }); 279 });
279 280
280 apiFunctions.setHandleRequest('runTests', function(tests) { 281 apiFunctions.setHandleRequest('runTests', function(tests) {
281 chromeTest.tests = tests; 282 chromeTest.tests = tests;
282 testCount = chromeTest.tests.length; 283 testCount = chromeTest.tests.length;
283 chromeTest.runNextTest(); 284 chromeTest.runNextTest();
284 }); 285 });
285 286
286 apiFunctions.setHandleRequest('getApiDefinitions', function(apiNames) { 287 apiFunctions.setHandleRequest('getApiDefinitions', function() {
287 return GetExtensionAPIDefinition(); 288 return GetExtensionAPIDefinitions().filter(function(api) {
289 return GetAvailability(api.namespace).is_available;
290 });
288 }); 291 });
289 }); 292 });
290 293
291 exports.binding = binding.generate(); 294 exports.binding = binding.generate();
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/dispatcher.cc ('k') | tools/json_schema_compiler/compiler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698