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 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 Loading... |
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(); |
OLD | NEW |