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

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

Issue 2887713002: PaymentHandler: Merge PaymentAppRequest and PaymentRequestEvent. (Closed)
Patch Set: PaymentHandler: Merge PaymentAppRequest and PaymentRequestEvent. Created 3 years, 7 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 ce0246420a7d16d230adb2c358fdc5a69ff162b9..9cb0fd08bc9dd846da4a794f76e40ad15756cc29 100644
--- a/content/test/data/payments/payment_app.js
+++ b/content/test/data/payments/payment_app.js
@@ -2,7 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+function sendResultToTest(data) {
+ clients.matchAll({includeUncontrolled: true}).then(clients => {
+ clients.forEach(client => {
+ if (client.url.indexOf('payment_app_invocation.html') != -1) {
+ client.postMessage(data);
+ }
+ });
+ });
+}
+
self.addEventListener('paymentrequest', e => {
+ sendResultToTest(e.topLevelOrigin);
+ sendResultToTest(e.paymentRequestOrigin);
+ sendResultToTest(e.paymentRequestId);
+ sendResultToTest(JSON.stringify(e.methodData));
+ sendResultToTest(JSON.stringify(e.total));
+ sendResultToTest(JSON.stringify(e.modifiers));
+ sendResultToTest(e.instrumentKey);
nhiroki 2017/05/21 23:41:40 sendResultToTest()s run async operations, so we ma
zino 2017/05/23 14:51:29 Done.
+
// SW -------------------- openWindow() ------------------> payment_app_window
// SW <----- postMessage('payment_app_window_ready') ------ payment_app_window
// SW -------- postMessage('payment_app_request') --------> payment_app_window

Powered by Google App Engine
This is Rietveld 408576698