| 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 (function() { | 9 (function() { |
| 10 var t = async_test('Service Worker responds to fetch event with blob body'); | 10 var t = async_test('Service Worker responds to fetch event with blob body'); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 with_iframe(scope, t.step_func(function(frame) { | 61 with_iframe(scope, t.step_func(function(frame) { |
| 62 assert_equals(frame.contentDocument.body.textContent, '', | 62 assert_equals(frame.contentDocument.body.textContent, '', |
| 63 'Response should be the empty string'); | 63 'Response should be the empty string'); |
| 64 service_worker_unregister_and_done(t, scope); | 64 service_worker_unregister_and_done(t, scope); |
| 65 })); | 65 })); |
| 66 } | 66 } |
| 67 }()); | 67 }()); |
| 68 | 68 |
| 69 (function() { | 69 (function() { |
| 70 var t = async_test('Service Worker rejects fetch event'); | 70 var t = async_test('Service Worker rejects fetch event'); |
| 71 var scope = 'resources/simple.html?ignore'; | 71 var scope = 'resources/simple.html?reject'; |
| 72 service_worker_unregister_and_register(t, worker, scope, onRegister); | 72 service_worker_unregister_and_register(t, worker, scope, onRegister); |
| 73 | 73 |
| 74 function onRegister(sw) { | 74 function onRegister(sw) { |
| 75 sw.addEventListener('statechange', t.step_func(onStateChange)); | 75 sw.addEventListener('statechange', t.step_func(onStateChange)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 function onStateChange(event) { | 78 function onStateChange(event) { |
| 79 if (event.target.state != 'active') | 79 if (event.target.state != 'active') |
| 80 return; | 80 return; |
| 81 with_iframe(scope, t.step_func(function(frame) { | 81 with_iframe(scope, t.step_func(function(frame) { |
| 82 assert_equals(frame.contentDocument.body.textContent, 'Here\'s a sim
ple html file.\n', | 82 assert_equals(frame.contentDocument.body.textContent, 'Here\'s a sim
ple html file.\n', |
| 83 'Response should come from fallback to native fetch'); | 83 'Response should come from fallback to native fetch'); |
| 84 service_worker_unregister_and_done(t, scope); | 84 service_worker_unregister_and_done(t, scope); |
| 85 })); | 85 })); |
| 86 } | 86 } |
| 87 }()); | 87 }()); |
| 88 </script> | 88 </script> |
| 89 </body> | 89 </body> |
| OLD | NEW |