| 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.chromium.base.test.util.Feature; | 9 import org.chromium.base.test.util.Feature; |
| 10 import org.chromium.chrome.R; | 10 import org.chromium.chrome.R; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // Check that there is a selected payment method (makes sure we are not
ready to pay because | 48 // Check that there is a selected payment method (makes sure we are not
ready to pay because |
| 49 // of the Contact Details). | 49 // of the Contact Details). |
| 50 expectPaymentMethodRowIsSelected(0); | 50 expectPaymentMethodRowIsSelected(0); |
| 51 // Updating contact with an invalid value and cancelling means we're sti
ll not | 51 // Updating contact with an invalid value and cancelling means we're sti
ll not |
| 52 // ready to pay (the value is still the original value). | 52 // ready to pay (the value is still the original value). |
| 53 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 53 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); |
| 54 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); | 54 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); |
| 55 setTextInEditorAndWait(new String[] {"---"}, mEditorTextUpdate); | 55 setTextInEditorAndWait(new String[] {"---"}, mEditorTextUpdate); |
| 56 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); | 56 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); |
| 57 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); | 57 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); |
| 58 assertEquals(PaymentRequestSection.EDIT_BUTTON_SELECT, getContactDetails
ButtonState()); | 58 assertEquals(PaymentRequestSection.EDIT_BUTTON_CHOOSE, getContactDetails
ButtonState()); |
| 59 | 59 |
| 60 clickAndWait(R.id.close_button, mDismissed); | 60 clickAndWait(R.id.close_button, mDismissed); |
| 61 expectResultContains(new String[] {"Request cancelled"}); | 61 expectResultContains(new String[] {"Request cancelled"}); |
| 62 } | 62 } |
| 63 | 63 |
| 64 /** Attempt to add an invalid phone alongside the already invalid data and c
ancel. */ | 64 /** Attempt to add an invalid phone alongside the already invalid data and c
ancel. */ |
| 65 @MediumTest | 65 @MediumTest |
| 66 @Feature({"Payments"}) | 66 @Feature({"Payments"}) |
| 67 public void testAddIncompletePhoneAndCancel() | 67 public void testAddIncompletePhoneAndCancel() |
| 68 throws InterruptedException, ExecutionException, TimeoutException { | 68 throws InterruptedException, ExecutionException, TimeoutException { |
| 69 // Not ready to pay since Contact phone is invalid. | 69 // Not ready to pay since Contact phone is invalid. |
| 70 triggerUIAndWait(mReadyForInput); | 70 triggerUIAndWait(mReadyForInput); |
| 71 // Check that there is a selected payment method (makes sure we are not
ready to pay because | 71 // Check that there is a selected payment method (makes sure we are not
ready to pay because |
| 72 // of the Contact Details). | 72 // of the Contact Details). |
| 73 expectPaymentMethodRowIsSelected(0); | 73 expectPaymentMethodRowIsSelected(0); |
| 74 // Updating contact with an invalid value and cancelling means we're sti
ll not | 74 // Updating contact with an invalid value and cancelling means we're sti
ll not |
| 75 // ready to pay (the value is still the original value). | 75 // ready to pay (the value is still the original value). |
| 76 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 76 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); |
| 77 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; | 77 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; |
| 78 setTextInEditorAndWait(new String[] {"---"}, mEditorTextUpdate); | 78 setTextInEditorAndWait(new String[] {"---"}, mEditorTextUpdate); |
| 79 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); | 79 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); |
| 80 // The section collapses and the [SELECT] button is active. | 80 // The section collapses and the [CHOOSE] button is active. |
| 81 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); | 81 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); |
| 82 assertEquals(PaymentRequestSection.EDIT_BUTTON_SELECT, getContactDetails
ButtonState()); | 82 assertEquals(PaymentRequestSection.EDIT_BUTTON_CHOOSE, getContactDetails
ButtonState()); |
| 83 | 83 |
| 84 clickAndWait(R.id.close_button, mDismissed); | 84 clickAndWait(R.id.close_button, mDismissed); |
| 85 expectResultContains(new String[] {"Request cancelled"}); | 85 expectResultContains(new String[] {"Request cancelled"}); |
| 86 } | 86 } |
| 87 | 87 |
| 88 /** Update the phone with valid data and provide that to the merchant. */ | 88 /** Update the phone with valid data and provide that to the merchant. */ |
| 89 @MediumTest | 89 @MediumTest |
| 90 @Feature({"Payments"}) | 90 @Feature({"Payments"}) |
| 91 public void testEditIncompletePhoneAndPay() | 91 public void testEditIncompletePhoneAndPay() |
| 92 throws InterruptedException, ExecutionException, TimeoutException { | 92 throws InterruptedException, ExecutionException, TimeoutException { |
| 93 triggerUIAndWait(mReadyForInput); | 93 triggerUIAndWait(mReadyForInput); |
| 94 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 94 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); |
| 95 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); | 95 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); |
| 96 setTextInEditorAndWait(new String[] {"514-555-5555"}, mEditorTextUpdate)
; | 96 setTextInEditorAndWait(new String[] {"514-555-5555"}, mEditorTextUpdate)
; |
| 97 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); | 97 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); |
| 98 clickAndWait(R.id.button_primary, mDismissed); | 98 clickAndWait(R.id.button_primary, mDismissed); |
| 99 expectResultContains(new String[] {"514-555-5555"}); | 99 expectResultContains(new String[] {"514-555-5555"}); |
| 100 } | 100 } |
| 101 } | 101 } |
| OLD | NEW |