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

Side by Side Diff: LayoutTests/http/tests/serviceworker/getregistrations.html

Issue 1205493005: Service Worker: Add initialization step for getRegistrations.html layout test. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix indentation 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/multiple-register.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Service Worker: getRegistrations()</title> 2 <title>Service Worker: getRegistrations()</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="../resources/get-host-info.js"></script> 6 <script src="../resources/get-host-info.js"></script>
7 <script src="../fetch/resources/fetch-test-helpers.js"></script> 7 <script src="../fetch/resources/fetch-test-helpers.js"></script>
8 <script> 8 <script>
9 // Purge the existing registrations for the origin.
10 // getRegistrations() is used in order to avoid adding additional complexity
11 // e.g. adding an internal function.
12 sequential_promise_test(function(t) {
13 return navigator.serviceWorker.getRegistrations()
14 .then(function(registrations) {
15 return registrations.reduce(function(sequence, registration) {
16 return sequence.then(function() {
17 return registration.unregister();
18 });
19 }, Promise.resolve());
20 });
21 }, 'Purge the existing registrations.');
22
9 sequential_promise_test(function(t) { 23 sequential_promise_test(function(t) {
10 return navigator.serviceWorker.getRegistrations() 24 return navigator.serviceWorker.getRegistrations()
11 .then(function(value) { 25 .then(function(value) {
12 assert_array_equals( 26 assert_array_equals(
13 value, 27 value,
14 [], 28 [],
15 'getRegistrations should resolve with an empty array.'); 29 'getRegistrations should resolve with an empty array.');
16 }); 30 });
17 }, 'getRegistrations'); 31 }, 'getRegistrations');
18 32
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 }) 135 })
122 .then(function() { 136 .then(function() {
123 frame.remove(); 137 frame.remove();
124 return service_worker_unregister(t, scope); 138 return service_worker_unregister(t, scope);
125 }); 139 });
126 }, 'getRegistrations promise resolves only with same origin registrations.'); 140 }, 'getRegistrations promise resolves only with same origin registrations.');
127 141
128 sequential_promise_test_done(); 142 sequential_promise_test_done();
129 done(); 143 done();
130 </script> 144 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/multiple-register.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698