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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium.request-end-to-end.html

Issue 2889153004: Upstream service worker "request" tests to WPT (Closed)
Patch Set: Upstream service worker "request" tests to WPT Created 3 years, 7 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 <!-- This test is prefixed with `chromium.` because the equivalent version
3 available in Web Platform Tests contains additional assertions which Chromium
4 currently fails. This test should be persisted only to preserve test coverage
5 until such time as the upstream version can be made to pass. See
6 https://crbug.com/595993 -->
2 <title>Service Worker: FetchEvent.request passed to onfetch</title> 7 <title>Service Worker: FetchEvent.request passed to onfetch</title>
3 <script src="../resources/testharness.js"></script> 8 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 9 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script> 10 <script src="resources/test-helpers.js"></script>
6 <script> 11 <script>
7 promise_test(t => { 12 promise_test(t => {
8 var url = 'resources/request-end-to-end-worker.js'; 13 var url = 'resources/request-end-to-end-worker.js';
9 var scope = 'resources/blank.html'; 14 var scope = 'resources/blank.html';
10 return service_worker_unregister_and_register(t, url, scope) 15 return service_worker_unregister_and_register(t, url, scope)
11 .then(r => { 16 .then(r => {
12 add_completion_callback(() => { r.unregister(); }); 17 add_completion_callback(() => { r.unregister(); });
13 return wait_for_state(t, r.installing, 'activated'); 18 return wait_for_state(t, r.installing, 'activated');
14 }) 19 })
15 .then(() => { return with_iframe(scope); }) 20 .then(() => { return with_iframe(scope); })
16 .then(frame => { 21 .then(frame => {
17 add_completion_callback(() => { frame.remove(); }); 22 add_completion_callback(() => { frame.remove(); });
18 23
19 var result = JSON.parse(frame.contentDocument.body.textContent); 24 var result = JSON.parse(frame.contentDocument.body.textContent);
20 assert_equals(result.url, frame.src, 'request.url'); 25 assert_equals(result.url, frame.src, 'request.url');
21 assert_equals(result.method, 'GET', 'request.method'); 26 assert_equals(result.method, 'GET', 'request.method');
22 assert_equals(result.referrer, location.href, 'request.referrer'); 27 assert_equals(result.referrer, location.href, 'request.referrer');
23 assert_equals(result.mode, 'navigate', 'request.mode'); 28 assert_equals(result.mode, 'navigate', 'request.mode');
24 assert_equals(result.request_construct_error, 'TypeError', 29 assert_equals(result.request_construct_error, 'TypeError',
25 'Constructing a Request with a Request whose mode ' + 30 'Constructing a Request with a Request whose mode ' +
26 'is navigate and non-empty RequestInit must throw a ' + 31 'is navigate and non-empty RequestInit must throw a ' +
27 'TypeError.') 32 'TypeError.')
28 assert_equals(result.credentials, 'include', 'request.credentials'); 33 assert_equals(result.credentials, 'include', 'request.credentials');
29 assert_equals(result.redirect, 'manual', 'request.redirect'); 34 assert_equals(result.redirect, 'manual', 'request.redirect');
30 assert_equals(result.headers['user-agent'], navigator.userAgent,
31 'User-Agent header');
falken 2017/05/19 03:46:21 I'd actually rather keep this assert with a // TO
mike3 2017/05/19 16:12:11 Nice thinking!
32 assert_equals(result.append_header_error, 'TypeError', 35 assert_equals(result.append_header_error, 'TypeError',
33 'Appending a new header to the request must throw a ' + 36 'Appending a new header to the request must throw a ' +
34 'TypeError.') 37 'TypeError.')
35 }); 38 });
36 }, 'Test FetchEvent.request passed to onfetch'); 39 }, 'Test FetchEvent.request passed to onfetch');
37 </script> 40 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698