Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/payments/payment-instruments.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/payments/payment-instruments.html b/third_party/WebKit/LayoutTests/http/tests/payments/payment-instruments.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..06cfcfd6dd2311838fef88cd790e5848503bb9c7 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/payments/payment-instruments.html |
| @@ -0,0 +1,48 @@ |
| +<!doctype html> |
| +<meta charset="utf-8"> |
| +<title>PaymentHandler: Tests for PaymentInstruments</title> |
| +<link rel="help" href="https://w3c.github.io/webpayments-payment-apps-api/#payment-instruments"> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="../../serviceworker/resources/test-helpers.js"></script> |
| +<script> |
| + |
| +promise_test(test => { |
| + var registration; |
| + var script_url = 'resources/empty-worker.js'; |
| + var scope = 'resources/'; |
| + |
| + return service_worker_unregister_and_register(test, script_url, scope) |
| + .then(r => { |
| + registration = r; |
| + return wait_for_state(test, registration.installing, 'activated'); |
| + }) |
| + .then(state => { |
| + assert_equals(state, 'activated'); |
| + return registration.paymentManager.instruments.set( |
| + 'test_key', |
| + { |
| + name: 'Visa ending ****4756', |
| + enabledMethods: ['basic-card'], |
| + capabilities: { |
| + supportedNetworks: ['visa'], |
| + supportedTypes: ['credit'] |
| + } |
| + }); |
| + }) |
| + .then(result => { |
| + assert_equals(result, undefined); |
| + return registration.paymentManager.instruments.get('test_key'); |
| + }) |
| + .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.
|
| + assert_equals(stored_instrument.name, 'Visa ending ****4756'); |
| + assert_array_equals(stored_instrument.enabledMethods, ['basic-card']); |
| + assert_object_equals(stored_instrument.capabilities, { |
| + supportedNetworks: ['visa'], |
| + supportedTypes: ['credit'] |
| + }); |
| + }) |
| + .catch(unreached_rejection(test)); |
| + }, 'PaymentInstruments set/get methods test'); |
| + |
| +</script> |