Commit 2cb2113a authored by Stephen McGruer's avatar Stephen McGruer Committed by Commit Bot

Remove assert_throws usage in http/tests/mojo/

'assert_throws' has been deprecated in WPT, replaced by JS
and DOM-specific variants. http/tests/mojo should use the
JS variant, but that requires mojo.test.InputError to be a
real Error subclass.

Bug: 1051932
Change-Id: Icdc16cc69a856f3cfb65c0e6686f91d5bcf0eae1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2125949Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754967}
parent faa6740f
......@@ -10,18 +10,21 @@
// Files and Lines represent the raw text from an input string
// or ".data" file.
function InputError(message, line) {
this.name = "InputError";
this.message = message;
this.line = line;
}
class InputError extends Error {
constructor(message, line) {
super(message);
InputError.prototype.toString = function() {
var s = 'Error: ' + this.message;
if (this.line)
s += ', at line ' +
(this.line.number + 1) + ': "' + this.line.contents + '"';
return s;
this.name = "InputError";
this.line = line;
}
toString() {
var s = 'Error: ' + this.message;
if (this.line)
s += ', at line ' +
(this.line.number + 1) + ': "' + this.line.contents + '"';
return s;
}
}
function File(contents) {
......
......@@ -100,7 +100,7 @@ test(() => {
test(() => {
function parserShouldFail(input) {
assert_throws(new mojo.test.InputError(), function() {
assert_throws_js(mojo.test.InputError, function() {
mojo.test.parseTestMessage(input);
});
}
......
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