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

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

Issue 2680143002: Use dropdown list for admin areas in pr form. (Closed)
Patch Set: The one where I merged the cl with seb's again. Created 3 years, 9 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 static java.util.Arrays.asList; 7 import static java.util.Arrays.asList;
8 8
9 import android.os.Handler; 9 import android.os.Handler;
10 import android.view.KeyEvent; 10 import android.view.KeyEvent;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 /** The expiration month dropdown index for December. */ 77 /** The expiration month dropdown index for December. */
78 protected static final int DECEMBER = 11; 78 protected static final int DECEMBER = 11;
79 79
80 /** The expiration year dropdown index for the next year. */ 80 /** The expiration year dropdown index for the next year. */
81 protected static final int NEXT_YEAR = 1; 81 protected static final int NEXT_YEAR = 1;
82 82
83 /** The billing address dropdown index for the first billing address. */ 83 /** The billing address dropdown index for the first billing address. */
84 protected static final int FIRST_BILLING_ADDRESS = 0; 84 protected static final int FIRST_BILLING_ADDRESS = 0;
85 85
86 /** The dropdown index for the California. */
87 protected static final int CA = 8;
88
89 /** The dropdown index for the New York. */
90 protected static final int NY = 42;
91
92 /** The dropdown index for the United States. */
93 protected static final int US = 236;
94
86 protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyForInput; 95 protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyForInput;
87 protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyToPay; 96 protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyToPay;
88 protected final PaymentsCallbackHelper<PaymentRequestUI> mSelectionChecked; 97 protected final PaymentsCallbackHelper<PaymentRequestUI> mSelectionChecked;
89 protected final PaymentsCallbackHelper<PaymentRequestUI> mResultReady; 98 protected final PaymentsCallbackHelper<PaymentRequestUI> mResultReady;
90 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyForUnmaskInpu t; 99 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyForUnmaskInpu t;
91 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyToUnmask; 100 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyToUnmask;
92 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mUnmaskValidationDo ne; 101 protected final PaymentsCallbackHelper<CardUnmaskPrompt> mUnmaskValidationDo ne;
93 protected final CallbackHelper mReadyToEdit; 102 protected final CallbackHelper mReadyToEdit;
94 protected final CallbackHelper mEditorValidationError; 103 protected final CallbackHelper mEditorValidationError;
95 protected final CallbackHelper mEditorTextUpdate; 104 protected final CallbackHelper mEditorTextUpdate;
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 int callCount = helper.getCallCount(); 565 int callCount = helper.getCallCount();
557 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 566 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
558 @Override 567 @Override
559 public void run() { 568 public void run() {
560 ((Spinner) mUI.getEditorView().findViewById(R.id.spinner)).setSe lection(selection); 569 ((Spinner) mUI.getEditorView().findViewById(R.id.spinner)).setSe lection(selection);
561 } 570 }
562 }); 571 });
563 helper.waitForCallback(callCount); 572 helper.waitForCallback(callCount);
564 } 573 }
565 574
575 /** Selects the spinner value in the editor for Payment Request form and wai t. */
576 protected void setSpinnerSelectionsInEditorAndWait(final int[] selections,
577 CallbackHelper helper) throws InterruptedException, TimeoutException {
578 int callCount = helper.getCallCount();
579 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
580 @Override
581 public void run() {
582 List<Spinner> fields = mUI.getEditorView().getDropdownFieldsForT est();
583 for (int i = 0; i < selections.length && i < fields.size(); i++) {
584 fields.get(i).setSelection(selections[i]);
585 }
586 }
587 });
588 helper.waitForCallback(callCount);
589 }
590
566 /** Directly sets the text in the editor UI for credit cards. */ 591 /** Directly sets the text in the editor UI for credit cards. */
567 protected void setTextInCardEditorAndWait(final String[] values, CallbackHel per helper) 592 protected void setTextInCardEditorAndWait(final String[] values, CallbackHel per helper)
568 throws InterruptedException, TimeoutException { 593 throws InterruptedException, TimeoutException {
569 int callCount = helper.getCallCount(); 594 int callCount = helper.getCallCount();
570 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 595 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
571 @Override 596 @Override
572 public void run() { 597 public void run() {
573 ViewGroup contents = (ViewGroup) 598 ViewGroup contents = (ViewGroup)
574 mUI.getCardEditorView().findViewById(R.id.contents); 599 mUI.getCardEditorView().findViewById(R.id.contents);
575 assertNotNull(contents); 600 assertNotNull(contents);
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 Map<String, PaymentDetailsModifier> modifiers, 1027 Map<String, PaymentDetailsModifier> modifiers,
1003 InstrumentDetailsCallback detailsCallback) { 1028 InstrumentDetailsCallback detailsCallback) {
1004 detailsCallback.onInstrumentDetailsReady( 1029 detailsCallback.onInstrumentDetailsReady(
1005 mMethodName, "{\"transaction\": 1337}"); 1030 mMethodName, "{\"transaction\": 1337}");
1006 } 1031 }
1007 1032
1008 @Override 1033 @Override
1009 public void dismissInstrument() {} 1034 public void dismissInstrument() {}
1010 } 1035 }
1011 } 1036 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698