Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
| 4 <script src="resources/test-helpers.js"></script> | 4 <script src="resources/test-helpers.js"></script> |
| 5 <body> | 5 <body> |
| 6 <script> | 6 <script> |
| 7 var worker = 'resources/fetch-event-test-worker.js'; | 7 var worker = 'resources/fetch-event-test-worker.js'; |
| 8 | 8 |
| 9 async_test(function(t) { | 9 async_test(function(t) { |
| 10 var scope = 'resources/simple.html?string'; | 10 var scope = 'resources/simple.html?string'; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 client_id2, | 103 client_id2, |
| 104 'Service Worker should respond to another fetch from the same ' + | 104 'Service Worker should respond to another fetch from the same ' + |
| 105 'client with the same client id'); | 105 'client with the same client id'); |
| 106 frame.remove(); | 106 frame.remove(); |
| 107 return service_worker_unregister_and_done(t, scope); | 107 return service_worker_unregister_and_done(t, scope); |
| 108 }) | 108 }) |
| 109 .catch(unreached_rejection(t)); | 109 .catch(unreached_rejection(t)); |
| 110 }, 'Service Worker responds to fetch event with a client id'); | 110 }, 'Service Worker responds to fetch event with a client id'); |
| 111 | 111 |
| 112 async_test(function(t) { | 112 async_test(function(t) { |
| 113 var scope = 'resources/simple.html?accept'; | |
| 114 service_worker_unregister_and_register(t, worker, scope) | |
| 115 .then(function(reg) { | |
| 116 return wait_for_state(t, reg.installing, 'activated'); | |
| 117 }) | |
| 118 .then(function() { return with_iframe(scope); }) | |
| 119 .then(function(frame) { | |
| 120 assert_equals( | |
| 121 frame.contentDocument.body.textContent, | |
| 122 // Spec: 'Accept: text/html,application/xhtml+xml,application/xml;q= 0.9,*/*;q=0.8', | |
| 123 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image /webp,*/*;q=0.8', | |
| 124 'Accept header value for navigation request should be visible to Ser vice Worker'); | |
| 125 frame.remove(); | |
|
nhiroki
2016/04/11 08:33:29
Thanks to (*), an iframe created by with_iframe()
| |
| 126 return service_worker_unregister_and_done(t, scope); | |
| 127 }) | |
| 128 .catch(unreached_rejection(t)); | |
| 129 }, 'Accept header value for navigation request visible to Service Worker'); | |
| 130 | |
| 131 async_test(function(t) { | |
| 113 var scope = 'resources/simple.html?ignore'; | 132 var scope = 'resources/simple.html?ignore'; |
| 114 service_worker_unregister_and_register(t, worker, scope) | 133 service_worker_unregister_and_register(t, worker, scope) |
| 115 .then(function(reg) { | 134 .then(function(reg) { |
| 116 return wait_for_state(t, reg.installing, 'activated'); | 135 return wait_for_state(t, reg.installing, 'activated'); |
| 117 }) | 136 }) |
| 118 .then(function() { return with_iframe(scope); }) | 137 .then(function() { return with_iframe(scope); }) |
| 119 .then(function(frame) { | 138 .then(function(frame) { |
| 120 assert_equals(frame.contentDocument.body.textContent, | 139 assert_equals(frame.contentDocument.body.textContent, |
| 121 'Here\'s a simple html file.\n', | 140 'Here\'s a simple html file.\n', |
| 122 'Response should come from fallback to native fetch'); | 141 'Response should come from fallback to native fetch'); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 'event.respondWith must set the used flag.'); | 267 'event.respondWith must set the used flag.'); |
| 249 first_frame.remove(); | 268 first_frame.remove(); |
| 250 frame.remove(); | 269 frame.remove(); |
| 251 return service_worker_unregister_and_done(t, scope); | 270 return service_worker_unregister_and_done(t, scope); |
| 252 }) | 271 }) |
| 253 .catch(unreached_rejection(t)); | 272 .catch(unreached_rejection(t)); |
| 254 }, 'Service Worker event.respondWith must set the used flag'); | 273 }, 'Service Worker event.respondWith must set the used flag'); |
| 255 | 274 |
| 256 </script> | 275 </script> |
| 257 </body> | 276 </body> |
| OLD | NEW |