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

Side by Side Diff: third_party/WebKit/LayoutTests/payments/payment-request-interface.html

Issue 2020883002: PaymentRequest: Introduce PaymentMethodData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 <meta charset="utf-8"> 2 <meta charset="utf-8">
3 <title>Tests for PaymentRequest interface</title> 3 <title>Tests for PaymentRequest interface</title>
4 <script src="../resources/testharness.js"></script> 4 <script src="../resources/testharness.js"></script>
5 <script src="../resources/testharnessreport.js"></script> 5 <script src="../resources/testharnessreport.js"></script>
6 <script> 6 <script>
7 function substitute(originalObject, substituteKeyValuePair) { 7 function substitute(originalObject, substituteKeyValuePair) {
8 for (var key in originalObject) { 8 for (var key in originalObject) {
9 if (originalObject.hasOwnProperty(key) && substituteKeyValuePair.hasOwnP roperty(key)) { 9 if (originalObject.hasOwnProperty(key) && substituteKeyValuePair.hasOwnP roperty(key)) {
10 originalObject[key] = substituteKeyValuePair[key]; 10 originalObject[key] = substituteKeyValuePair[key];
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } else { 42 } else {
43 details[detailNames[i]] = [buildItem()]; 43 details[detailNames[i]] = [buildItem()];
44 } 44 }
45 } 45 }
46 } 46 }
47 47
48 return details; 48 return details;
49 } 49 }
50 50
51 test(function() { 51 test(function() {
52 new PaymentRequest(['foo'], buildDetails(), {}, {}); 52 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {});
53 }, 'Creating a PaymentRequest with empty parameters should not throw or crash.') ; 53 }, 'Creating a PaymentRequest with empty parameters should not throw or crash.') ;
54 54
55 test(function() { 55 test(function() {
56 new PaymentRequest(['foo'], buildDetails(), {}, {}, ''); 56 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), {}, '');
57 }, 'Creating a PaymentRequest with extra parameters should not throw or crash.') ; 57 }, 'Creating a PaymentRequest with extra parameters should not throw or crash.') ;
58 58
59 test(function() { 59 test(function() {
60 new PaymentRequest(['foo'], buildDetails()); 60 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails());
61 }, 'Creating a PaymentRequest with omitted optional parameters should not throw or crash.'); 61 }, 'Creating a PaymentRequest with omitted optional parameters should not throw or crash.');
62 62
63 test(function() { 63 test(function() {
64 new PaymentRequest(['foo'], buildDetails(), undefined, undefined); 64 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), undefine d);
65 }, 'Creating a PaymentRequest with undefined optional parameters should not thro w or crash.'); 65 }, 'Creating a PaymentRequest with undefined optional parameters should not thro w or crash.');
66 66
67 test(function() { 67 test(function() {
68 new PaymentRequest(['foo'], buildDetails(), null, null); 68 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(), null);
69 }, 'Creating a PaymentRequest with null optional parameters should not throw or crash.'); 69 }, 'Creating a PaymentRequest with null optional parameters should not throw or crash.');
70 70
71 test(function() { 71 test(function() {
72 var request = new PaymentRequest(['foo'], buildDetails()); 72 var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetai ls());
73 assert_readonly(request, 'shippingAddress', 'PaymentRequest should have a re adonly shippingAddress property.'); 73 assert_readonly(request, 'shippingAddress', 'PaymentRequest should have a re adonly shippingAddress property.');
74 assert_readonly(request, 'shippingOption', 'PaymentRequest should have a rea donly shippingOption property.'); 74 assert_readonly(request, 'shippingOption', 'PaymentRequest should have a rea donly shippingOption property.');
75 }, 'PaymentRequest should have readonly shippingAddress and shippingOption prope rties.'); 75 }, 'PaymentRequest should have readonly shippingAddress and shippingOption prope rties.');
76 76
77 test(function() { 77 test(function() {
78 var request = new PaymentRequest(['foo'], buildDetails()); 78 var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetai ls());
79 assert_not_equals(request.onshippingaddresschange, undefined, 'PaymentReques t should have onShippingAddressChange event.'); 79 assert_not_equals(request.onshippingaddresschange, undefined, 'PaymentReques t should have onShippingAddressChange event.');
80 assert_not_equals(request.onshippingoptionchange, undefined, 'PaymentRequest should have onShippingOptionChange event.'); 80 assert_not_equals(request.onshippingoptionchange, undefined, 'PaymentRequest should have onShippingOptionChange event.');
81 }, 'PaymentRequest should have onShippingAddressChange and onShippingOptionChang e events.'); 81 }, 'PaymentRequest should have onShippingAddressChange and onShippingOptionChang e events.');
82 82
83 test(function() { 83 test(function() {
84 var request = new PaymentRequest(['foo'], buildDetails()); 84 var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetai ls());
85 assert_not_equals(request.abort, undefined, 'PaymentRequest should have abor t() method.'); 85 assert_not_equals(request.abort, undefined, 'PaymentRequest should have abor t() method.');
86 assert_not_equals(request.show, undefined, 'PaymentRequest should have show( ) method.'); 86 assert_not_equals(request.show, undefined, 'PaymentRequest should have show( ) method.');
87 }, 'PaymentRequest should have methods abort() and show().'); 87 }, 'PaymentRequest should have methods abort() and show().');
88 88
89 test(function() { 89 test(function() {
90 var request = new PaymentRequest(['foo'], buildDetails()); 90 var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetai ls());
91 request.show(); 91 request.show();
92 request.abort(); 92 request.abort();
93 }, 'PaymentRequest.abort() and PaymentRequest.show() should take no parameters.' ); 93 }, 'PaymentRequest.abort() and PaymentRequest.show() should take no parameters.' );
94 94
95 test(function() { 95 test(function() {
96 var request = new PaymentRequest(['foo'], buildDetails(), {'requestShipping' : true}, {'foo': {'gateway': 'bar'}}); 96 var request = new PaymentRequest([{'supportedMethods': ['foo'], 'data': {'fo o': {'gateway': 'bar'}}}], buildDetails(), {'requestShipping': true});
97 request.show(); 97 request.show();
98 request.abort(); 98 request.abort();
99 }, 'Valid data causes no errors.'); 99 }, 'Valid data causes no errors.');
100 100
101 test(function() { 101 test(function() {
102 var request = new PaymentRequest(['foo'], buildDetails('shippingOptions', {' id': 'standard'})); 102 var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetai ls('shippingOptions', {'id': 'standard'}));
103 assert_equals(null, request.shippingOption); 103 assert_equals(null, request.shippingOption);
104 }, 'Shipping option identifier should be null if shipping request is omitted.'); 104 }, 'Shipping option identifier should be null if shipping request is omitted.');
105 105
106 test(function() { 106 test(function() {
107 var request = new PaymentRequest(['foo'], buildDetails('shippingOptions', {' id': 'standard'}), {'requestShipping': false}); 107 var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetai ls('shippingOptions', {'id': 'standard'}), {'requestShipping': false});
108 assert_equals(null, request.shippingOption); 108 assert_equals(null, request.shippingOption);
109 }, 'Shipping option identifier should be null if shipping is explicitly not requ ested.'); 109 }, 'Shipping option identifier should be null if shipping is explicitly not requ ested.');
110 110
111 test(function() { 111 test(function() {
112 var request = new PaymentRequest(['foo'], buildDetails('shippingOptions', {' id': 'standard'}), {'requestShipping': true}); 112 var request = new PaymentRequest([{'supportedMethods': ['foo']}], buildDetai ls('shippingOptions', {'id': 'standard'}), {'requestShipping': true});
113 assert_equals('standard', request.shippingOption); 113 assert_equals('standard', request.shippingOption);
114 }, 'Shipping option identifier should default to the single provided option.'); 114 }, 'Shipping option identifier should default to the single provided option.');
115 115
116 test(function() { 116 test(function() {
117 var request = new PaymentRequest(['foo'], {'total': buildItem(), 'displayIte ms': [buildItem()]}, {'requestShipping': true}); 117 var request = new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'displayItems': [buildItem()]}, {'requestShipping': true});
118 assert_equals(null, request.shippingOption); 118 assert_equals(null, request.shippingOption);
119 }, 'Shipping option identifier should be null when no shipping options are provi ded.'); 119 }, 'Shipping option identifier should be null when no shipping options are provi ded.');
120 120
121 test(function() { 121 test(function() {
122 var request = new PaymentRequest(['foo'], {'total': buildItem(), 'displayIte ms': [buildItem()], 'shippingOptions': [buildItem({'id': 'standard'}), buildItem ({'id': 'express'})]}, {'requestShipping': true}); 122 var request = new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), 'displayItems': [buildItem()], 'shippingOptions': [buildItem({'id': 'standard'}), buildItem({'id': 'express'})]}, {'requestShipping': true});
123 assert_equals(null, request.shippingOption); 123 assert_equals(null, request.shippingOption);
124 }, 'Shipping option identifier should be null at first when multiple shipping op tions are provided.'); 124 }, 'Shipping option identifier should be null at first when multiple shipping op tions are provided.');
125 125
126 test(function() { 126 test(function() {
127 new PaymentRequest(['foo'], {'total': buildItem(), 'displayItems': undefined }); 127 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), ' displayItems': undefined});
128 }, 'Undefined display items should not throw.'); 128 }, 'Undefined display items should not throw.');
129 129
130 test(function() { 130 test(function() {
131 new PaymentRequest(['foo'], {'total': buildItem(), 'displayItems': []}); 131 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem(), ' displayItems': []});
132 }, 'Empty display items should not throw.'); 132 }, 'Empty display items should not throw.');
133 133
134 test(function() { 134 test(function() {
135 new PaymentRequest(['foo'], buildDetails('total', {'value': '0'})); 135 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails('total', {' value': '0'}));
136 }, 'Non-negative total value should not throw.'); 136 }, 'Non-negative total value should not throw.');
137 137
138 test(function() { 138 test(function() {
139 assert_throws(new TypeError(), function() { 139 assert_throws(new TypeError(), function() {
140 new PaymentRequest(['foo'], buildDetails('total', {'value': '-0.01'})); 140 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails('total' , {'value': '-0.01'}));
141 }); 141 });
142 }, 'Negative total value should throw a TypeError.'); 142 }, 'Negative total value should throw a TypeError.');
143 143
144 test(function() { 144 test(function() {
145 new PaymentRequest(['foo'], buildDetails('displayItems', {'value': '-0.01'}) ); 145 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails('displayIte ms', {'value': '-0.01'}));
146 }, 'Negative line item value should not throw.'); 146 }, 'Negative line item value should not throw.');
147 147
148 test(function() { 148 test(function() {
149 assert_throws(new TypeError(), function() { 149 assert_throws(new TypeError(), function() {
150 new PaymentRequest(['foo'], {'displayItems': [buildItem()]}); 150 new PaymentRequest([{'supportedMethods': ['foo']}], {'displayItems': [bu ildItem()]});
151 }); 151 });
152 }, 'Absence of total should throw TypeError.'); 152 }, 'Absence of total should throw TypeError.');
153 153
154 generate_tests(assert_throws, [ 154 generate_tests(assert_throws, [
155 ['PaymentRequest constructor should throw for incorrect parameter types.', n ull, function() { 155 ['PaymentRequest constructor should throw for incorrect parameter types.', n ull, function() {
156 new PaymentRequest('', '', '', '') 156 new PaymentRequest('', '', '')
157 }], 157 }],
158 ['PaymentRequest constructor should throw for undefined required parameters. ', null, function() { 158 ['PaymentRequest constructor should throw for undefined required parameters. ', null, function() {
159 new PaymentRequest(undefined, undefined) 159 new PaymentRequest(undefined, undefined)
160 }], 160 }],
161 ['PaymentRequest constructor should throw for null required parameter.', nul l, function() { 161 ['PaymentRequest constructor should throw for null required parameter.', nul l, function() {
162 new PaymentRequest(null, null) 162 new PaymentRequest(null, null)
163 }], 163 }],
164 ['Empty list of supported payment method identifiers should throw TypeError. ', new TypeError(), function() { 164 ['Empty list of supported payment method identifiers should throw TypeError. ', new TypeError(), function() {
165 new PaymentRequest([], buildDetails()) 165 new PaymentRequest([], buildDetails())
166 }], 166 }],
167 ['Keys in payment method specific data object should match accepted method i dentifiers.', null, function() {
168 new PaymentRequest(['foo'], buildDetails(), {}, {'bar': {'gateway': 'baz '}})
169 }],
170 ['Empty details should throw', null, function() { 167 ['Empty details should throw', null, function() {
171 new PaymentRequest(['foo'], {}) 168 new PaymentRequest([{'supportedMethods': ['foo']}], {})
172 }], 169 }],
173 ['Null items should throw', new TypeError(), function() { 170 ['Null items should throw', new TypeError(), function() {
174 new PaymentRequest(['foo'], {'total': buildItem(), 'displayItems': null} ); 171 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'displayItems': null});
175 }], 172 }],
176 ['Null shipping options should throw', new TypeError(), function() { 173 ['Null shipping options should throw', new TypeError(), function() {
177 new PaymentRequest(['foo'], {'total': buildItem(), 'displayItems': [buil dItem()], 'shippingOptions': null}); 174 new PaymentRequest([{'supportedMethods': ['foo']}], {'total': buildItem( ), 'displayItems': [buildItem()], 'shippingOptions': null});
175 ['Empty items should throw', null, function() {
176 new PaymentRequest([{'supportedMethods': ['foo']}], {'displayItems': []} )
178 }], 177 }],
179 ['Aborting before showing should throw.', null, function() { 178 ['Aborting before showing should throw.', null, function() {
180 new PaymentRequest(['foo'], buildDetails()).abort() 179 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails()).abor t()
181 }], 180 }],
182 181
183 // Payment method specific data should be a JSON-serializable object. 182 // Payment method specific data should be a JSON-serializable object.
184 ['Array value for payment method specific data parameter should throw', null , function() { 183 ['Array value for payment method specific data parameter should throw', null , function() {
185 new PaymentRequest(['foo'], buildDetails(), {}, []) 184 new PaymentRequest([{'supportedMethods': ['foo'], 'data': []}], buildDet ails())
186 }], 185 }],
187 ['String value for payment method specific data parameter should throw', nul l, function() { 186 ['String value for payment method specific data parameter should throw', nul l, function() {
188 new PaymentRequest(['foo'], buildDetails(), {}, 'foo') 187 new PaymentRequest([{'supportedMethods': ['foo'], 'data': 'foo'}], build Details())
189 }], 188 }],
190 ['Numeric value for payment method specific data parameter should throw', nu ll, function() { 189 ['Numeric value for payment method specific data parameter should throw', nu ll, function() {
191 new PaymentRequest(['foo'], buildDetails(), {}, 42) 190 new PaymentRequest([{'supportedMethods': ['foo'], 'data': 42}], buildDet ails())
192 }], 191 }],
193 ['Infinite JSON value for one of the payment method specific data pieces sho uld throw', null, function() { 192 ['Infinite JSON value for one of the payment method specific data pieces sho uld throw', null, function() {
194 var infiniteData = {'foo': {}}; 193 var infiniteData = {'foo': {}};
195 infiniteData.foo = infiniteData; 194 infiniteData.foo = infiniteData;
196 new PaymentRequest(['foo'], buildDetails(), {}, infiniteData) 195 new PaymentRequest([{'supportedMethods': ['foo'], 'data': infiniteData}] , buildDetails())
197 }], 196 }],
198 197 ['Null for payment method specific data parameter should throw', null, funct ion() {
199 // Values in payment method specific data object should be JSON-serializable objects. 198 new PaymentRequest([{'supportedMethods': ['foo'], 'data': null}], buildD etails())
200 ['Array value for one of the payment method specific data pieces should thro w', null, function() {
201 new PaymentRequest(['foo'], buildDetails(), {}, {'foo': []})
202 }], 199 }],
203 ['String value for one of the payment method specific data pieces should thr ow', null, function() { 200 ['Empty string for payment method specific data parameter should throw', nul l, function() {
204 new PaymentRequest(['foo'], buildDetails(), {}, {'foo': 'bar'}) 201 new PaymentRequest([{'supportedMethods': ['foo'], 'data': ''}], buildDet ails())
205 }], 202 }]
206 ['Numeric value for one of the payment method specific data pieces should th row', null, function() {
207 new PaymentRequest(['foo'], buildDetails(), {}, {'foo': 42})
208 }],
209 ]); 203 ]);
210 204
211 var detailNames = ['total', 'displayItems', 'shippingOptions']; 205 var detailNames = ['total', 'displayItems', 'shippingOptions'];
212 for (var i in detailNames) { 206 for (var i in detailNames) {
213 generate_tests(assert_throws, [ 207 generate_tests(assert_throws, [
214 // Invalid currency code formats. 208 // Invalid currency code formats.
215 ['Invalid currency code US1 should throw', null, function() { 209 ['Invalid currency code US1 should throw', null, function() {
216 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency' : 'US1'})) 210 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': 'US1'}))
217 }], 211 }],
218 ['Invalid currency code US should throw', null, function() { 212 ['Invalid currency code US should throw', null, function() {
219 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency' : 'US'})) 213 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': 'US'}))
220 }], 214 }],
221 ['Invalid currency code USDO should throw', null, function() { 215 ['Invalid currency code USDO should throw', null, function() {
222 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency' : 'USDO'})) 216 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': 'USDO'}))
223 }], 217 }],
224 ['Invalid currency code usd should throw', null, function() { 218 ['Invalid currency code usd should throw', null, function() {
225 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency' : 'usd'})) 219 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': 'usd'}))
226 }], 220 }],
227 ['Empty currency code should throw', null, function() { 221 ['Empty currency code should throw', null, function() {
228 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency' : ''})) 222 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': ''}))
229 }], 223 }],
230 ['Null currency code should throw', null, function() { 224 ['Null currency code should throw', null, function() {
231 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency' : null})) 225 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': null}))
232 }], 226 }],
233 ['Undefined currency code should throw', null, function() { 227 ['Undefined currency code should throw', null, function() {
234 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'currency' : undefined})) 228 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'currency': undefined}))
235 }], 229 }],
236 230
237 // Invalid amount formats. 231 // Invalid amount formats.
238 ['Invalid amount "-" should throw', null, function() { 232 ['Invalid amount "-" should throw', null, function() {
239 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': ' -'})) 233 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-'}))
240 }], 234 }],
241 ['Invalid amount "notdigits" should throw', null, function() { 235 ['Invalid amount "notdigits" should throw', null, function() {
242 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': ' notdigits'})) 236 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': 'notdigits'}))
243 }], 237 }],
244 ['Invalid amount "ALSONOTDIGITS" should throw', null, function() { 238 ['Invalid amount "ALSONOTDIGITS" should throw', null, function() {
245 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': ' ALSONOTDIGITS'})) 239 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': 'ALSONOTDIGITS'}))
246 }], 240 }],
247 ['Invalid amount "10." should throw', null, function() { 241 ['Invalid amount "10." should throw', null, function() {
248 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': ' 10.'})) 242 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '10.'}))
249 }], 243 }],
250 ['Invalid amount ".99" should throw', null, function() { 244 ['Invalid amount ".99" should throw', null, function() {
251 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': ' .99'})) 245 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '.99'}))
252 }], 246 }],
253 ['Invalid amount "-10." should throw', null, function() { 247 ['Invalid amount "-10." should throw', null, function() {
254 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': ' -10.'})) 248 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-10.'}))
255 }], 249 }],
256 ['Invalid amount "-.99" should throw', null, function() { 250 ['Invalid amount "-.99" should throw', null, function() {
257 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': ' -.99'})) 251 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '-.99'}))
258 }], 252 }],
259 ['Invalid amount "10-" should throw', null, function() { 253 ['Invalid amount "10-" should throw', null, function() {
260 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': ' 10-'})) 254 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '10-'}))
261 }], 255 }],
262 ['Invalid amount "1-0" should throw', null, function() { 256 ['Invalid amount "1-0" should throw', null, function() {
263 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': ' 1-0'})) 257 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1-0'}))
264 }], 258 }],
265 ['Invalid amount "1.0.0" should throw', null, function() { 259 ['Invalid amount "1.0.0" should throw', null, function() {
266 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': ' 1.0.0'})) 260 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1.0.0'}))
267 }], 261 }],
268 ['Invalid amount "1/3" should throw', null, function() { 262 ['Invalid amount "1/3" should throw', null, function() {
269 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': ' 1/3'})) 263 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': '1/3'}))
270 }], 264 }],
271 ['Empty amount should throw', null, function() { 265 ['Empty amount should throw', null, function() {
272 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': ' '})) 266 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': ''}))
273 }], 267 }],
274 ['Null amount should throw', null, function() { 268 ['Null amount should throw', null, function() {
275 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': n ull})) 269 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': null}))
276 }], 270 }],
277 ['Undefined amount should throw', null, function() { 271 ['Undefined amount should throw', null, function() {
278 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': u ndefined})) 272 new PaymentRequest([{'supportedMethods': ['foo']}], buildDetails(det ailNames[i], {'value': undefined}))
279 }], 273 }],
280 ]); 274 ]);
281 } 275 }
282 </script> 276 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698