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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java

Issue 2413833002: PaymentRequest: Rename ContactInfo to PayerInfo.
Patch Set: test Created 4 years, 2 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 // 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.os.Handler; 7 import android.os.Handler;
8 import android.view.View; 8 import android.view.View;
9 import android.view.ViewGroup; 9 import android.view.ViewGroup;
10 import android.widget.CheckBox; 10 import android.widget.CheckBox;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 int callCount = helper.getCallCount(); 202 int callCount = helper.getCallCount();
203 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 203 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
204 @Override 204 @Override
205 public void run() { 205 public void run() {
206 mUI.getPaymentMethodSectionForTest().findViewById(resourceId).pe rformClick(); 206 mUI.getPaymentMethodSectionForTest().findViewById(resourceId).pe rformClick();
207 } 207 }
208 }); 208 });
209 helper.waitForCallback(callCount); 209 helper.waitForCallback(callCount);
210 } 210 }
211 211
212 /** Clicks on an element in the "Contact Info" section of the payments UI. * / 212 /** Clicks on an element in the "Payer Info" section of the payments UI. */
213 protected void clickInContactInfoAndWait(final int resourceId, CallbackHelpe r helper) 213 protected void clickInPayerInfoAndWait(final int resourceId, CallbackHelper helper)
214 throws InterruptedException, TimeoutException { 214 throws InterruptedException, TimeoutException {
215 int callCount = helper.getCallCount(); 215 int callCount = helper.getCallCount();
216 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 216 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
217 @Override 217 @Override
218 public void run() { 218 public void run() {
219 mUI.getContactDetailsSectionForTest().findViewById(resourceId).p erformClick(); 219 mUI.getPayerInfoDetailsSectionForTest().findViewById(resourceId) .performClick();
220 } 220 }
221 }); 221 });
222 helper.waitForCallback(callCount); 222 helper.waitForCallback(callCount);
223 } 223 }
224 224
225 /** Clicks on an element in the editor UI for credit cards. */ 225 /** Clicks on an element in the editor UI for credit cards. */
226 protected void clickInCardEditorAndWait(final int resourceId, CallbackHelper helper) 226 protected void clickInCardEditorAndWait(final int resourceId, CallbackHelper helper)
227 throws InterruptedException, TimeoutException { 227 throws InterruptedException, TimeoutException {
228 int callCount = helper.getCallCount(); 228 int callCount = helper.getCallCount();
229 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 229 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { 276 return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() {
277 @Override 277 @Override
278 public String call() { 278 public String call() {
279 return ((OptionSection) mUI.getPaymentMethodSectionForTest()) 279 return ((OptionSection) mUI.getPaymentMethodSectionForTest())
280 .getOptionLabelsForTest(index).getText().toString(); 280 .getOptionLabelsForTest(index).getText().toString();
281 } 281 }
282 }); 282 });
283 } 283 }
284 284
285 /** 285 /**
286 * Returns the label corresponding to the contact detail suggestion at the specified 286 * Returns the label corresponding to the payer information detail suggesti on at the specified
287 * |suggestionIndex|. 287 * |suggestionIndex|.
288 */ 288 */
289 protected String getContactDetailsSuggestionLabel(final int suggestionIndex) 289 protected String getPayerInfoDetailsSuggestionLabel(final int suggestionInde x)
290 throws ExecutionException { 290 throws ExecutionException {
291 return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { 291 return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() {
292 @Override 292 @Override
293 public String call() { 293 public String call() {
294 return ((OptionSection) mUI.getContactDetailsSectionForTest()) 294 return ((OptionSection) mUI.getPayerInfoDetailsSectionForTest())
295 .getOptionLabelsForTest(suggestionIndex).getText().toStr ing(); 295 .getOptionLabelsForTest(suggestionIndex).getText().toStr ing();
296 } 296 }
297 }); 297 });
298 } 298 }
299 299
300 /** Returns the the number of payment instruments. */ 300 /** Returns the the number of payment instruments. */
301 protected int getNumberOfPaymentInstruments() throws ExecutionException { 301 protected int getNumberOfPaymentInstruments() throws ExecutionException {
302 return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() { 302 return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() {
303 @Override 303 @Override
304 public Integer call() { 304 public Integer call() {
305 return ((OptionSection) mUI.getPaymentMethodSectionForTest()) 305 return ((OptionSection) mUI.getPaymentMethodSectionForTest())
306 .getNumberOfOptionLabelsForTest(); 306 .getNumberOfOptionLabelsForTest();
307 } 307 }
308 }); 308 });
309 } 309 }
310 310
311 /** Returns the the number of contact detail suggestions. */ 311 /** Returns the the number of payer information detail suggestions. */
312 protected int getNumberOfContactDetailSuggestions() throws ExecutionExceptio n { 312 protected int getNumberOfPayerInfoDetailSuggestions() throws ExecutionExcept ion {
313 return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() { 313 return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() {
314 @Override 314 @Override
315 public Integer call() { 315 public Integer call() {
316 return ((OptionSection) mUI.getContactDetailsSectionForTest()) 316 return ((OptionSection) mUI.getPayerInfoDetailsSectionForTest())
317 .getNumberOfOptionLabelsForTest(); 317 .getNumberOfOptionLabelsForTest();
318 } 318 }
319 }); 319 });
320 } 320 }
321 321
322 /** 322 /**
323 * Returns the label corresponding to the shipping address suggestion at th e specified 323 * Returns the label corresponding to the shipping address suggestion at th e specified
324 * |suggestionIndex|. 324 * |suggestionIndex|.
325 */ 325 */
326 protected String getShippingAddressSuggestionLabel(final int suggestionIndex ) 326 protected String getShippingAddressSuggestionLabel(final int suggestionIndex )
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 } 445 }
446 446
447 /** Directly sets the text in the editor UI. */ 447 /** Directly sets the text in the editor UI. */
448 protected void setTextInEditorAndWait(final String[] values, CallbackHelper helper) 448 protected void setTextInEditorAndWait(final String[] values, CallbackHelper helper)
449 throws InterruptedException, TimeoutException { 449 throws InterruptedException, TimeoutException {
450 int callCount = helper.getCallCount(); 450 int callCount = helper.getCallCount();
451 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 451 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
452 @Override 452 @Override
453 public void run() { 453 public void run() {
454 List<EditText> fields = mUI.getEditorView().getEditableTextField sForTest(); 454 List<EditText> fields = mUI.getEditorView().getEditableTextField sForTest();
455
455 for (int i = 0; i < values.length; i++) { 456 for (int i = 0; i < values.length; i++) {
456 fields.get(i).setText(values[i]); 457 fields.get(i).setText(values[i]);
457 } 458 }
458 } 459 }
459 }); 460 });
460 helper.waitForCallback(callCount); 461 helper.waitForCallback(callCount);
461 } 462 }
462 463
463 /** Directly sets the checkbox selection in the editor UI for credit cards. */ 464 /** Directly sets the checkbox selection in the editor UI for credit cards. */
464 protected void selectCheckboxAndWait(final int resourceId, final boolean isC hecked, 465 protected void selectCheckboxAndWait(final int resourceId, final boolean isC hecked,
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 public void getDetails(String merchantName, String origin, PaymentItem t otal, 731 public void getDetails(String merchantName, String origin, PaymentItem t otal,
731 List<PaymentItem> cart, JSONObject details, DetailsCallback deta ilsCallback) { 732 List<PaymentItem> cart, JSONObject details, DetailsCallback deta ilsCallback) {
732 detailsCallback.onInstrumentDetailsReady( 733 detailsCallback.onInstrumentDetailsReady(
733 mMethodName, "{\"transaction\": 1337}"); 734 mMethodName, "{\"transaction\": 1337}");
734 } 735 }
735 736
736 @Override 737 @Override
737 public void dismiss() {} 738 public void dismiss() {}
738 } 739 }
739 } 740 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698