OLD | NEW |
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 // 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 environmentSpecificBindings = require('test_environment_specific_bindings'); | 10 var environmentSpecificBindings = require('test_environment_specific_bindings'); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 var called = null; | 56 var called = null; |
57 return function() { | 57 return function() { |
58 if (called != null) { | 58 if (called != null) { |
59 var redundantPrefix = 'Error\n'; | 59 var redundantPrefix = 'Error\n'; |
60 chromeTest.fail( | 60 chromeTest.fail( |
61 'Callback has already been run. ' + | 61 'Callback has already been run. ' + |
62 'First call:\n' + | 62 'First call:\n' + |
63 $String.slice(called, redundantPrefix.length) + '\n' + | 63 $String.slice(called, redundantPrefix.length) + '\n' + |
64 'Second call:\n' + | 64 'Second call:\n' + |
65 $String.slice(new Error().stack, redundantPrefix.length)); | 65 $String.slice(new $Error.self().stack, redundantPrefix.length)); |
66 } | 66 } |
67 called = new Error().stack; | 67 called = new $Error.self().stack; |
68 | 68 |
69 pendingCallbacks--; | 69 pendingCallbacks--; |
70 if (pendingCallbacks == 0) { | 70 if (pendingCallbacks == 0) { |
71 chromeTest.succeed(); | 71 chromeTest.succeed(); |
72 } | 72 } |
73 }; | 73 }; |
74 }); | 74 }); |
75 | 75 |
76 apiFunctions.setHandleRequest('runNextTest', function() { | 76 apiFunctions.setHandleRequest('runNextTest', function() { |
77 // There may have been callbacks which were interrupted by failure | 77 // There may have been callbacks which were interrupted by failure |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 350 |
351 apiFunctions.setHandleRequest('setExceptionHandler', function(callback) { | 351 apiFunctions.setHandleRequest('setExceptionHandler', function(callback) { |
352 chromeTest.assertEq(typeof(callback), 'function'); | 352 chromeTest.assertEq(typeof(callback), 'function'); |
353 uncaughtExceptionHandler.setHandler(callback); | 353 uncaughtExceptionHandler.setHandler(callback); |
354 }); | 354 }); |
355 | 355 |
356 environmentSpecificBindings.registerHooks(api); | 356 environmentSpecificBindings.registerHooks(api); |
357 }); | 357 }); |
358 | 358 |
359 exports.binding = binding.generate(); | 359 exports.binding = binding.generate(); |
OLD | NEW |