Index: chrome/test/data/android/payments/payment_request_need_address_test.html |
diff --git a/chrome/test/data/android/payments/payment_request_free_shipping_test.html b/chrome/test/data/android/payments/payment_request_need_address_test.html |
similarity index 75% |
copy from chrome/test/data/android/payments/payment_request_free_shipping_test.html |
copy to chrome/test/data/android/payments/payment_request_need_address_test.html |
index a7ca1fb5e025cc6a335775079b14240db5a1e803..6d1b7d563a7c5b5fa3be6bd239937ec52cac989c 100644 |
--- a/chrome/test/data/android/payments/payment_request_free_shipping_test.html |
+++ b/chrome/test/data/android/payments/payment_request_need_address_test.html |
@@ -25,19 +25,25 @@ function toDictionary(addr) { |
} |
function buy() { |
try { |
- var request = new PaymentRequest(['visa'], { |
+ var details = { |
'items' : [ { |
'id' : 'total', |
'label' : 'Total', |
'amount' : {'currencyCode' : 'USD', 'value' : '5.00'} |
- } ], |
- 'shippingOptions' : [ { |
- 'id' : 'freeShippingOption', |
- 'label' : 'Free global shipping', |
- 'amount' : {'currencyCode' : 'USD', 'value' : '0'} |
} ] |
- }, |
- {'requestShipping' : true}); |
+ }; |
+ var request = |
+ new PaymentRequest(['visa'], details, {'requestShipping' : true}); |
+ request.addEventListener("shippingaddresschange", function(e) { |
+ e.updateWith(new Promise(function(resolve, reject) { |
+ details['shippingOptions'] = [ { |
+ 'id' : 'calculatedShippingOption', |
+ 'label' : 'Standard shipping', |
+ 'amount' : {'currencyCode' : 'USD', 'value' : '1.00'} |
+ } ]; |
+ resolve(details); |
+ })); |
+ }); |
request.show() |
.then(function(resp) { |
resp.complete(true) |