Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: chrome/renderer/resources/extensions/test_custom_bindings.js

Issue 23478003: Check and canonicalize CSS selectors before registering PageStateMatchers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix problems kalman noticed Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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) {
239 chromeTest.assertEq(message, e.message); 239 if (message instanceof RegExp) {
240 chromeTest.assertTrue(message.test(e.message),
241 e.message + ' should match ' + message)
242 } else {
243 chromeTest.assertEq(message, e.message);
244 }
245 }
240 } 246 }
241 }); 247 });
242 248
243 function safeFunctionApply(func, args) { 249 function safeFunctionApply(func, args) {
244 try { 250 try {
245 if (func) 251 if (func)
246 $Function.apply(func, null, args); 252 $Function.apply(func, null, args);
247 } catch (e) { 253 } catch (e) {
248 var msg = "uncaught exception " + e; 254 var msg = "uncaught exception " + e;
249 chromeTest.fail(msg); 255 chromeTest.fail(msg);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 apiFunctions.setHandleRequest('getApiDefinitions', function() { 322 apiFunctions.setHandleRequest('getApiDefinitions', function() {
317 return GetExtensionAPIDefinitionsForTest(); 323 return GetExtensionAPIDefinitionsForTest();
318 }); 324 });
319 325
320 apiFunctions.setHandleRequest('getApiFeatures', function() { 326 apiFunctions.setHandleRequest('getApiFeatures', function() {
321 return GetAPIFeatures(); 327 return GetAPIFeatures();
322 }); 328 });
323 }); 329 });
324 330
325 exports.binding = binding.generate(); 331 exports.binding = binding.generate();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698