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

Side by Side Diff: chrome/test/data/android/payments/payment_request_free_shipping_test.html

Issue 2018133002: Clean up PaymentRequest integration tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!--
3 Copyright 2016 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
6 -->
2 <html> 7 <html>
3 <head> 8 <head>
4 <title>Free Shipping Test</title> 9 <title>Free Shipping Test</title>
5 <meta charset="utf-8"> 10 <meta charset="utf-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scal e=1"> 11 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scal e=1">
7 <style> 12 <link rel="stylesheet" type="text/css" href="style.css">
8 button {
9 width: 100%;
10 height: 5em;
11 font-size: 3em;
12 }
13 </style>
14 </head> 13 </head>
15 <body> 14 <body>
16 <button onclick="buy()" id="buy">Free Shipping Test</button> 15 <button onclick="buy()" id="buy">Free Shipping Test</button>
17 <script> 16 <pre id="result"></pre>
18 function print(msg) { 17 <script src="util.js"></script>
19 document.open(); 18 <script src="free_shipping.js"></script>
20 document.write('<pre id="result" style="font-size: 2em;">' + msg + '</pre>');
21 document.close();
22 }
23 function toDictionary(addr) {
24 var dict = {};
25 if (addr) {
26 dict.regionCode = addr.regionCode;
27 dict.administrativeArea = addr.administrativeArea;
28 dict.locality = addr.locality;
29 dict.dependentLocality = addr.dependentLocality;
30 dict.addressLine = addr.addressLine;
31 dict.postalCode = addr.postalCode;
32 dict.sortingCode = addr.sortingCode;
33 dict.languageCode = addr.languageCode;
34 dict.organization = addr.organization;
35 dict.recipient = addr.recipient;
36 }
37 return dict;
38 }
39 function buy() {
40 try {
41 var request = new PaymentRequest(['visa'], {
42 'items' : [ {
43 'id' : 'total',
44 'label' : 'Total',
45 'amount' : {'currency' : 'USD', 'value' : '5.00'}
46 } ],
47 'shippingOptions' : [ {
48 'id' : 'freeShippingOption',
49 'label' : 'Free global shipping',
50 'amount' : {'currency' : 'USD', 'value' : '0'}
51 } ]
52 }, {
53 'requestShipping' : true
54 });
55 request.show()
56 .then(function(resp) {
57 resp.complete(true)
58 .then(function() {
59 print(request.shippingOption + '<br>' +
60 JSON.stringify(toDictionary(request.shippingAddress),
61 undefined, 2) +
62 '<br>' + resp.methodName + '<br>' +
63 JSON.stringify(resp.details, undefined, 2));
64 })
65 .catch(function(error) { print(error.message); });
66 })
67 .catch(function(error) { print(error.message); });
68 } catch (error) {
69 print(error.message);
70 }
71 }
72 </script>
73 </body> 19 </body>
74 </html> 20 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698