Commit 8feec9c6 authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions Cleanup] Remove old js-bindings errors branches

Some tests still had handling for either js-bindings or native
bindings.  Since native bindings have been shipped for a long time,
remove the old js bindings errors.

Bug: None
Change-Id: Icd39d40d7be67a17842a2f2242ecc16b43b9be74
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2334991Reviewed-by: default avatarDavid Bertoni <dbertoni@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794365}
parent 5fdca8b6
......@@ -39,15 +39,10 @@ function test() {
assertRuntimeIsRegistered();
assertStorageIsRegistered();
var jsBindingsError =
"'storage' requires a different Feature that is not present.";
var nativeBindingsError =
"'storage.get' is not available in this context.";
var regexp = new RegExp(nativeBindingsError + '|' + jsBindingsError);
// Although storage should throw an error on use since it's removed.
chrome.test.assertThrows(
chrome.storage.local.get, chrome.storage.local, [function(){}],
regexp);
`'storage.get' is not available in this context.`);
chrome.test.succeed();
}));
......
......@@ -176,13 +176,9 @@ chrome.test.getConfig(function(config) {
}));
assertTrue(typeof chrome.bookmarks == 'object' &&
chrome.bookmarks != null);
var nativeBindingsError =
"'bookmarks.getTree' is not available in this context.";
var jsBindingsError =
"'bookmarks' requires a different Feature that is not present.";
var regexp =
new RegExp(nativeBindingsError + '|' + jsBindingsError);
assertThrows(chrome.bookmarks.getTree, [function(){}], regexp);
assertThrows(
chrome.bookmarks.getTree, [function(){}],
`'bookmarks.getTree' is not available in this context.`);
}
));
},
......@@ -270,12 +266,8 @@ chrome.test.getConfig(function(config) {
function(permissions) {
assertTrue(typeof chrome.bookmarks == 'object' &&
chrome.bookmarks != null);
var nativeBindingsError =
"'bookmarks.getTree' is not available in this context.";
var jsBindingsError =
"'bookmarks' requires a different Feature that is not present.";
var regexp = new RegExp(nativeBindingsError + '|' + jsBindingsError);
assertThrows(chrome.bookmarks.getTree, [function(){}], regexp);
assertThrows(chrome.bookmarks.getTree, [function(){}],
`'bookmarks.getTree' is not available in this context.`);
});
chrome.permissions.request(
......
......@@ -36,10 +36,7 @@ chrome.test.runTests([
},
function audibleUpdateAttemptShouldFail() {
var expectedJsBindingsError =
'Invalid value for argument 2. Property \'audible\': ' +
'Unexpected property.';
var expectedNativeBindingsError =
var expectedError =
'Error in invocation of tabs.update(' +
'optional integer tabId, object updateProperties, ' +
'optional function callback): Error at parameter ' +
......@@ -50,9 +47,7 @@ chrome.test.runTests([
chrome.test.fail('Updated audible property via chrome.tabs.update');
});
} catch (e) {
assertTrue(e.message == expectedJsBindingsError ||
e.message == expectedNativeBindingsError,
e.message);
assertEq(expectedError, e.message);
chrome.test.succeed();
}
},
......
......@@ -183,10 +183,7 @@ chrome.test.runTests([
// Make sure we don't crash when the index is out of range.
function moveToInvalidTab() {
var expectedJsBindingsError =
'Invalid value for argument 2. Property \'index\': ' +
'Value must not be less than -1.';
var expectedNativeBindingsError =
var expectedError =
'Error in invocation of tabs.move(' +
'[integer|array] tabIds, object moveProperties, ' +
'optional function callback): Error at parameter \'moveProperties\': ' +
......@@ -197,8 +194,7 @@ chrome.test.runTests([
chrome.test.fail("Moved a tab to an invalid index");
});
} catch (e) {
assertTrue(e.message == expectedJsBindingsError ||
e.message == expectedNativeBindingsError, e.message);
assertEq(expectedError, e.message);
caught = true;
}
assertTrue(caught);
......
......@@ -6,11 +6,9 @@ function check_overflow_check(value) {
try {
chrome.windows.create({ "left": value }, function() { });
} catch (e) {
var jsBindingsError = 'Value must fit in a 32-bit signed integer.';
var nativeBindingsError = 'Invalid type: expected integer, found number.';
var expectedError = 'Invalid type: expected integer, found number.';
chrome.test.assertTrue(
e.message.indexOf(jsBindingsError) != -1 ||
e.message.indexOf(nativeBindingsError) != -1,
e.message.indexOf(expectedError) != -1,
e.message);
chrome.test.succeed();
return;
......
......@@ -45,16 +45,10 @@ chrome.test.sendMessage('loaded', function(test) {
setTimeout(callback.bind(null, 'OK'), 0);
break;
case 'INVALID_VALUE':
var jsBindingsError =
'Invalid value for argument 1. ' +
'Value must be one of: ' +
'\\[OK, FAILED, INVALID_TICKET, INVALID_DATA\\].';
var nativeBindingsError =
var expectedError =
'Error at parameter \'result\': Value must be one of ' +
'FAILED, INVALID_DATA, INVALID_TICKET, OK.';
chrome.test.assertThrows(
callback, ['XXX'],
new RegExp(jsBindingsError + '|' + nativeBindingsError));
chrome.test.assertThrows(callback, ['XXX'], expectedError);
break;
case 'FAILED':
case 'INVALID_TICKET':
......
......@@ -2,10 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function eitherError(error1, error2) {
return new RegExp(error1 + '|' + error2);
}
chrome.test.sendMessage('loaded', function(test) {
chrome.test.runTests([function printTest() {
if (test == 'NO_LISTENER') {
......@@ -35,18 +31,10 @@ chrome.test.sendMessage('loaded', function(test) {
}
if (test == 'NOT_ARRAY') {
var jsBindingsError =
'Invalid value for argument 1. ' +
'Expected \'array\' but got \'string\'.'
var nativeBindingsError = 'No matching signature';
chrome.test.assertThrows(
callback, ['XXX'],
eitherError(jsBindingsError, nativeBindingsError));
chrome.test.assertThrows(callback, ['XXX'],
'No matching signature.');
} else if (test == 'INVALID_PRINTER_TYPE') {
var jsBindingsError =
'Invalid value for argument 1. ' +
'Property \'.1\': Expected \'object\' but got \'string\'.';
var nativeBindingsError =
var expectedError =
'Error at parameter \'printerInfo\': Error at index 1: ' +
'Invalid type: expected printerProvider.PrinterInfo, ' +
'found string.';
......@@ -57,12 +45,9 @@ chrome.test.sendMessage('loaded', function(test) {
name: 'Printer 1',
description: 'Test printer'
}, 'printer2']],
eitherError(jsBindingsError, nativeBindingsError));
expectedError);
} else if (test == 'INVALID_PRINTER') {
var jsBindingsError =
'Invalid value for argument 1. ' +
'Property \'.0.unsupported\': Unexpected property.';
var nativeBindingsError =
var expectedError =
'Error at parameter \'printerInfo\': ' +
'Error at index 0: Unexpected property: \'unsupported\'.';
chrome.test.assertThrows(
......@@ -73,7 +58,7 @@ chrome.test.sendMessage('loaded', function(test) {
description: 'Test printer',
unsupported: 'print'
}]],
eitherError(jsBindingsError, nativeBindingsError));
expectedError);
} else {
chrome.test.assertEq('OK', test);
callback([{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment