Chromium Code Reviews| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 chromeTest.assertEq(expectedError, chrome.runtime.lastError.message); | 228 chromeTest.assertEq(expectedError, chrome.runtime.lastError.message); |
| 229 }); | 229 }); |
| 230 | 230 |
| 231 apiFunctions.setHandleRequest('assertThrows', | 231 apiFunctions.setHandleRequest('assertThrows', |
| 232 function(fn, self, args, message) { | 232 function(fn, self, args, message) { |
| 233 chromeTest.assertTrue(typeof fn == 'function'); | 233 chromeTest.assertTrue(typeof fn == 'function'); |
| 234 try { | 234 try { |
| 235 fn.apply(self, args); | 235 fn.apply(self, args); |
| 236 chromeTest.fail('Did not throw error: ' + fn); | 236 chromeTest.fail('Did not throw error: ' + fn); |
| 237 } catch (e) { | 237 } catch (e) { |
| 238 if (message !== undefined) | 238 if (e !== failureException && message !== undefined) |
|
Jeffrey Yasskin
2013/08/26 22:35:19
This is a drive-by fix to improve test failure mes
not at google - send to devlin
2013/08/27 01:46:14
All this !== comparing to failureException is rath
Jeffrey Yasskin
2013/08/29 03:39:39
Do you object to the !==, or is it ok to be consis
not at google - send to devlin
2013/08/29 15:20:25
Yeah, use != rather than !==. This file is inconsi
Jeffrey Yasskin
2013/08/29 21:46:43
Done.
| |
| 239 chromeTest.assertEq(message, e.message); | 239 chromeTest.assertEq(message, e.message); |
| 240 } | 240 } |
| 241 }); | 241 }); |
| 242 | 242 |
| 243 function safeFunctionApply(func, args) { | 243 function safeFunctionApply(func, args) { |
| 244 try { | 244 try { |
| 245 if (func) | 245 if (func) |
| 246 $Function.apply(func, null, args); | 246 $Function.apply(func, null, args); |
| 247 } catch (e) { | 247 } catch (e) { |
| 248 var msg = "uncaught exception " + e; | 248 var msg = "uncaught exception " + e; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 apiFunctions.setHandleRequest('getApiDefinitions', function() { | 316 apiFunctions.setHandleRequest('getApiDefinitions', function() { |
| 317 return GetExtensionAPIDefinitionsForTest(); | 317 return GetExtensionAPIDefinitionsForTest(); |
| 318 }); | 318 }); |
| 319 | 319 |
| 320 apiFunctions.setHandleRequest('getApiFeatures', function() { | 320 apiFunctions.setHandleRequest('getApiFeatures', function() { |
| 321 return GetAPIFeatures(); | 321 return GetAPIFeatures(); |
| 322 }); | 322 }); |
| 323 }); | 323 }); |
| 324 | 324 |
| 325 exports.binding = binding.generate(); | 325 exports.binding = binding.generate(); |
| OLD | NEW |