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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/skip-waiting.html

Issue 2900183002: Upstream service wrkr "skipWaiting" tests to WPT (Closed)
Patch Set: Improve assertion message Created 3 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 <title>Service Worker: Skip waiting</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script>
6 <script>
7
8 promise_test(function(t) {
9 var scope = 'resources/blank.html';
10 var url1 = 'resources/empty.js';
11 var url2 = 'resources/empty-worker.js';
12 var url3 = 'resources/skip-waiting-worker.js';
13 var frame, sw_registration, activated_worker, waiting_worker;
14 return service_worker_unregister_and_register(t, url1, scope)
15 .then(function(registration) {
16 sw_registration = registration;
17 return wait_for_state(t, registration.installing, 'activated');
18 })
19 .then(function() {
20 return with_iframe(scope);
21 })
22 .then(function(f) {
23 frame = f;
24 return navigator.serviceWorker.register(url2, {scope: scope});
25 })
26 .then(function(registration) {
27 return wait_for_state(t, registration.installing, 'installed');
28 })
29 .then(function() {
30 activated_worker = sw_registration.active;
31 waiting_worker = sw_registration.waiting;
32 assert_equals(activated_worker.scriptURL, normalizeURL(url1),
33 'Worker with url1 should be activated');
34 assert_equals(waiting_worker.scriptURL, normalizeURL(url2),
35 'Worker with url2 should be waiting');
36 return navigator.serviceWorker.register(url3, {scope: scope});
37 })
38 .then(function(registration) {
39 return wait_for_state(t, registration.installing, 'activated');
40 })
41 .then(function() {
42 assert_equals(activated_worker.state, 'redundant',
43 'Worker with url1 should be redundant');
44 assert_equals(waiting_worker.state, 'redundant',
45 'Worker with url2 should be redundant');
46 assert_equals(sw_registration.active.scriptURL, normalizeURL(url3),
47 'Worker with url3 should be activated');
48 frame.remove();
49 return service_worker_unregister_and_done(t, scope);
50 });
51 }, 'Test skipWaiting with both active and waiting workers');
52
53 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698