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 caa6ea7d6deccafdc857bb7db4c367ff4b15fa9f..29f9f35da252834ac25175642ac5fb8a278d7006 100644 |
--- a/LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
+++ b/LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
@@ -246,3 +246,21 @@ function get_host_info() { |
function base_path() { |
return location.pathname.replace(/\/[^\/]*$/, '/'); |
} |
+ |
+function test_login(test, origin, username, password) { |
+ return new Promise(function(resolve, reject) { |
+ with_iframe( |
+ origin + base_path() + |
+ 'resources/fetch-access-control-login.html') |
+ .then(test.step_func(function(frame) { |
+ var channel = new MessageChannel(); |
+ channel.port1.onmessage = test.step_func(function() { |
+ unload_iframe(frame); |
+ resolve(); |
+ }); |
+ frame.contentWindow.postMessage( |
+ {username: username, password: password}, |
+ [channel.port2], origin); |
+ })); |
+ }); |
+} |