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

Side by Side 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 unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <meta charset="utf-8"> 2 <meta charset="utf-8">
3 <title>PaymentHandler: Tests for PaymentInstruments</title> 3 <title>PaymentHandler: Tests for PaymentInstruments</title>
4 <link rel="help" href="https://w3c.github.io/webpayments-payment-apps-api/#payme nt-instruments"> 4 <link rel="help" href="https://w3c.github.io/webpayments-payment-apps-api/#payme nt-instruments">
5 <script src="../resources/testharness.js"></script> 5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script> 6 <script src="../resources/testharnessreport.js"></script>
7 <script src="../../serviceworker/resources/test-helpers.js"></script> 7 <script src="../../serviceworker/resources/test-helpers.js"></script>
8 <script> 8 <script>
9 9
10 promise_test(test => { 10 promise_test(test => {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 .then(result => { 154 .then(result => {
155 assert_array_equals(result, [undefined, undefined]); 155 assert_array_equals(result, [undefined, undefined]);
156 return registration.paymentManager.instruments.keys(); 156 return registration.paymentManager.instruments.keys();
157 }) 157 })
158 .then(result => { 158 .then(result => {
159 assert_array_equals(result, ['test_key1', 'test_key2']); 159 assert_array_equals(result, ['test_key1', 'test_key2']);
160 }) 160 })
161 .catch(unreached_rejection(test)); 161 .catch(unreached_rejection(test));
162 }, 'PaymentInstruments |keys| method test'); 162 }, 'PaymentInstruments |keys| method test');
163 163
164 promise_test(test => {
165 var registration;
166 var script_url = 'resources/empty-worker.js';
167 var scope = 'resources/';
168
169 return service_worker_unregister_and_register(test, script_url, scope)
170 .then(r => {
171 registration = r;
172 return wait_for_state(test, registration.installing, 'activated');
173 })
174 .then(state => {
175 assert_equals(state, 'activated');
176 var instruments = [
177 registration.paymentManager.instruments.set(
178 'test_key1',
179 {
180 name: 'Visa ending ****4756',
181 enabledMethods: ['basic-card'],
182 capabilities: {
183 supportedNetworks: ['visa'],
184 supportedTypes: ['credit']
185 }
186 }),
187 registration.paymentManager.instruments.set(
188 'test_key2',
189 {
190 name: "My Bob Pay Account: john@example.com",
191 enabledMethods: ["https://bobpay.com/"]
192 })
193 ];
194 return Promise.all(instruments);
195 })
196 .then(result => {
197 assert_array_equals(result, [undefined, undefined]);
198 return registration.paymentManager.instruments.keys();
199 })
200 .then(result => {
201 assert_equals(result.length, 2);
202 return registration.paymentManager.instruments.clear();
203 })
204 .then(result => {
205 assert_equals(result, undefined);
206 return registration.paymentManager.instruments.keys();
207 })
208 .then(result => {
209 assert_equals(result.length, 0);
210 })
211 .catch(unreached_rejection(test));
212 }, 'PaymentInstruments |clear| method test');
213
164 </script> 214 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698