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

Unified Diff: content/test/data/payments/payment_app.js

Issue 2893823004: [Payments] Implement openWindow for service worker based payment handler (Closed)
Patch Set: rename ipc messages Created 3 years, 6 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: content/test/data/payments/payment_app.js
diff --git a/content/test/data/payments/payment_app.js b/content/test/data/payments/payment_app.js
index f6b2d38b3b58a6d59de45e71dc583df7eba156de..d91db29ea27b222d15bd1cccd5df41d82e70f6d7 100644
--- a/content/test/data/payments/payment_app.js
+++ b/content/test/data/payments/payment_app.js
@@ -21,7 +21,7 @@ self.addEventListener('paymentrequest', e => {
// SW <----- postMessage('payment_app_window_ready') ------ payment_app_window
// SW -------- postMessage('payment_app_request') --------> payment_app_window
// SW <-- postMessage({methodName: 'test', details: {}}) -- payment_app_window
- e.respondWith(new Promise(resolve => {
+ e.respondWith(new Promise((resolve, reject) => {
let payment_app_window = undefined;
let window_ready = false;
@@ -43,11 +43,18 @@ self.addEventListener('paymentrequest', e => {
}
});
- // Open a window
- clients.openWindow('payment_app_window.html')
+ // Open a window for the payment instrument.
+ var payment_app_web_page = 'payment_app_window.html';
+ if(e.instrumentKey == 'bobpay-payment-app-id') {
+ payment_app_web_page = 'https://bobpay.com';
+ }
+ e.openWindow(payment_app_web_page)
.then(window_client => {
payment_app_window = window_client;
maybeSendPaymentRequest();
})
+ .catch(error => {
+ reject(error);
+ });
}));
});

Powered by Google App Engine
This is Rietveld 408576698