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 2a8e7122565b9f9b7ed39d424b7d3f284bc56c5f..9c74737a70e92a4fc26007029e3212140c621eb7 100644 |
| --- a/LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
| +++ b/LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
| @@ -65,6 +65,23 @@ function with_sandboxed_iframe(url, sandbox) { |
| }); |
| } |
| +// Creates a new popup window, returning a Promise that resolves to its global |
| +// scope. |
| +var with_popup = function(url) { |
|
nhiroki
2015/08/19 08:01:13
This looks no longer necessary.
jeremyarcher
2015/08/19 08:36:52
Done.
|
| + return new Promise(function(resolve, reject) { |
| + var win = window.open(url); |
| + var interval = setInterval(function() { |
| + if (win.location.href.startsWith("http")) { |
| + clearInterval(interval); |
| + setTimeout(function() { |
| + resolve(win); |
| + }, 10); |
| + } |
| + }, 20); |
| + }); |
| +} |
| + |
| + |
| function normalizeURL(url) { |
| return new URL(url, self.location).toString().replace(/#.*$/, ''); |
| } |