| OLD | NEW |
| 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 21 matching lines...) Expand all Loading... |
| 32 details[detailNames[i]] = [buildItem(optionalSubstituteKeyValuePair)
]; | 32 details[detailNames[i]] = [buildItem(optionalSubstituteKeyValuePair)
]; |
| 33 } else { | 33 } else { |
| 34 details[detailNames[i]] = [buildItem()]; | 34 details[detailNames[i]] = [buildItem()]; |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 return details; | 38 return details; |
| 39 } | 39 } |
| 40 | 40 |
| 41 test(function() { | 41 test(function() { |
| 42 assert_exists(window, 'PaymentAddress'); |
| 43 assert_exists(window, 'PaymentRequest'); |
| 44 assert_exists(window, 'PaymentRequestUpdateEvent'); |
| 45 assert_exists(window, 'PaymentResponse'); |
| 46 }, 'Checks whether payment related interfaces are defined.'); |
| 47 |
| 48 test(function() { |
| 42 new PaymentRequest(['foo'], buildDetails(), {}, {}); | 49 new PaymentRequest(['foo'], buildDetails(), {}, {}); |
| 43 }, 'Creating a PaymentRequest with empty parameters should not throw or crash.')
; | 50 }, 'Creating a PaymentRequest with empty parameters should not throw or crash.')
; |
| 44 | 51 |
| 45 test(function() { | 52 test(function() { |
| 46 new PaymentRequest(['foo'], buildDetails(), {}, {}, ''); | 53 new PaymentRequest(['foo'], buildDetails(), {}, {}, ''); |
| 47 }, 'Creating a PaymentRequest with extra parameters should not throw or crash.')
; | 54 }, 'Creating a PaymentRequest with extra parameters should not throw or crash.')
; |
| 48 | 55 |
| 49 test(function() { | 56 test(function() { |
| 50 new PaymentRequest(['foo'], buildDetails()); | 57 new PaymentRequest(['foo'], buildDetails()); |
| 51 }, 'Creating a PaymentRequest with omitted optional parameters should not throw
or crash.'); | 58 }, 'Creating a PaymentRequest with omitted optional parameters should not throw
or crash.'); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 }], | 240 }], |
| 234 ['Null amount should throw', null, function() { | 241 ['Null amount should throw', null, function() { |
| 235 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': n
ull})) | 242 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': n
ull})) |
| 236 }], | 243 }], |
| 237 ['Undefined amount should throw', null, function() { | 244 ['Undefined amount should throw', null, function() { |
| 238 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': u
ndefined})) | 245 new PaymentRequest(['foo'], buildDetails(detailNames[i], {'value': u
ndefined})) |
| 239 }], | 246 }], |
| 240 ]); | 247 ]); |
| 241 } | 248 } |
| 242 </script> | 249 </script> |
| OLD | NEW |