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

Side by Side Diff: LayoutTests/http/tests/serviceworker/fetch-event-after-navigation-within-page.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>ServiceWorker: navigator.serviceWorker.waiting</title> 2 <title>ServiceWorker: navigator.serviceWorker.waiting</title>
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script> 5 <script src="resources/test-helpers.js"></script>
6 <body> 6 <body>
7 <script> 7 <script>
8 8
9 promise_test(function(t) { 9 promise_test(function(t) {
10 var scope = 10 var scope =
11 'resources/fetch-event-after-navigation-within-page-iframe.html' + 11 'resources/fetch-event-after-navigation-within-page-iframe.html' +
12 '?hashchange'; 12 '?hashchange';
13 var worker = 'resources/simple-intercept-worker.js'; 13 var worker = 'resources/simple-intercept-worker.js';
14 var frame; 14 var frame;
15 15
16 service_worker_unregister_and_register(t, worker, scope) 16 service_worker_unregister_and_register(t, worker, scope)
17 .then(function(reg) { return wait_for_activated(t, reg); }) 17 .then(function(reg) {
18 return wait_for_state(t, reg.installing, 'activated');
19 })
18 .then(function() { return with_iframe(scope); }) 20 .then(function() { return with_iframe(scope); })
19 .then(function(f) { 21 .then(function(f) {
20 frame = f; 22 frame = f;
21 return frame.contentWindow.fetch_url('simple.txt'); 23 return frame.contentWindow.fetch_url('simple.txt');
22 }) 24 })
23 .then(function(response) { 25 .then(function(response) {
24 assert_equals(response, 'intercepted by service worker'); 26 assert_equals(response, 'intercepted by service worker');
25 frame.contentWindow.location.hash = 'foo'; 27 frame.contentWindow.location.hash = 'foo';
26 return frame.contentWindow.fetch_url('simple.txt'); 28 return frame.contentWindow.fetch_url('simple.txt');
27 }) 29 })
28 .then(function(response) { 30 .then(function(response) {
29 assert_equals(response, 'intercepted by service worker'); 31 assert_equals(response, 'intercepted by service worker');
30 frame.remove(); 32 frame.remove();
31 return service_worker_unregister_and_done(t, scope); 33 return service_worker_unregister_and_done(t, scope);
32 }) 34 })
33 }, 'Service Worker should respond to fetch event after the hash changes'); 35 }, 'Service Worker should respond to fetch event after the hash changes');
34 36
35 promise_test(function(t) { 37 promise_test(function(t) {
36 var scope = 38 var scope =
37 'resources/fetch-event-after-navigation-within-page-iframe.html' + 39 'resources/fetch-event-after-navigation-within-page-iframe.html' +
38 '?pushState'; 40 '?pushState';
39 var worker = 'resources/simple-intercept-worker.js'; 41 var worker = 'resources/simple-intercept-worker.js';
40 var frame; 42 var frame;
41 43
42 service_worker_unregister_and_register(t, worker, scope) 44 service_worker_unregister_and_register(t, worker, scope)
43 .then(function(reg) { return wait_for_activated(t, reg); }) 45 .then(function(reg) {
46 return wait_for_state(t, reg.installing, 'activated');
47 })
44 .then(function() { return with_iframe(scope); }) 48 .then(function() { return with_iframe(scope); })
45 .then(function(f) { 49 .then(function(f) {
46 frame = f; 50 frame = f;
47 return frame.contentWindow.fetch_url('simple.txt'); 51 return frame.contentWindow.fetch_url('simple.txt');
48 }) 52 })
49 .then(function(response) { 53 .then(function(response) {
50 assert_equals(response, 'intercepted by service worker'); 54 assert_equals(response, 'intercepted by service worker');
51 frame.contentWindow.history.pushState('', '', 'bar'); 55 frame.contentWindow.history.pushState('', '', 'bar');
52 return frame.contentWindow.fetch_url('simple.txt'); 56 return frame.contentWindow.fetch_url('simple.txt');
53 }) 57 })
54 .then(function(response) { 58 .then(function(response) {
55 assert_equals(response, 'intercepted by service worker'); 59 assert_equals(response, 'intercepted by service worker');
56 frame.remove(); 60 frame.remove();
57 return service_worker_unregister_and_done(t, scope); 61 return service_worker_unregister_and_done(t, scope);
58 }) 62 })
59 }, 'Service Worker should respond to fetch event after the pushState'); 63 }, 'Service Worker should respond to fetch event after the pushState');
60 64
61 </script> 65 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698