| Index: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/non-simple-cross-origin-progress-events.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/non-simple-cross-origin-progress-events.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/non-simple-cross-origin-progress-events.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b1259d98e4d6410ea8c5d04f6dea31a410e8315c
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/non-simple-cross-origin-progress-events.html
|
| @@ -0,0 +1,42 @@
|
| +<!doctype html>
|
| +<script src="/resources/testharness.js"></script>
|
| +<script src="/resources/testharnessreport.js"></script>
|
| +<script>
|
| +// A simple cross-origin request means a cross-origin request with only
|
| +// CORS-safelisted method and request-headers.
|
| +
|
| +async_test(test => {
|
| + const xhr = new XMLHttpRequest();
|
| + let onprogressCalled;
|
| + xhr.onprogress = test.step_func(() => {
|
| + onprogressCalled = true;
|
| + });
|
| + xhr.onload = test.step_func(() => {
|
| + assert_true(onprogressCalled, 'onprogress is called');
|
| +
|
| + assert_true(uploadOnprogressCalled, 'upload.onprogress is called');
|
| + assert_true(uploadOnloadCalled, 'upload.onload is called');
|
| +
|
| + test.done();
|
| + });
|
| +
|
| + // Set handlers after send()
|
| + const upload = xhr.upload;
|
| + let uploadOnprogressCalled;
|
| + upload.onprogress = test.step_func(() => {
|
| + uploadOnprogressCalled = true;
|
| + });
|
| + let onloadCalled;
|
| + upload.onload = test.step_func(() => {
|
| + uploadOnloadCalled = true;
|
| + });
|
| +
|
| + // Use the script which responds to OPTIONS requests.
|
| + const params = new URLSearchParams();
|
| + params.append('origin', 'http://127.0.0.1:8000');
|
| + params.append('headers', 'test');
|
| + xhr.open('POST', 'http://localhost:8000/xmlhttprequest/resources/access-control-allow-lists.php?' + params.toString(), true);
|
| + xhr.setRequestHeader("test", "test");
|
| + xhr.send('hello');
|
| +}, 'Upload progress events should be dispatched for a non-simple cross-origin request');
|
| +</script>
|
|
|