| Index: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/setrequestheader-useragent.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/setrequestheader-useragent.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/setrequestheader-useragent.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..60f97132bdf72fc639626615460fb6f7f00c4bf0
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/setrequestheader-useragent.html
|
| @@ -0,0 +1,30 @@
|
| +<!DOCTYPE html>
|
| +<script src="/resources/testharness.js"></script>
|
| +<script src="/resources/testharnessreport.js"></script>
|
| +<script>
|
| +async_test(test => {
|
| + const xhr = new XMLHttpRequest();
|
| + xhr.onload = test.step_func(() => {
|
| + const lines = xhr.responseText.split('\n');
|
| + for (let line of lines) {
|
| + if (line.length == 0) {
|
| + continue;
|
| + }
|
| + const parts = line.trim().split(': ', 2);
|
| + if (parts.length < 2) {
|
| + assert_unreached('Invalid line in response: ' + line);
|
| + }
|
| + if (parts[0] == 'HTTP_USER_AGENT') {
|
| + assert_equals(parts[1], 'foobar');
|
| + test.done();
|
| + return;
|
| + }
|
| + }
|
| + assert_unreached('User-Agent header not found');
|
| + test.done();
|
| + });
|
| + xhr.open('GET', 'resources/print-headers.cgi');
|
| + xhr.setRequestHeader('User-Agent', 'foobar');
|
| + xhr.send();
|
| +}, 'XMLHttpRequest.setRequestHeader() should accept User-Agent');
|
| +</script>
|
|
|