OLD | NEW |
---|---|
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 GetExtensionAPIDefinition = |
12 requireNative('apiDefinitions').GetExtensionAPIDefinition; | 12 requireNative('apiDefinitions').GetExtensionAPIDefinition; |
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(apiNames) { |
287 return GetExtensionAPIDefinition(); | 288 var apis = GetExtensionAPIDefinition(); |
289 var available_apis = []; | |
290 for (var i in apis) { | |
291 if (GetAvailability(apis[i].namespace).is_available) | |
292 available_apis.push(apis[i]); | |
293 } | |
294 return available_apis;; | |
not at google - send to devlin
2013/03/22 18:13:48
woo:
return GetExtensionAPIDefinition().filter(fu
cduvall
2013/03/22 20:26:45
Done.
| |
288 }); | 295 }); |
289 }); | 296 }); |
290 | 297 |
291 exports.binding = binding.generate(); | 298 exports.binding = binding.generate(); |
OLD | NEW |