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

Unified Diff: chrome/test/data/payments/shipping_address_change.js

Issue 2828913002: [Payments] Normalize Shipping Address Change on Android. (Closed)
Patch Set: Addressed comment Created 3 years, 8 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
« no previous file with comments | « chrome/test/data/payments/payment_request_shipping_address_change_test.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/payments/shipping_address_change.js
diff --git a/chrome/test/data/payments/shipping_address_change.js b/chrome/test/data/payments/shipping_address_change.js
new file mode 100644
index 0000000000000000000000000000000000000000..8bff1ff986650206e3d548b4648a5a12ba6df4a3
--- /dev/null
+++ b/chrome/test/data/payments/shipping_address_change.js
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2017 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * Launches the PaymentRequest UI that prints the shipping address received
+ * on shippingAddressChange events at the end of the transaction.
+ */
+function buy() { // eslint-disable-line no-unused-vars
+ try {
+ var details = {
+ total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}},
+ displayItems: [
+ {
+ label: 'Pending shipping price',
+ amount: {currency: 'USD', value: '0.00'},
+ pending: true
+ },
+ {
+ label: 'Subtotal',
+ amount: {currency: 'USD', value: '5.00'}
+ }
+ ]
+ };
+
+ var request = new PaymentRequest(
+ [{supportedMethods: ['visa']}], details, {requestShipping: true});
+
+ var shippingAddressChange;
+
+ request.addEventListener('shippingaddresschange', function(evt) {
+ evt.updateWith(new Promise(function(resolve) {
+ print(JSON.stringify(request.shippingAddress, undefined, 2));
+ resolve(details);
+ }));
+ });
+
+ request.show();
+ } catch (error) {
+ print(error.message);
+ }
+}
« no previous file with comments | « chrome/test/data/payments/payment_request_shipping_address_change_test.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698