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(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 apiFunctions.setHandleRequest('fail', function(message) { | 91 apiFunctions.setHandleRequest('fail', function(message) { |
92 chromeTest.log("( FAILED ) " + testName(currentTest)); | 92 chromeTest.log("( FAILED ) " + testName(currentTest)); |
93 | 93 |
94 var stack = {}; | 94 var stack = {}; |
95 Error.captureStackTrace(stack, chromeTest.fail); | 95 Error.captureStackTrace(stack, chromeTest.fail); |
96 | 96 |
97 if (!message) | 97 if (!message) |
98 message = "FAIL (no message)"; | 98 message = "FAIL (no message)"; |
99 | 99 |
100 message += "\n" + stack.stack; | 100 message += "\n" + stack.stack; |
101 console.log("[FAIL] " + testName(currentTest) + ": " + message); | 101 chrome.test.log("[FAIL] " + testName(currentTest) + ": " + message); |
102 testsFailed++; | 102 testsFailed++; |
103 testDone(); | 103 testDone(); |
104 | 104 |
105 // Interrupt the rest of the test. | 105 // Interrupt the rest of the test. |
106 throw failureException; | 106 throw failureException; |
107 }); | 107 }); |
108 | 108 |
109 apiFunctions.setHandleRequest('succeed', function() { | 109 apiFunctions.setHandleRequest('succeed', function() { |
110 console.log("[SUCCESS] " + testName(currentTest)); | 110 console.log("[SUCCESS] " + testName(currentTest)); |
111 chromeTest.log("( SUCCESS )"); | 111 chromeTest.log("( SUCCESS )"); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 }); | 285 }); |
286 | 286 |
287 apiFunctions.setHandleRequest('getApiDefinitions', function() { | 287 apiFunctions.setHandleRequest('getApiDefinitions', function() { |
288 return GetExtensionAPIDefinitions().filter(function(api) { | 288 return GetExtensionAPIDefinitions().filter(function(api) { |
289 return GetAvailability(api.namespace).is_available; | 289 return GetAvailability(api.namespace).is_available; |
290 }); | 290 }); |
291 }); | 291 }); |
292 }); | 292 }); |
293 | 293 |
294 exports.binding = binding.generate(); | 294 exports.binding = binding.generate(); |
OLD | NEW |