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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
| 89 (function() { |
| 90 var t = async_test('Service Worker fetches other file in fetch event'); |
| 91 var scope = 'resources/simple.html?fetch'; |
| 92 service_worker_unregister_and_register(t, worker, scope, onRegister); |
| 93 |
| 94 function onRegister(sw) { |
| 95 sw.addEventListener('statechange', t.step_func(onStateChange)); |
| 96 } |
| 97 |
| 98 function onStateChange(event) { |
| 99 if (event.target.state != 'active') |
| 100 return; |
| 101 with_iframe(scope, t.step_func(function(frame) { |
| 102 assert_equals(frame.contentDocument.body.textContent, 'Here\'s an ot
her html file.\n', |
| 103 'Response should come from fetched other file'); |
| 104 service_worker_unregister_and_done(t, scope); |
| 105 })); |
| 106 } |
| 107 }()); |
88 </script> | 108 </script> |
89 </body> | 109 </body> |
OLD | NEW |