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

Side by Side Diff: LayoutTests/http/tests/serviceworker/fetch-event.html

Issue 318393002: Initial implementation of ServiceWorkerGlobalScope.fetch() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incoroporated dominicc's comment Created 6 years, 6 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 <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
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>
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/serviceworker/fetch.html ('k') | LayoutTests/http/tests/serviceworker/fetch-event-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698