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

Side by Side Diff: LayoutTests/http/tests/serviceworker/fetch-event-after-navigation-within-page.html

Issue 1168393002: Service Worker: Add ServiceWorkerContainer.getRegistrations() method. (Blink layout tests) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove iframe at the end of the test. Created 5 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 <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 return service_worker_unregister_and_register(t, worker, scope)
17 .then(function(reg) { 17 .then(function(reg) {
18 return wait_for_state(t, reg.installing, 'activated'); 18 return wait_for_state(t, reg.installing, 'activated');
19 }) 19 })
20 .then(function() { return with_iframe(scope); }) 20 .then(function() { return with_iframe(scope); })
21 .then(function(f) { 21 .then(function(f) {
22 frame = f; 22 frame = f;
23 return frame.contentWindow.fetch_url('simple.txt'); 23 return frame.contentWindow.fetch_url('simple.txt');
24 }) 24 })
25 .then(function(response) { 25 .then(function(response) {
26 assert_equals(response, 'intercepted by service worker'); 26 assert_equals(response, 'intercepted by service worker');
27 frame.contentWindow.location.hash = 'foo'; 27 frame.contentWindow.location.hash = 'foo';
28 return frame.contentWindow.fetch_url('simple.txt'); 28 return frame.contentWindow.fetch_url('simple.txt');
29 }) 29 })
30 .then(function(response) { 30 .then(function(response) {
31 assert_equals(response, 'intercepted by service worker'); 31 assert_equals(response, 'intercepted by service worker');
32 frame.remove(); 32 frame.remove();
33 return service_worker_unregister_and_done(t, scope); 33 return service_worker_unregister_and_done(t, scope);
34 }) 34 })
35 }, 'Service Worker should respond to fetch event after the hash changes'); 35 }, 'Service Worker should respond to fetch event after the hash changes');
36 36
37 promise_test(function(t) { 37 promise_test(function(t) {
38 var scope = 38 var scope =
39 'resources/fetch-event-after-navigation-within-page-iframe.html' + 39 'resources/fetch-event-after-navigation-within-page-iframe.html' +
40 '?pushState'; 40 '?pushState';
41 var worker = 'resources/simple-intercept-worker.js'; 41 var worker = 'resources/simple-intercept-worker.js';
42 var frame; 42 var frame;
43 43
44 service_worker_unregister_and_register(t, worker, scope) 44 return service_worker_unregister_and_register(t, worker, scope)
45 .then(function(reg) { 45 .then(function(reg) {
46 return wait_for_state(t, reg.installing, 'activated'); 46 return wait_for_state(t, reg.installing, 'activated');
47 }) 47 })
48 .then(function() { return with_iframe(scope); }) 48 .then(function() { return with_iframe(scope); })
49 .then(function(f) { 49 .then(function(f) {
50 frame = f; 50 frame = f;
51 return frame.contentWindow.fetch_url('simple.txt'); 51 return frame.contentWindow.fetch_url('simple.txt');
52 }) 52 })
53 .then(function(response) { 53 .then(function(response) {
54 assert_equals(response, 'intercepted by service worker'); 54 assert_equals(response, 'intercepted by service worker');
55 frame.contentWindow.history.pushState('', '', 'bar'); 55 frame.contentWindow.history.pushState('', '', 'bar');
56 return frame.contentWindow.fetch_url('simple.txt'); 56 return frame.contentWindow.fetch_url('simple.txt');
57 }) 57 })
58 .then(function(response) { 58 .then(function(response) {
59 assert_equals(response, 'intercepted by service worker'); 59 assert_equals(response, 'intercepted by service worker');
60 frame.remove(); 60 frame.remove();
61 return service_worker_unregister_and_done(t, scope); 61 return service_worker_unregister_and_done(t, scope);
62 }) 62 })
63 }, 'Service Worker should respond to fetch event after the pushState'); 63 }, 'Service Worker should respond to fetch event after the pushState');
64 64
65 </script> 65 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698