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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/request-end-to-end.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, 4 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Service Worker: FetchEvent.request passed to onfetch</title> 2 <title>Service Worker: FetchEvent.request passed to onfetch</title>
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script> 5 <script src="resources/test-helpers.js"></script>
6 <script> 6 <script>
7 promise_test(t => { 7 promise_test(t => {
8 var url = 'resources/request-end-to-end-worker.js'; 8 var url = 'resources/request-end-to-end-worker.js';
9 var scope = 'resources/blank.html'; 9 var scope = 'resources/blank.html';
10 return service_worker_unregister_and_register(t, url, scope) 10 return service_worker_unregister_and_register(t, url, scope)
11 .then(r => { 11 .then(r => {
12 add_completion_callback(() => { r.unregister(); }); 12 add_completion_callback(() => { r.unregister(); });
13 return wait_for_state(t, r.installing, 'activated'); 13 return wait_for_state(t, r.installing, 'activated');
14 }) 14 })
15 .then(() => { return with_iframe(scope); }) 15 .then(() => { return with_iframe(scope); })
16 .then(frame => { 16 .then(frame => {
17 add_completion_callback(() => { frame.remove(); }); 17 add_completion_callback(() => { frame.remove(); });
18 18
19 var result = JSON.parse(frame.contentDocument.body.textContent); 19 var result = JSON.parse(frame.contentDocument.body.textContent);
20 assert_equals(result.url, frame.src, 'request.url'); 20 assert_equals(result.url, frame.src, 'request.url');
21 assert_equals(result.method, 'GET', 'request.method'); 21 assert_equals(result.method, 'GET', 'request.method');
22 assert_equals(result.referrer, location.href, 'request.referrer'); 22 assert_equals(result.referrer, location.href, 'request.referrer');
23 assert_equals(result.mode, 'navigate', 'request.mode'); 23 assert_equals(result.mode, 'navigate', 'request.mode');
24 assert_equals(result.request_construct_error, 'TypeError', 24 assert_equals(result.request_construct_error, 'TypeError',
25 'Constructing a Request with a Request whose mode ' + 25 'Constructing a Request with a Request whose mode ' +
26 'is navigate and non-empty RequestInit must throw a ' + 26 'is navigate and non-empty RequestInit must throw a ' +
27 'TypeError.') 27 'TypeError.')
28 assert_equals(result.credentials, 'include', 'request.credentials'); 28 assert_equals(result.credentials, 'include', 'request.credentials');
29 assert_equals(result.redirect, 'manual', 'request.redirect'); 29 assert_equals(result.redirect, 'manual', 'request.redirect');
30 assert_equals(result.headers['user-agent'], navigator.userAgent,
31 'User-Agent header');
32 assert_equals(result.append_header_error, 'TypeError', 30 assert_equals(result.append_header_error, 'TypeError',
33 'Appending a new header to the request must throw a ' + 31 'Appending a new header to the request must throw a ' +
34 'TypeError.') 32 'TypeError.')
35 }); 33 });
36 }, 'Test FetchEvent.request passed to onfetch'); 34 }, 'Test FetchEvent.request passed to onfetch');
37 </script> 35 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698