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

Unified Diff: LayoutTests/http/tests/navigatorconnect/resources/async-connect-worker.js

Issue 1210633002: Update navigator.services API to use the new services.onconnect event [1/3]. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@serviceport-part3
Patch Set: rebase Created 5 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/navigatorconnect/resources/async-connect-worker.js
diff --git a/LayoutTests/http/tests/navigatorconnect/resources/async-connect-worker.js b/LayoutTests/http/tests/navigatorconnect/resources/async-connect-worker.js
index 8e3627a670cde78e701b36ce611ac03cb6f08a6d..636966f72f9dddbff7c100134aa56cbe8c2fa5dc 100644
--- a/LayoutTests/http/tests/navigatorconnect/resources/async-connect-worker.js
+++ b/LayoutTests/http/tests/navigatorconnect/resources/async-connect-worker.js
@@ -7,3 +7,13 @@ self.addEventListener('crossoriginconnect', function(event) {
self.setTimeout(reject, 1);
}));
});
+
+navigator.services.addEventListener('connect', function(event) {
+ var targetUrl = new URL(event.targetURL);
+ event.respondWith(new Promise(function(resolve, reject) {
+ if (targetUrl.search == "?accept")
+ self.setTimeout(resolve, 1, {accept: true});
+ else
+ self.setTimeout(reject, 1);
+ }));
+});

Powered by Google App Engine
This is Rietveld 408576698