Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/fetch/window/useragent-header.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/window/useragent-header.html b/third_party/WebKit/LayoutTests/http/tests/fetch/window/useragent-header.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..429cb4284579bd880aa9c41e84e6267eab72ed1b |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/fetch/window/useragent-header.html |
| @@ -0,0 +1,25 @@ |
| +<!doctype html> |
| +<script src = "/resources/testharness.js"></script> |
| +<script src = "/resources/testharnessreport.js"></script> |
| +<script src = "../resources/useragent-header.js"></script> |
| +<script> |
| +promise_test(() => { |
| + return fetch('/resources/echo-headers.php') |
| + .then(response => { |
|
horo
2016/08/24 01:38:33
ditto
|
| + return response.text(); |
| + }).then(body => { |
| + const user_agent_header = parse_response(body); |
| + assert_true(user_agent_header.length > 0); |
| + }); |
| +}, 'fetch() should send a non-empty User-Agent header'); |
| + |
| +promise_test(() => { |
| + return fetch('/resources/echo-headers.php', {headers: {'user-agent': 'foobar'}}) |
| + .then(response => { |
|
horo
2016/08/24 01:38:33
ditto
|
| + return response.text(); |
| + }).then(body => { |
| + const user_agent_header = parse_response(body); |
| + assert_equals(user_agent_header, 'foobar'); |
| + }); |
| +}, 'fetch() should send an author provided User-Agent header'); |
| +</script> |