Chromium Code Reviews| 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 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 Loading... | |
| 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 expiration year dropdown index for the California. */ | |
|
sebsg
2017/02/28 16:13:59
expiration year?
Parastoo
2017/03/21 14:30:44
Done.
| |
| 87 protected static final int CA = 8; | |
| 88 | |
| 89 /** The expiration year dropdown index for the California. */ | |
|
sebsg
2017/02/28 16:13:59
ditto
Parastoo
2017/03/21 14:30:44
Done.
| |
| 90 protected static final int NY = 42; | |
| 91 | |
| 92 /** The expiration year dropdown index for the United States. */ | |
|
sebsg
2017/02/28 16:13:59
ditto
Parastoo
2017/03/21 14:30:44
Done.
| |
| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 534 int callCount = helper.getCallCount(); | 543 int callCount = helper.getCallCount(); |
| 535 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 544 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 536 @Override | 545 @Override |
| 537 public void run() { | 546 public void run() { |
| 538 ((Spinner) mUI.getEditorView().findViewById(R.id.spinner)).setSe lection(selection); | 547 ((Spinner) mUI.getEditorView().findViewById(R.id.spinner)).setSe lection(selection); |
| 539 } | 548 } |
| 540 }); | 549 }); |
| 541 helper.waitForCallback(callCount); | 550 helper.waitForCallback(callCount); |
| 542 } | 551 } |
| 543 | 552 |
| 553 /** Selects the spinner value in the editor UI for credit cards. */ | |
|
sebsg
2017/02/28 16:13:59
For credit cards?
Parastoo
2017/03/21 14:30:44
Done.
| |
| 554 protected void setSpinnerSelectionsInEditorAndWait(final int[] selections, | |
| 555 CallbackHelper helper) throws InterruptedException, TimeoutException { | |
| 556 int callCount = helper.getCallCount(); | |
| 557 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | |
| 558 @Override | |
| 559 public void run() { | |
| 560 List<Spinner> fields = mUI.getEditorView().getDropdownFieldsForT est(); | |
| 561 for (int i = 0; i < selections.length && i < fields.size(); i++) { | |
| 562 fields.get(i).setSelection(selections[i]); | |
| 563 } | |
| 564 } | |
| 565 }); | |
| 566 helper.waitForCallback(callCount); | |
| 567 } | |
| 568 | |
| 544 /** Directly sets the text in the editor UI for credit cards. */ | 569 /** Directly sets the text in the editor UI for credit cards. */ |
| 545 protected void setTextInCardEditorAndWait(final String[] values, CallbackHel per helper) | 570 protected void setTextInCardEditorAndWait(final String[] values, CallbackHel per helper) |
| 546 throws InterruptedException, TimeoutException { | 571 throws InterruptedException, TimeoutException { |
| 547 int callCount = helper.getCallCount(); | 572 int callCount = helper.getCallCount(); |
| 548 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 573 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 549 @Override | 574 @Override |
| 550 public void run() { | 575 public void run() { |
| 551 ViewGroup contents = (ViewGroup) | 576 ViewGroup contents = (ViewGroup) |
| 552 mUI.getCardEditorView().findViewById(R.id.contents); | 577 mUI.getCardEditorView().findViewById(R.id.contents); |
| 553 assertNotNull(contents); | 578 assertNotNull(contents); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 978 List<PaymentItem> displayItems, Map<String, PaymentDetailsModifi er> modifiers, | 1003 List<PaymentItem> displayItems, Map<String, PaymentDetailsModifi er> modifiers, |
| 979 InstrumentDetailsCallback detailsCallback) { | 1004 InstrumentDetailsCallback detailsCallback) { |
| 980 detailsCallback.onInstrumentDetailsReady( | 1005 detailsCallback.onInstrumentDetailsReady( |
| 981 mMethodName, "{\"transaction\": 1337}"); | 1006 mMethodName, "{\"transaction\": 1337}"); |
| 982 } | 1007 } |
| 983 | 1008 |
| 984 @Override | 1009 @Override |
| 985 public void dismissInstrument() {} | 1010 public void dismissInstrument() {} |
| 986 } | 1011 } |
| 987 } | 1012 } |
| OLD | NEW |