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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/registration-service-worker-attributes.html

Issue 2893743003: Upstream service wrkr "registration" tests to WPT (Closed)
Patch Set: Created 3 years, 7 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>
6 promise_test(function(t) {
7 var scope = 'resources/scope/installing-waiting-active-after-registration';
8 var worker_url = 'resources/empty-worker.js';
9 var expected_url = normalizeURL(worker_url);
10 var installing_worker;
11 var registration;
12
13 return service_worker_unregister_and_register(t, worker_url, scope)
14 .then(function(r) {
15 add_completion_callback(function() { r.unregister(); });
16 registration = r;
17 installing_worker = registration.installing;
18 assert_equals(registration.installing.scriptURL, expected_url,
19 'installing before updatefound');
20 assert_equals(registration.waiting, null,
21 'waiting before updatefound');
22 assert_equals(registration.active, null,
23 'active before updatefound');
24 return wait_for_update(t, registration);
25 })
26 .then(function() {
27 assert_equals(registration.installing, installing_worker,
28 'installing after updatefound');
29 assert_equals(registration.waiting, null,
30 'waiting after updatefound');
31 assert_equals(registration.active, null,
32 'active after updatefound');
33 return wait_for_state(t, registration.installing, 'installed');
34 })
35 .then(function() {
36 assert_equals(registration.installing, null,
37 'installing after installed');
38 assert_equals(registration.waiting, installing_worker,
39 'waiting after installed');
40 assert_equals(registration.active, null,
41 'active after installed');
42 return wait_for_state(t, registration.waiting, 'activated');
43 })
44 .then(function() {
45 assert_equals(registration.installing, null,
46 'installing after activated');
47 assert_equals(registration.waiting, null,
48 'waiting after activated');
49 assert_equals(registration.active, installing_worker,
50 'active after activated');
51 return Promise.all([
52 wait_for_state(t, registration.active, 'redundant'),
53 registration.unregister()
54 ]);
55 })
56 .then(function() {
57 assert_equals(registration.installing, null,
58 'installing after redundant');
59 assert_equals(registration.waiting, null,
60 'waiting after redundant');
61 // According to spec, Clear Registration runs Update State which is
62 // immediately followed by setting active to null, which means by the
63 // time the event loop turns and the Promise for statechange is
64 // resolved, this will be gone.
65 assert_equals(registration.active, null,
66 'active should be null after redundant');
67 });
68 }, 'installing/waiting/active after registration');
69 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698