Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/withCredentials-after-send.html | 
| diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/withCredentials-after-send.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/withCredentials-after-send.html | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..f7bfd989ff49fe9b00a14135466a961cbcf75779 | 
| --- /dev/null | 
| +++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/withCredentials-after-send.html | 
| @@ -0,0 +1,41 @@ | 
| +<!doctype html> | 
| +<html> | 
| +<head> | 
| +<title>XMLHttpRequest: setting withCredentials while sending data</title> | 
| +<script src="../resources/testharness.js"></script> | 
| +<script src="../resources/testharnessreport.js"></script> | 
| +</head> | 
| +<body> | 
| +<script> | 
| +var testAsync = async_test("Setting withCredentials, post-send() (async)"); | 
| +testAsync.step(() => { | 
| + var xhr = new XMLHttpRequest(); | 
| + xhr.open("POST", "resources/delay.php?iteration=1&delay=1000"); | 
| + xhr.onloadstart = testAsync.step_func(() => { | 
| + assert_equals(xhr.readyState, XMLHttpRequest.OPENED); | 
| + assert_throws('InvalidStateError', () => { xhr.withCredentials = true }); | 
| + }); | 
| + xhr.onloadend = testAsync.step_func(() => { | 
| + assert_equals(xhr.readyState, XMLHttpRequest.DONE); | 
| + testAsync.done(); | 
| + }); | 
| + xhr.send(); | 
| + testAsync.done(); | 
| 
 
yhirano
2016/11/14 06:45:22
Not needed?
 
sof
2016/11/14 07:47:04
Yes, unintentionally crept in.
 
 | 
| +}); | 
| + | 
| +var testSync = async_test("Setting withCredentials, post-send() (sync)"); | 
| +testSync.step(() => { | 
| + var xhr = new XMLHttpRequest(); | 
| + xhr.open("POST", "resources/delay.php?iteration=1&delay=1000", false); | 
| + xhr.onprogress = testSync.step_func(() => { | 
| + assert_throws('InvalidStateError', () => { xhr.withCredentials = true }); | 
| + }); | 
| + xhr.onloadend = testSync.step_func(() => { | 
| + assert_equals(xhr.readyState, XMLHttpRequest.DONE); | 
| + testSync.done(); | 
| + }); | 
| + xhr.send(); | 
| +}); | 
| +</script> | 
| +</body> | 
| +</html> |