OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
6 | 6 |
7 import android.support.test.filters.MediumTest; | 7 import android.support.test.filters.MediumTest; |
8 | 8 |
9 import org.junit.Rule; | 9 import org.junit.Rule; |
10 import org.junit.Test; | 10 import org.junit.Test; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 new PaymentAppFactory.PaymentAppFactoryAddition() { | 58 new PaymentAppFactory.PaymentAppFactoryAddition() { |
59 @Override | 59 @Override |
60 public void create(WebContents webContents, Set<String> meth
odNames, | 60 public void create(WebContents webContents, Set<String> meth
odNames, |
61 PaymentAppFactory.PaymentAppCreatedCallback callback
) { | 61 PaymentAppFactory.PaymentAppCreatedCallback callback
) { |
62 List<PaymentInstrument> instruments = new ArrayList<Paym
entInstrument>(); | 62 List<PaymentInstrument> instruments = new ArrayList<Paym
entInstrument>(); |
63 | 63 |
64 if (instrumentPresence != NO_OPTIONS) { | 64 if (instrumentPresence != NO_OPTIONS) { |
65 instruments.add(new ServiceWorkerPaymentInstrument(w
ebContents, | 65 instruments.add(new ServiceWorkerPaymentInstrument(w
ebContents, |
66 0 /* swRegistrationId */, "new" /* instrumen
tId */, | 66 0 /* swRegistrationId */, "new" /* instrumen
tId */, |
67 "Create BobPay account" /* label */, | 67 "Create BobPay account" /* label */, |
68 new HashSet<String>(Arrays.asList("https://b
obpay.com", | 68 new HashSet<String>(Arrays.asList( |
69 "basic-card")) /* methodNames */)); | 69 "https://bobpay.com", "basic-card"))
/* methodNames */, |
| 70 null /* icon*/)); |
70 } | 71 } |
71 | 72 |
72 if (instrumentPresence == TWO_OPTIONS) { | 73 if (instrumentPresence == TWO_OPTIONS) { |
73 instruments.add(new ServiceWorkerPaymentInstrument(w
ebContents, | 74 instruments.add(new ServiceWorkerPaymentInstrument(w
ebContents, |
74 0 /* swRegistrationId */, "existing" /* inst
rumentId */, | 75 0 /* swRegistrationId */, "existing" /* inst
rumentId */, |
75 "Existing BobPay account" /* label */, | 76 "Existing BobPay account" /* label */, |
76 new HashSet<String>(Arrays.asList("https://b
obpay.com", | 77 new HashSet<String>(Arrays.asList( |
77 "basic-card")) /* methodNames */)); | 78 "https://bobpay.com", "basic-card"))
/* methodNames */, |
| 79 null /* icon */)); |
78 } | 80 } |
79 | 81 |
80 callback.onPaymentAppCreated( | 82 callback.onPaymentAppCreated( |
81 new ServiceWorkerPaymentApp(webContents, instrum
ents)); | 83 new ServiceWorkerPaymentApp(webContents, instrum
ents)); |
82 callback.onAllPaymentAppsCreated(); | 84 callback.onAllPaymentAppsCreated(); |
83 } | 85 } |
84 }); | 86 }); |
85 } | 87 } |
86 | 88 |
87 @Test | 89 @Test |
(...skipping 19 matching lines...) Expand all Loading... |
107 @Test | 109 @Test |
108 @MediumTest | 110 @MediumTest |
109 @Feature({"Payments"}) | 111 @Feature({"Payments"}) |
110 public void testTwoOptions() throws InterruptedException, ExecutionException
, TimeoutException { | 112 public void testTwoOptions() throws InterruptedException, ExecutionException
, TimeoutException { |
111 installMockServiceWorkerPaymentApp(TWO_OPTIONS); | 113 installMockServiceWorkerPaymentApp(TWO_OPTIONS); |
112 mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getRead
yForInput()); | 114 mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getRead
yForInput()); |
113 // TODO(tommyt): crbug.com/669876. Expand this test as we implement more | 115 // TODO(tommyt): crbug.com/669876. Expand this test as we implement more |
114 // service worker based payment app functionality. | 116 // service worker based payment app functionality. |
115 } | 117 } |
116 } | 118 } |
OLD | NEW |