Chromium Code Reviews| Index: LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
| diff --git a/LayoutTests/http/tests/serviceworker/resources/test-helpers.js b/LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
| index 2ded3ec4e0e0c01b29a6b358a4dd32b1acf4ec4b..fc76190b2285b93d4eb2c2876d232344291fc703 100644 |
| --- a/LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
| +++ b/LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
| @@ -64,3 +64,12 @@ function with_iframe(url, f) { |
| function normalizeURL(url) { |
| return new URL(url, document.location).toString().replace(/#.*$/, ''); |
| } |
| + |
| +function wait_for_state(test, worker, state) { |
| + 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
|
| + worker.addEventListener('statechange', test.step_func(function() { |
| + if (worker.state === state) |
| + resolve(state); |
| + })); |
| + })); |
| +} |