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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/payments/payment-instruments.html

Issue 2856973002: PaymentHandler: Implement PaymentInstruments.clear(). (Closed)
Patch Set: PaymentHandler: Implement PaymentInstruments.clear(). Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
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
index 8b2c06bf9ea8da198c49ac2140b444fdbe99689e..1e01ca6bc6a570f056af6e306e4d658db93a7645 100644
--- a/third_party/WebKit/LayoutTests/http/tests/payments/payment-instruments.html
+++ b/third_party/WebKit/LayoutTests/http/tests/payments/payment-instruments.html
@@ -161,4 +161,54 @@ promise_test(test => {
.catch(unreached_rejection(test));
}, 'PaymentInstruments |keys| method test');
+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');
+ var instruments = [
+ registration.paymentManager.instruments.set(
+ 'test_key1',
+ {
+ name: 'Visa ending ****4756',
+ enabledMethods: ['basic-card'],
+ capabilities: {
+ supportedNetworks: ['visa'],
+ supportedTypes: ['credit']
+ }
+ }),
+ registration.paymentManager.instruments.set(
+ 'test_key2',
+ {
+ name: "My Bob Pay Account: john@example.com",
+ enabledMethods: ["https://bobpay.com/"]
+ })
+ ];
+ return Promise.all(instruments);
+ })
+ .then(result => {
+ assert_array_equals(result, [undefined, undefined]);
+ return registration.paymentManager.instruments.keys();
+ })
+ .then(result => {
+ assert_equals(result.length, 2);
+ return registration.paymentManager.instruments.clear();
+ })
+ .then(result => {
+ assert_equals(result, undefined);
+ return registration.paymentManager.instruments.keys();
+ })
+ .then(result => {
+ assert_equals(result.length, 0);
+ })
+ .catch(unreached_rejection(test));
+ }, 'PaymentInstruments |clear| method test');
+
</script>

Powered by Google App Engine
This is Rietveld 408576698