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

Side by Side Diff: LayoutTests/http/tests/serviceworker/install-phase-event-waituntil.html

Issue 517223002: ServiceWorker: Tweak layout tests based on the latest install sequence (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 3 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>InstallPhaseEvent: waitUntil</title> 2 <title>InstallPhaseEvent: waitUntil</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> 6 <script>
7 // Temporary measure to diagnose timeouts on Win XP. Let the W3C harness 7 // Temporary measure to diagnose timeouts on Win XP. Let the W3C harness
8 // timeout before run-webkit-tests does, so it can report the particular 8 // timeout before run-webkit-tests does, so it can report the particular
9 // test that timed out. 9 // test that timed out.
10 // FIXME: Remove after the cause of timeout is fixed. 10 // FIXME: Remove after the cause of timeout is fixed.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 channel.port1.postMessage('ACK'); 45 channel.port1.postMessage('ACK');
46 }); 46 });
47 worker.postMessage({port: channel.port2}, [channel.port2]); 47 worker.postMessage({port: channel.port2}, [channel.port2]);
48 } 48 }
49 49
50 async_test(function(t) { 50 async_test(function(t) {
51 // Passing scope as the test switch for worker script. 51 // Passing scope as the test switch for worker script.
52 var scope = 'install-fulfilled'; 52 var scope = 'install-fulfilled';
53 var onRegister = function(worker) { 53 var onRegister = function(worker) {
54 var obj = {}; 54 var obj = {};
55 assert_equals(worker.state,
56 'installing',
57 'Should be in the "installing" state upon updatefound');
55 worker.onstatechange = t.step_func(function() { 58 worker.onstatechange = t.step_func(function() {
56 if (worker.state == 'installing') { 59 if (worker.state == 'installed') {
57 syncWorker(t, worker, obj);
58 } else if (worker.state == 'installed') {
59 assert_true( 60 assert_true(
60 obj.synced, 61 obj.synced,
61 'state should be "installed" after the waitUntil promise ' + 62 'state should be "installed" after the waitUntil promise ' +
62 'for "oninstall" is fulfilled.'); 63 'for "oninstall" is fulfilled.');
63 service_worker_unregister_and_done(t, scope); 64 service_worker_unregister_and_done(t, scope);
64 } 65 }
65 }); 66 });
67 syncWorker(t, worker, obj);
66 }; 68 };
67 runTest(t, scope, onRegister); 69 runTest(t, scope, onRegister);
68 }, 'Test install event waitUntil fulfilled', properties); 70 }, 'Test install event waitUntil fulfilled', properties);
69 71
70 async_test(function(t) { 72 async_test(function(t) {
71 var scope = 'activate-fulfilled'; 73 var scope = 'activate-fulfilled';
72 var onRegister = function(worker) { 74 var onRegister = function(worker) {
73 var obj = {}; 75 var obj = {};
74 worker.onstatechange = t.step_func(function() { 76 worker.onstatechange = t.step_func(function() {
75 if (worker.state == 'activating') { 77 if (worker.state == 'activating') {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 var scope = 'activate-reject-precedence'; 135 var scope = 'activate-reject-precedence';
134 var onRegister = function(worker) { 136 var onRegister = function(worker) {
135 worker.onstatechange = t.step_func(function() { 137 worker.onstatechange = t.step_func(function() {
136 if (worker.state == 'redundant') 138 if (worker.state == 'redundant')
137 service_worker_unregister_and_done(t, scope); 139 service_worker_unregister_and_done(t, scope);
138 }); 140 });
139 }; 141 };
140 runTest(t, scope, onRegister); 142 runTest(t, scope, onRegister);
141 }, 'Test InstallPhaseEvent waitUntil reject precedence.', properties); 143 }, 'Test InstallPhaseEvent waitUntil reject precedence.', properties);
142 </script> 144 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698