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

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

Issue 1143293003: Service Worker: Add ServiceWorkerContainer.getRegistrations() method. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove unused param in claim-not-using-registration.html 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
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script src="resources/test-helpers.js"></script>
5 <script src="../fetch/resources/fetch-test-helpers.js"></script>
6 <script>
7 sequential_promise_test(function(t) {
8 return navigator.serviceWorker.getRegistrations()
9 .then(function(value) {
10 assert_array_equals(
11 value,
12 [],
13 'getRegistrations should resolve with an empty array.');
14 });
15 }, 'getRegistrations');
16
17 sequential_promise_test(function(t) {
18 var scope = 'resources/scope/getregistrations/normal';
19 var script = 'resources/empty-worker.js';
20 var registrations = [];
21 return service_worker_unregister_and_register(t, script, scope)
22 .then(function(r) {
23 registrations.push(r);
24 return navigator.serviceWorker.getRegistrations();
25 })
26 .then(function(value) {
27 assert_array_equals(
28 value,
29 registrations,
30 'getRegistrations should resolve with array of registrations.');
31 service_worker_unregister(t, scope);
32 });
33 }, 'Register then getRegistrations');
34
35 sequential_promise_test(function(t) {
36 var scope1 = 'resources/scope/getregistrations/scope1';
37 var scope2 = 'resources/scope/getregistrations/scope2';
38 var script = 'resources/empty-worker.js';
39 var registrations = [];
40 return service_worker_unregister_and_register(t, script, scope1)
41 .then(function(r) {
42 registrations.push(r);
43 return service_worker_unregister_and_register(t, script, scope2);
44 })
45 .then(function(r) {
46 registrations.push(r);
47 return navigator.serviceWorker.getRegistrations();
48 })
49 .then(function(value) {
50 assert_array_equals(
51 value,
52 registrations,
53 'getRegistrations should resolve with array of registrations.');
54 service_worker_unregister(t, scope1);
55 service_worker_unregister(t, scope2);
56 });
57 }, 'Register multiple times then getRegistrations');
58
59 sequential_promise_test(function(t) {
60 var scope = 'resources/scope/getregistrations/register-unregister';
61 var script = 'resources/empty-worker.js';
62 return service_worker_unregister_and_register(t, script, scope)
63 .then(function(registration) {
64 return registration.unregister();
65 })
66 .then(function() {
67 return navigator.serviceWorker.getRegistrations();
68 })
69 .then(function(value) {
70 assert_array_equals(
71 value,
72 [],
73 'getRegistrations should resolve with an empty array.');
74 });
75 }, 'Register then Unregister then getRegistrations');
76
77 sequential_promise_test_done();
78 done();
79 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698