OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: Request end-to-end</title> | 2 <title>Service Worker: Request end-to-end</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 var t = async_test('Request: end-to-end'); | 7 var t = async_test('Request: end-to-end'); |
8 t.step(function() { | 8 t.step(function() { |
9 var url = 'resources/request-end-to-end-worker.js'; | 9 var url = 'resources/request-end-to-end-worker.js'; |
10 var scope = 'resources/blank.html'; | 10 var scope = 'resources/blank.html'; |
(...skipping 23 matching lines...) Expand all Loading... |
34 })); | 34 })); |
35 } | 35 } |
36 | 36 |
37 function onActive() { | 37 function onActive() { |
38 with_iframe(scope, t.step_func(function(frame) {})); | 38 with_iframe(scope, t.step_func(function(frame) {})); |
39 } | 39 } |
40 | 40 |
41 function onMessage(event) { | 41 function onMessage(event) { |
42 assert_equals( | 42 assert_equals( |
43 event.data.url, | 43 event.data.url, |
44 location.href.substring(0, location.href.lastIndexOf('/') + 1) + sco
pe, | 44 location.href.substring(0, location.href.lastIndexOf('/') + 1) + |
| 45 scope, |
45 'request.url should be passed to onfetch event.'); | 46 'request.url should be passed to onfetch event.'); |
46 assert_equals(event.data.method, 'GET', | 47 assert_equals(event.data.method, 'GET', |
47 'request.method should be passed to onfetch event.'); | 48 'request.method should be passed to onfetch event.'); |
48 assert_equals(event.data.referrer, location.href, | 49 assert_equals(event.data.referrer, location.href, |
49 'request.referrer should be passed to onfetch event.'); | 50 'request.referrer should be passed to onfetch event.'); |
50 assert_equals(event.data.headers['user-agent'], navigator.userAgent, | 51 assert_equals(event.data.headers['user-agent'], navigator.userAgent, |
51 'User-Agent header should be passed to onfetch event.') | 52 'User-Agent header should be passed to onfetch event.') |
| 53 assert_equals(event.data.errorNameWhileAppendingHeader, 'TypeError', |
| 54 'Appending a new header to the request must throw a ' + |
| 55 'TypeError.') |
52 service_worker_unregister_and_done(t, scope); | 56 service_worker_unregister_and_done(t, scope); |
53 } | 57 } |
54 }); | 58 }); |
55 </script> | 59 </script> |
OLD | NEW |