Commit 019c5925 authored by Eriko Kurimoto's avatar Eriko Kurimoto Committed by Commit Bot

Worker: Modernize dedicated-worker-options-type.html using assert_throws

This CL is for code cleanup.
This doesn't change the behavior.

Bug: n/a
Change-Id: Iac4a44781fde183881cea62a97c8883932a670ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2011593
Commit-Queue: Eriko Kurimoto <elkurin@google.com>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734341}
parent 7afe38da
...@@ -25,23 +25,22 @@ promise_test(() => { ...@@ -25,23 +25,22 @@ promise_test(() => {
}, 'Test worker construction with the "module" worker type.'); }, 'Test worker construction with the "module" worker type.');
test(() => { test(() => {
try { assert_throws(
new Worker('resources/post-message-on-load-worker.js', { type: '' }); new TypeError(),
assert_unreached( () => {
'Worker construction with an empty type should throw an exception'); new Worker('resources/post-message-on-load-worker.js', { type: '' });
} catch (e) { },
assert_equals(e.name, 'TypeError'); 'Worker construction with an empty type should throw an exception');
}
}, 'Test worker construction with an empty worker type.'); }, 'Test worker construction with an empty worker type.');
test(() => { test(() => {
try { assert_throws(
new Worker('resources/post-message-on-load-worker.js', { type: 'unknown' }); new TypeError(),
assert_unreached( () => {
'Worker construction with an unknown type should throw an exception'); new Worker('resources/post-message-on-load-worker.js',
} catch (e) { { type: 'unknown' });
assert_equals(e.name, 'TypeError'); },
} 'Worker construction with an unknown type should throw an exception');
}, 'Test worker construction with an unknown worker type.'); }, 'Test worker construction with an unknown worker type.');
</script> </script>
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