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

Unified Diff: third_party/WebKit/LayoutTests/fast/domurl/url-constructor.html

Issue 1860623002: Add support for URL.searchParams getter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restrict .searchParams to URL only Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/domurl/url-constructor.html
diff --git a/third_party/WebKit/LayoutTests/fast/domurl/url-constructor.html b/third_party/WebKit/LayoutTests/fast/domurl/url-constructor.html
index c379f3821985a1eb24e81b32fffbacece17ef815..525838edab4b047a32d98db875f40055f0b5d28a 100644
--- a/third_party/WebKit/LayoutTests/fast/domurl/url-constructor.html
+++ b/third_party/WebKit/LayoutTests/fast/domurl/url-constructor.html
@@ -3,15 +3,8 @@
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
-
-function assertThrows(func, expected) {
- try {
- func();
- } catch (ex) {
- assert_equals(String(ex), expected);
- return;
- }
- assert_true(false, 'Expected an exception with string: ' + expected);
+function assert_type_error(f, msg) {
+ assert_throws(TypeError(), f, msg);
}
test(function() {
@@ -28,27 +21,29 @@ test(function() {
}, 'Valid URLs');
test(function() {
- assertThrows(function() {
- new URL();
- }, 'TypeError: Failed to construct \'URL\': 1 argument required, but only 0 present.');
- assertThrows(function() {
- new URL('');
- }, 'TypeError: Failed to construct \'URL\': Invalid URL');
- assertThrows(function() {
- new URL('','about:blank');
- }, 'TypeError: Failed to construct \'URL\': Invalid URL');
- assertThrows(function() {
- new URL('abc');
- }, 'TypeError: Failed to construct \'URL\': Invalid URL');
- assertThrows(function() {
- new URL('//abc');
- }, 'TypeError: Failed to construct \'URL\': Invalid URL');
- assertThrows(function() {
- new URL('http:///www.domain.com/', 'abc');
- }, 'TypeError: Failed to construct \'URL\': Invalid base URL');
- assertThrows(function() {
- new URL('http:///www.domain.com/', null);
- }, 'TypeError: Failed to construct \'URL\': Invalid base URL');
+ assert_type_error(
+ function() { new URL(); },
+ 'TypeError: Failed to construct \'URL\': 1 argument required, but only 0 present.');
+ assert_type_error(
+ function() { new URL(''); },
+ 'TypeError: Failed to construct \'URL\': Invalid URL');
+ assert_type_error(
+ function() { new URL('','about:blank'); },
+ 'TypeError: Failed to construct \'URL\': Invalid URL');
+ assert_type_error(
+ function() { new URL('abc'); },
+ 'TypeError: Failed to construct \'URL\': Invalid URL');
+ assert_type_error(
+ function() { new URL('//abc'); },
+ 'TypeError: Failed to construct \'URL\': Invalid URL');
+ assert_type_error(
+ function() { new URL('http:///www.domain.com/', 'abc'); },
+ 'TypeError: Failed to construct \'URL\': Invalid base URL');
+ assert_type_error(
+ function() { new URL('http:///www.domain.com/', null); },
+ 'TypeError: Failed to construct \'URL\': Invalid base URL');
+ assert_type_error(
+ function() { new URL('//abc', null); },
+ 'TypeError: Failed to construct \'URL\': Invalid base URL');
}, 'Invalid URL parameters');
-
</script>

Powered by Google App Engine
This is Rietveld 408576698