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

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

Issue 790683002: ServiceWorker cleanup: remove wait_for_activated(); just use wait_for_state() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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 | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Service Worker: Fetch event network error</title> 2 <title>Service Worker: Fetch event network error</title>
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharness-helpers.js"></script> 4 <script src="../resources/testharness-helpers.js"></script>
5 <script src="../resources/testharnessreport.js"></script> 5 <script src="../resources/testharnessreport.js"></script>
6 <script src="resources/test-helpers.js"></script> 6 <script src="resources/test-helpers.js"></script>
7 <script> 7 <script>
8 var resolve_test_done; 8 var resolve_test_done;
9 9
10 var test_done_promise = new Promise(function(resolve) { 10 var test_done_promise = new Promise(function(resolve) {
11 resolve_test_done = resolve; 11 resolve_test_done = resolve;
12 }); 12 });
13 13
14 // Called by the child frame. 14 // Called by the child frame.
15 function notify_test_done(result) { 15 function notify_test_done(result) {
16 resolve_test_done(result); 16 resolve_test_done(result);
17 } 17 }
18 18
19 promise_test(function(t) { 19 promise_test(function(t) {
20 var scope = 'resources/fetch-event-network-error-controllee-iframe.html'; 20 var scope = 'resources/fetch-event-network-error-controllee-iframe.html';
21 var script = 'resources/fetch-event-network-error-worker.js'; 21 var script = 'resources/fetch-event-network-error-worker.js';
22 var frame; 22 var frame;
23 23
24 return service_worker_unregister_and_register(t, script, scope) 24 return service_worker_unregister_and_register(t, script, scope)
25 .then(function(registration) { 25 .then(function(registration) {
26 return wait_for_activated(t, registration); 26 return wait_for_state(t, registration.installing, 'activated');
27 }) 27 })
28 .then(function() { 28 .then(function() {
29 return with_iframe(scope); 29 return with_iframe(scope);
30 }) 30 })
31 .then(function(f) { 31 .then(function(f) {
32 frame = f; 32 frame = f;
33 return test_done_promise; 33 return test_done_promise;
34 }) 34 })
35 .then(function(result) { 35 .then(function(result) {
36 frame.remove(); 36 frame.remove();
37 assert_equals(result, 'PASS'); 37 assert_equals(result, 'PASS');
38 return service_worker_unregister_and_done(t, scope); 38 return service_worker_unregister_and_done(t, scope);
39 }); 39 });
40 }, 'Rejecting the fetch event or using preventDefault() causes a network ' + 40 }, 'Rejecting the fetch event or using preventDefault() causes a network ' +
41 'error'); 41 'error');
42 </script> 42 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698