| 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.content.DialogInterface; | 7 import android.content.DialogInterface; |
| 8 import android.test.suitebuilder.annotation.MediumTest; | 8 import android.test.suitebuilder.annotation.MediumTest; |
| 9 | 9 |
| 10 import org.chromium.base.metrics.RecordHistogram; | 10 import org.chromium.base.metrics.RecordHistogram; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed
); | 49 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed
); |
| 50 expectResultContains(new String[] {"jon.doe@google.com"}); | 50 expectResultContains(new String[] {"jon.doe@google.com"}); |
| 51 } | 51 } |
| 52 | 52 |
| 53 /** Attempt to add an invalid email address and cancel the transaction. */ | 53 /** Attempt to add an invalid email address and cancel the transaction. */ |
| 54 @MediumTest | 54 @MediumTest |
| 55 @Feature({"Payments"}) | 55 @Feature({"Payments"}) |
| 56 public void testAddInvalidEmailAndCancel() | 56 public void testAddInvalidEmailAndCancel() |
| 57 throws InterruptedException, ExecutionException, TimeoutException { | 57 throws InterruptedException, ExecutionException, TimeoutException { |
| 58 triggerUIAndWait(mReadyToPay); | 58 triggerUIAndWait(mReadyToPay); |
| 59 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 59 clickInPayerInfoAndWait(R.id.payments_section, mReadyForInput); |
| 60 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; | 60 clickInPayerInfoAndWait(R.id.payments_add_option_button, mReadyToEdit); |
| 61 setTextInEditorAndWait(new String[] {"jane.jones"}, mEditorTextUpdate); | 61 setTextInEditorAndWait(new String[] {"jane.jones"}, mEditorTextUpdate); |
| 62 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); | 62 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); |
| 63 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); | 63 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); |
| 64 clickAndWait(R.id.close_button, mDismissed); | 64 clickAndWait(R.id.close_button, mDismissed); |
| 65 expectResultContains(new String[] {"Request cancelled"}); | 65 expectResultContains(new String[] {"Request cancelled"}); |
| 66 } | 66 } |
| 67 | 67 |
| 68 /** Add a new email address and provide that to the merchant. */ | 68 /** Add a new email address and provide that to the merchant. */ |
| 69 @MediumTest | 69 @MediumTest |
| 70 @Feature({"Payments"}) | 70 @Feature({"Payments"}) |
| 71 public void testAddEmailAndPay() | 71 public void testAddEmailAndPay() |
| 72 throws InterruptedException, ExecutionException, TimeoutException { | 72 throws InterruptedException, ExecutionException, TimeoutException { |
| 73 triggerUIAndWait(mReadyToPay); | 73 triggerUIAndWait(mReadyToPay); |
| 74 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 74 clickInPayerInfoAndWait(R.id.payments_section, mReadyForInput); |
| 75 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; | 75 clickInPayerInfoAndWait(R.id.payments_add_option_button, mReadyToEdit); |
| 76 setTextInEditorAndWait(new String[] {"jane.jones@google.com"}, mEditorTe
xtUpdate); | 76 setTextInEditorAndWait(new String[] {"jane.jones@google.com"}, mEditorTe
xtUpdate); |
| 77 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); | 77 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); |
| 78 clickAndWait(R.id.button_primary, mReadyForUnmaskInput); | 78 clickAndWait(R.id.button_primary, mReadyForUnmaskInput); |
| 79 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo
Unmask); | 79 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo
Unmask); |
| 80 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed
); | 80 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed
); |
| 81 expectResultContains(new String[] {"jane.jones@google.com"}); | 81 expectResultContains(new String[] {"jane.jones@google.com"}); |
| 82 } | 82 } |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * Test that starting a payment request that requires only the user's email
address results in | 85 * Test that starting a payment request that requires only the user's email
address results in |
| 86 * the appropriate metric being logged in the PaymentRequest.RequestedInform
ation histogram. | 86 * the appropriate metric being logged in the PaymentRequest.RequestedInform
ation histogram. |
| 87 */ | 87 */ |
| 88 @MediumTest | 88 @MediumTest |
| 89 @Feature({"Payments"}) | 89 @Feature({"Payments"}) |
| 90 public void testRequestedInformationMetric() throws InterruptedException, Ex
ecutionException, | 90 public void testRequestedInformationMetric() throws InterruptedException, Ex
ecutionException, |
| 91 TimeoutException { | 91 TimeoutException { |
| 92 // Start the Payment Request. | 92 // Start the Payment Request. |
| 93 triggerUIAndWait(mReadyToPay); | 93 triggerUIAndWait(mReadyToPay); |
| 94 | 94 |
| 95 // Make sure that only the appropriate enum value was logged. | 95 // Make sure that only the appropriate enum value was logged. |
| 96 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i
) { | 96 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i
) { |
| 97 assertEquals((i == PaymentRequestMetrics.REQUESTED_INFORMATION_EMAIL
? 1 : 0), | 97 assertEquals((i == PaymentRequestMetrics.REQUESTED_INFORMATION_EMAIL
? 1 : 0), |
| 98 RecordHistogram.getHistogramValueCountForTesting( | 98 RecordHistogram.getHistogramValueCountForTesting( |
| 99 "PaymentRequest.RequestedInformation", i)); | 99 "PaymentRequest.RequestedInformation", i)); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 } | 102 } |
| OLD | NEW |