| 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.chrome.R; | 11 import org.chromium.chrome.R; |
| 11 import org.chromium.chrome.browser.autofill.AutofillTestHelper; | 12 import org.chromium.chrome.browser.autofill.AutofillTestHelper; |
| 12 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; | 13 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
| 13 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; | 14 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; |
| 14 | 15 |
| 15 import java.util.concurrent.ExecutionException; | 16 import java.util.concurrent.ExecutionException; |
| 16 import java.util.concurrent.TimeoutException; | 17 import java.util.concurrent.TimeoutException; |
| 17 | 18 |
| 18 /** | 19 /** |
| 19 * A payment integration test for a merchant that requests phone number. | 20 * A payment integration test for a merchant that requests phone number. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 triggerUIAndWait(mReadyToPay); | 69 triggerUIAndWait(mReadyToPay); |
| 69 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 70 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); |
| 70 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; | 71 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; |
| 71 setTextInEditorAndWait(new String[] {"999-999-9999"}, mEditorTextUpdate)
; | 72 setTextInEditorAndWait(new String[] {"999-999-9999"}, mEditorTextUpdate)
; |
| 72 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); | 73 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); |
| 73 clickAndWait(R.id.button_primary, mReadyForUnmaskInput); | 74 clickAndWait(R.id.button_primary, mReadyForUnmaskInput); |
| 74 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo
Unmask); | 75 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo
Unmask); |
| 75 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed
); | 76 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed
); |
| 76 expectResultContains(new String[] {"999-999-9999"}); | 77 expectResultContains(new String[] {"999-999-9999"}); |
| 77 } | 78 } |
| 79 |
| 80 /** |
| 81 * Test that starting a payment request that requires only the user's phone
number results in |
| 82 * the appropriate metric being logged in the PaymentRequest.RequestedInform
ation histogram. |
| 83 */ |
| 84 @MediumTest |
| 85 public void testRequestedInformationMetric() throws InterruptedException, Ex
ecutionException, |
| 86 TimeoutException { |
| 87 // Start the Payment Request. |
| 88 triggerUIAndWait(mReadyToPay); |
| 89 |
| 90 // Make sure that only the appropriate enum value was logged. |
| 91 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i
) { |
| 92 assertEquals((i == PaymentRequestMetrics.REQUESTED_INFORMATION_PHONE
? 1 : 0), |
| 93 RecordHistogram.getHistogramValueCountForTesting( |
| 94 "PaymentRequest.RequestedInformation", i)); |
| 95 } |
| 96 } |
| 78 } | 97 } |
| OLD | NEW |