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

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

Issue 1143293003: Service Worker: Add ServiceWorkerContainer.getRegistrations() method. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix layout tests that affect the new 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 <script src="../fetch/resources/fetch-test-helpers.js"></script>
falken 2015/06/05 01:36:39 Can you explain why we need sequential_promise_tes
jungkees 2015/06/05 02:08:13 As you pointed, it shouldn't have to be using sequ
6 <body> 7 <body>
7 <script> 8 <script>
8 9
9 promise_test(function(t) { 10 sequential_promise_test(function(t) {
10 var scope = 11 var scope =
11 'resources/fetch-event-after-navigation-within-page-iframe.html' + 12 'resources/fetch-event-after-navigation-within-page-iframe.html' +
12 '?hashchange'; 13 '?hashchange';
13 var worker = 'resources/simple-intercept-worker.js'; 14 var worker = 'resources/simple-intercept-worker.js';
14 var frame; 15 var frame;
15 16
16 service_worker_unregister_and_register(t, worker, scope) 17 return service_worker_unregister_and_register(t, worker, scope)
17 .then(function(reg) { 18 .then(function(reg) {
18 return wait_for_state(t, reg.installing, 'activated'); 19 return wait_for_state(t, reg.installing, 'activated');
19 }) 20 })
20 .then(function() { return with_iframe(scope); }) 21 .then(function() { return with_iframe(scope); })
21 .then(function(f) { 22 .then(function(f) {
22 frame = f; 23 frame = f;
23 return frame.contentWindow.fetch_url('simple.txt'); 24 return frame.contentWindow.fetch_url('simple.txt');
24 }) 25 })
25 .then(function(response) { 26 .then(function(response) {
26 assert_equals(response, 'intercepted by service worker'); 27 assert_equals(response, 'intercepted by service worker');
27 frame.contentWindow.location.hash = 'foo'; 28 frame.contentWindow.location.hash = 'foo';
28 return frame.contentWindow.fetch_url('simple.txt'); 29 return frame.contentWindow.fetch_url('simple.txt');
29 }) 30 })
30 .then(function(response) { 31 .then(function(response) {
31 assert_equals(response, 'intercepted by service worker'); 32 assert_equals(response, 'intercepted by service worker');
32 frame.remove(); 33 frame.remove();
33 return service_worker_unregister_and_done(t, scope); 34 return service_worker_unregister(t, scope);
34 }) 35 })
35 }, 'Service Worker should respond to fetch event after the hash changes'); 36 }, 'Service Worker should respond to fetch event after the hash changes');
36 37
37 promise_test(function(t) { 38 sequential_promise_test(function(t) {
38 var scope = 39 var scope =
39 'resources/fetch-event-after-navigation-within-page-iframe.html' + 40 'resources/fetch-event-after-navigation-within-page-iframe.html' +
40 '?pushState'; 41 '?pushState';
41 var worker = 'resources/simple-intercept-worker.js'; 42 var worker = 'resources/simple-intercept-worker.js';
42 var frame; 43 var frame;
43 44
44 service_worker_unregister_and_register(t, worker, scope) 45 return service_worker_unregister_and_register(t, worker, scope)
45 .then(function(reg) { 46 .then(function(reg) {
46 return wait_for_state(t, reg.installing, 'activated'); 47 return wait_for_state(t, reg.installing, 'activated');
47 }) 48 })
48 .then(function() { return with_iframe(scope); }) 49 .then(function() { return with_iframe(scope); })
49 .then(function(f) { 50 .then(function(f) {
50 frame = f; 51 frame = f;
51 return frame.contentWindow.fetch_url('simple.txt'); 52 return frame.contentWindow.fetch_url('simple.txt');
52 }) 53 })
53 .then(function(response) { 54 .then(function(response) {
54 assert_equals(response, 'intercepted by service worker'); 55 assert_equals(response, 'intercepted by service worker');
55 frame.contentWindow.history.pushState('', '', 'bar'); 56 frame.contentWindow.history.pushState('', '', 'bar');
56 return frame.contentWindow.fetch_url('simple.txt'); 57 return frame.contentWindow.fetch_url('simple.txt');
57 }) 58 })
58 .then(function(response) { 59 .then(function(response) {
59 assert_equals(response, 'intercepted by service worker'); 60 assert_equals(response, 'intercepted by service worker');
60 frame.remove(); 61 frame.remove();
61 return service_worker_unregister_and_done(t, scope); 62 return service_worker_unregister(t, scope);
62 }) 63 })
63 }, 'Service Worker should respond to fetch event after the pushState'); 64 }, 'Service Worker should respond to fetch event after the pushState');
65 sequential_promise_test_done();
falken 2015/06/05 01:36:39 nit: newline above this
jungkees 2015/06/05 02:08:13 Resolved by removing this call.
66 done();
64 67
65 </script> 68 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698