Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/setrequestheader-useragent.html

Issue 2254693002: Delay generation of User-Agent header to URLRequestHttpJob and accept custom User-Agent from XHR/Fe… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed Android test Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script>
4 <script>
5 async_test(test => {
6 const xhr = new XMLHttpRequest();
7 xhr.onload = test.step_func(() => {
8 const lines = xhr.responseText.split('\n');
9 for (let line of lines) {
10 if (line.length == 0) {
11 continue;
12 }
13 const parts = line.trim().split(': ', 2);
14 if (parts.length < 2) {
15 assert_unreached('Invalid line in response: ' + line);
16 }
17 if (parts[0] == 'HTTP_USER_AGENT') {
18 assert_equals(parts[1], 'foobar');
19 test.done();
20 return;
21 }
22 }
23 assert_unreached('User-Agent header not found');
24 test.done();
25 });
26 xhr.open('GET', 'resources/print-headers.cgi');
27 xhr.setRequestHeader('User-Agent', 'foobar');
28 xhr.send();
29 }, 'XMLHttpRequest.setRequestHeader() should accept User-Agent');
30 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698