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

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

Issue 1177563005: ServiceWorker: Implement ServiceWorkerRegistration.update() (3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@implement_update_1
Patch Set: 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>
falken 2015/06/10 04:14:39 <title>
nhiroki 2015/06/10 06:47:21 Done.
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/update';
8 var worker_url = 'resources/update-worker.php';
9 var expected_url = normalizeURL(worker_url);
10 var registration;
11
12 service_worker_unregister_and_register(t, worker_url, scope)
13 .then(function(r) {
14 registration = r;
15 return wait_for_state(t, registration.installing, 'activated');
16 })
17 .then(function() {
18 assert_equals(registration.installing, null,
19 'installing should be null in the initial state');
20 assert_equals(registration.waiting, null,
21 'waiting should be null in the initial state');
22 assert_equals(registration.active.scriptURL, expected_url,
23 'active should exist in the initial state');
24
25 // A new worker should be found.
26 registration.update();
27 return wait_for_update(t, registration);
28 })
29 .then(function() {
30 assert_equals(registration.installing.scriptURL, expected_url,
31 'new installing should be set after updatefound');
32 assert_equals(registration.waiting, null,
33 'waiting should still be null after updatefound');
34 assert_equals(registration.active.scriptURL, expected_url,
35 'active should still exist after update found');
36 return wait_for_state(t, registration.installing, 'installed');
37 })
38 .then(function() {
39 assert_equals(registration.installing, null,
40 'installing should be null after installing');
41 assert_equals(registration.waiting.scriptURL, expected_url,
42 'waiting should be set after installing');
43 assert_equals(registration.active.scriptURL, expected_url,
44 'active should still exist after installing');
45 return wait_for_state(t, registration.waiting, 'activated');
46 })
47 .then(function() {
48 assert_equals(registration.installing, null,
49 'installing should be null after activated');
50 assert_equals(registration.waiting, null,
51 'waiting should be null after activated');
52 assert_equals(registration.active.scriptURL, expected_url,
53 'new worker should be promoted to active');
54 t.done();
55 })
56 }, 'Update a registration');
57 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698