Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <meta charset="utf-8"> | |
| 3 <title>PaymentHandler: Tests for PaymentInstruments</title> | |
| 4 <link rel="help" href="https://w3c.github.io/webpayments-payment-apps-api/#payme nt-instruments"> | |
| 5 <script src="../resources/testharness.js"></script> | |
| 6 <script src="../resources/testharnessreport.js"></script> | |
| 7 <script src="../../serviceworker/resources/test-helpers.js"></script> | |
| 8 <script> | |
| 9 | |
| 10 promise_test(test => { | |
| 11 var registration; | |
| 12 var script_url = 'resources/empty-worker.js'; | |
| 13 var scope = 'resources/'; | |
| 14 | |
| 15 return service_worker_unregister_and_register(test, script_url, scope) | |
| 16 .then(r => { | |
| 17 registration = r; | |
| 18 return wait_for_state(test, registration.installing, 'activated'); | |
| 19 }) | |
| 20 .then(state => { | |
| 21 assert_equals(state, 'activated'); | |
| 22 return registration.paymentManager.instruments.set( | |
| 23 'test_key', | |
| 24 { | |
| 25 name: 'Visa ending ****4756', | |
| 26 enabledMethods: ['basic-card'], | |
| 27 capabilities: { | |
| 28 supportedNetworks: ['visa'], | |
| 29 supportedTypes: ['credit'] | |
| 30 } | |
| 31 }); | |
| 32 }) | |
| 33 .then(result => { | |
| 34 assert_equals(result, undefined); | |
| 35 return registration.paymentManager.instruments.get('test_key'); | |
| 36 }) | |
| 37 .then (stored_instrument => { | |
|
please use gerrit instead
2017/04/11 21:09:38
No space between "then" and "(" to be consistent w
zino
2017/04/12 16:11:40
Done.
| |
| 38 assert_equals(stored_instrument.name, 'Visa ending ****4756'); | |
| 39 assert_array_equals(stored_instrument.enabledMethods, ['basic-card']); | |
| 40 assert_object_equals(stored_instrument.capabilities, { | |
| 41 supportedNetworks: ['visa'], | |
| 42 supportedTypes: ['credit'] | |
| 43 }); | |
| 44 }) | |
| 45 .catch(unreached_rejection(test)); | |
| 46 }, 'PaymentInstruments set/get methods test'); | |
| 47 | |
| 48 </script> | |
| OLD | NEW |