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

Change 'assert_throws' --> 'assert_throws_{js, dom}' in http/

Tackling the set of calls that avoided the automated refactor (for
various reasons). There are about 50 in total, split up into a few CLs
to make reviewing it easier.

Bug: 1051932
Change-Id: Ie8cb346bcd4104c11dcb41f001b26cdc260948b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2082905
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746557}
parent 38fa0002
...@@ -11,7 +11,7 @@ test(() => { ...@@ -11,7 +11,7 @@ test(() => {
const response = new Response(rs); const response = new Response(rs);
try { try {
// This throws different errors depending on how Blink is built, so // This throws different errors depending on how Blink is built, so
// assert_throws() cannot be used. // assert_throws_{js, dom}() cannot be used.
fillStackAndRun(() => response.clone(), 784); fillStackAndRun(() => response.clone(), 784);
assert_unreached('stack should overflow'); assert_unreached('stack should overflow');
} catch (e) { } catch (e) {
......
...@@ -714,33 +714,33 @@ test(() => { ...@@ -714,33 +714,33 @@ test(() => {
// functionality here. We now generate RequestInit with the IDL compiler, // functionality here. We now generate RequestInit with the IDL compiler,
// but it's still good to keep these around. // but it's still good to keep these around.
const e = Error(); const e = Error();
assert_throws(e, () => { assert_throws_exactly(e, () => {
new Request('/', {get method() { throw e; }})}, 'method'); new Request('/', {get method() { throw e; }})}, 'method');
assert_throws(e, () => { assert_throws_exactly(e, () => {
new Request('/', {get headers() { throw e; }})}, 'headers'); new Request('/', {get headers() { throw e; }})}, 'headers');
assert_throws(e, () => { assert_throws_exactly(e, () => {
new Request('/', {get body() { throw e; }})}, 'body'); new Request('/', {get body() { throw e; }})}, 'body');
assert_throws(e, () => { assert_throws_exactly(e, () => {
new Request('/', {get referrer() { throw e; }})}, 'referrer'); new Request('/', {get referrer() { throw e; }})}, 'referrer');
assert_throws(e, () => { assert_throws_exactly(e, () => {
new Request('/', {get referrerPolicy() { throw e; }})}, 'referrerPolicy'); new Request('/', {get referrerPolicy() { throw e; }})}, 'referrerPolicy');
assert_throws(e, () => { assert_throws_exactly(e, () => {
new Request('/', {get mode() { throw e; }})}, 'mode'); new Request('/', {get mode() { throw e; }})}, 'mode');
assert_throws(e, () => { assert_throws_exactly(e, () => {
new Request('/', {get credentials() { throw e; }})}, 'credentials'); new Request('/', {get credentials() { throw e; }})}, 'credentials');
assert_throws(e, () => { assert_throws_exactly(e, () => {
new Request('/', {get cache() { throw e; }})}, 'cache'); new Request('/', {get cache() { throw e; }})}, 'cache');
assert_throws(e, () => { assert_throws_exactly(e, () => {
new Request('/', {get redirect() { throw e; }})}, 'redirect'); new Request('/', {get redirect() { throw e; }})}, 'redirect');
assert_throws(e, () => { assert_throws_exactly(e, () => {
new Request('/', {get integrity() { throw e; }})}, 'integrity'); new Request('/', {get integrity() { throw e; }})}, 'integrity');
assert_throws(e, () => { assert_throws_exactly(e, () => {
new Request('/', {get keepalive() { throw e; }})}, 'keepalive'); new Request('/', {get keepalive() { throw e; }})}, 'keepalive');
assert_throws(e, () => { assert_throws_exactly(e, () => {
new Request('/', {get signal() { throw e; }})}, 'signal'); new Request('/', {get signal() { throw e; }})}, 'signal');
// Not implemented // Not implemented
// assert_throws(e, () => { // assert_throws_exactly(e, () => {
// new Request('/', {get window() { throw e; }})}, 'window'); // new Request('/', {get window() { throw e; }})}, 'window');
}, 'Getter exceptions should not be silently ignored'); }, 'Getter exceptions should not be silently ignored');
...@@ -752,14 +752,13 @@ test(() => { ...@@ -752,14 +752,13 @@ test(() => {
// instead of `AbortSignal` due to a bug in the IDL compiler, and performed // instead of `AbortSignal` due to a bug in the IDL compiler, and performed
// conversions manually. This test ensures that conversion were carried out // conversions manually. This test ensures that conversion were carried out
// properly. // properly.
const e = TypeError(); assert_throws_js(TypeError, () => {
assert_throws(e, () => {
new Request('/', {signal: {}})}, new Request('/', {signal: {}})},
'An empty object as RequestInit\'s signal member should fail type conversion'); 'An empty object as RequestInit\'s signal member should fail type conversion');
assert_throws(e, () => { assert_throws_js(TypeError, () => {
new Request('/', {signal: new Request('/')})}, new Request('/', {signal: new Request('/')})},
'A Request object as RequestInit\'s signal member should fail type conversion'); 'A Request object as RequestInit\'s signal member should fail type conversion');
assert_throws(e, () => { assert_throws_js(TypeError, () => {
new Request('/', {signal: new Response('/')})}, new Request('/', {signal: new Response('/')})},
'A Response object as RequestInit\'s signal member should fail type conversion'); 'A Response object as RequestInit\'s signal member should fail type conversion');
}, 'TypeError should be thrown when RequestInit\'s signal member does not implement the AbortSignal interface'); }, 'TypeError should be thrown when RequestInit\'s signal member does not implement the AbortSignal interface');
......
...@@ -135,7 +135,7 @@ test(function() { ...@@ -135,7 +135,7 @@ test(function() {
test(function() { test(function() {
[0, 1, 100, 101, 199, 600, 700].forEach(function(status) { [0, 1, 100, 101, 199, 600, 700].forEach(function(status) {
assert_throws({name: 'RangeError'}, assert_throws_js(RangeError,
function() { function() {
new Response(new Blob(), {status: status}); new Response(new Blob(), {status: status});
}, },
...@@ -153,7 +153,7 @@ test(function() { ...@@ -153,7 +153,7 @@ test(function() {
}); });
[300, 0, 304, 305, 306, 309, 500].forEach(function(status) { [300, 0, 304, 305, 306, 309, 500].forEach(function(status) {
assert_throws({name: 'RangeError'}, assert_throws_js(RangeError,
function() { function() {
Response.redirect('https://www.example.com/test.html', Response.redirect('https://www.example.com/test.html',
status); status);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
sourceBuffer.appendBuffer(mediaData); sourceBuffer.appendBuffer(mediaData);
test.waitForExpectedEvents(function() test.waitForExpectedEvents(function()
{ {
assert_throws({name: "QuotaExceededError"}, assert_throws_dom("QuotaExceededError",
function() { mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE); }, function() { mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE); },
"addSourceBuffer must throw an exception if the MediaSource has already received init segments for all sourcebuffers added at the time"); "addSourceBuffer must throw an exception if the MediaSource has already received init segments for all sourcebuffers added at the time");
test.done(); test.done();
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
{ {
// MediaSource is fully initialized now, so adding new SourceBuffers is no longer possible. // MediaSource is fully initialized now, so adding new SourceBuffers is no longer possible.
assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_METADATA); assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_METADATA);
assert_throws({name: "QuotaExceededError"}, assert_throws_dom("QuotaExceededError",
function() { mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE); }, function() { mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYPE); },
"addSourceBuffer must throw an exception if the media element has already reached HAVE_METADATA"); "addSourceBuffer must throw an exception if the media element has already reached HAVE_METADATA");
test.done(); test.done();
......
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