Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/open-with-invalid-argument-is-noop.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/open-with-invalid-argument-is-noop.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/open-with-invalid-argument-is-noop.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..638ddb833a6c6f935673e6f63138af27b3c61a3d |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/open-with-invalid-argument-is-noop.html |
| @@ -0,0 +1,49 @@ |
| +<!DOCTYPE html> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script> |
| +async_test(t => { |
| + const xhr = new XMLHttpRequest(); |
| + xhr.open('GET', 'resources/get.txt'); |
| + xhr.onload = t.step_func(() => { |
| + assert_equals(xhr.responseText, 'PASS'); |
| + t.done(); |
| + }); |
| + |
| + assert_throws('SyntaxError', () => { |
| + xhr.open('FOO BAR', 'nonexistent'); |
| + }, 'open() should throw for a SyntaxError for an invalid method'); |
| + |
| + xhr.send(); |
| +}, 'open() with an invalid method is no-op'); |
| + |
| +async_test(t => { |
| + const xhr = new XMLHttpRequest(); |
| + xhr.open('GET', 'resources/get.txt'); |
| + xhr.onload = t.step_func(() => { |
| + assert_equals(xhr.responseText, 'PASS'); |
| + t.done(); |
| + }); |
| + |
| + assert_throws('SecurityError', () => { |
| + xhr.open('CONNECT', 'nonexistent'); |
| + }, 'open() should throw for a SecurityError for a forbidden method'); |
| + |
| + xhr.send(); |
| +}, 'open() with a forbidden method is no-op'); |
| + |
| +async_test(t => { |
| + const xhr = new XMLHttpRequest(); |
| + xhr.open('GET', 'resources/get.txt'); |
| + xhr.onload = t.step_func(() => { |
| + assert_equals(xhr.responseText, 'PASS'); |
| + t.done(); |
| + }); |
| + |
| + assert_throws('SyntaxError', () => { |
| + xhr.open('GET', 'http://localhost:foobar/'); |
| + }, 'open() should throw for a SyntaxError for an invalid method'); |
|
yhirano
2016/09/01 07:02:42
wrong description
tyoshino (SeeGerritForStatus)
2016/09/01 10:19:41
Good catches. Fixed
|
| + |
| + xhr.send(); |
| +}, 'open() with a forbidden method is no-op'); |
|
yhirano
2016/09/01 07:02:42
wrong name
tyoshino (SeeGerritForStatus)
2016/09/01 10:19:41
Done.
|
| +</script> |