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

Side by Side Diff: LayoutTests/http/tests/serviceworker/resources/test-helpers.js

Issue 362123003: ServiceWorker: unregister's scope argument should be optional (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rework test Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Adapter for testharness.js-style tests with Service Workers 1 // Adapter for testharness.js-style tests with Service Workers
2 2
3 function service_worker_test(url, description) { 3 function service_worker_test(url, description) {
4 var t = async_test(description); 4 var t = async_test(description);
5 t.step(function() { 5 t.step(function() {
6 var scope = 'nonexistent'; 6 var scope = 'nonexistent';
7 service_worker_unregister_and_register(t, url, scope).then(t.step_func(o nRegistered)); 7 service_worker_unregister_and_register(t, url, scope).then(t.step_func(o nRegistered));
8 8
9 function onRegistered(worker) { 9 function onRegistered(worker) {
10 var messageChannel = new MessageChannel(); 10 var messageChannel = new MessageChannel();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 resolve(frame); 58 resolve(frame);
59 }; 59 };
60 document.body.appendChild(frame); 60 document.body.appendChild(frame);
61 }); 61 });
62 } 62 }
63 63
64 function normalizeURL(url) { 64 function normalizeURL(url) {
65 return new URL(url, document.location).toString().replace(/#.*$/, ''); 65 return new URL(url, document.location).toString().replace(/#.*$/, '');
66 } 66 }
67
68 function wait_for_state(test, worker, state) {
69 return new Promise(test.step_func(function(resolve, reject) {
dominicc (has gone to gerrit) 2014/07/03 04:44:35 Would the test fail more quickly/incisively if you
jsbell 2014/07/03 05:16:13 That would imply encoding the valid state transiti
70 worker.addEventListener('statechange', test.step_func(function() {
71 if (worker.state === state)
72 resolve(state);
73 }));
74 }));
75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698