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; |
11 import org.chromium.base.test.util.Feature; | 11 import org.chromium.base.test.util.Feature; |
12 import org.chromium.base.test.util.FlakyTest; | |
13 import org.chromium.chrome.R; | 12 import org.chromium.chrome.R; |
14 import org.chromium.chrome.browser.autofill.AutofillTestHelper; | 13 import org.chromium.chrome.browser.autofill.AutofillTestHelper; |
15 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; | 14 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
16 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; | 15 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; |
17 | 16 |
18 import java.util.concurrent.ExecutionException; | 17 import java.util.concurrent.ExecutionException; |
19 import java.util.concurrent.TimeoutException; | 18 import java.util.concurrent.TimeoutException; |
20 | 19 |
21 /** | 20 /** |
22 * A payment integration test for a merchant that requests payer name. | 21 * A payment integration test for a merchant that requests payer name. |
(...skipping 23 matching lines...) Expand all Loading... |
46 public void testPay() throws InterruptedException, ExecutionException, Timeo
utException { | 45 public void testPay() throws InterruptedException, ExecutionException, Timeo
utException { |
47 triggerUIAndWait(mReadyToPay); | 46 triggerUIAndWait(mReadyToPay); |
48 clickAndWait(R.id.button_primary, mReadyForUnmaskInput); | 47 clickAndWait(R.id.button_primary, mReadyForUnmaskInput); |
49 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo
Unmask); | 48 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo
Unmask); |
50 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed
); | 49 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed
); |
51 expectResultContains(new String[] {"Jon Doe"}); | 50 expectResultContains(new String[] {"Jon Doe"}); |
52 } | 51 } |
53 | 52 |
54 /** Attempt to add an invalid payer name and cancel the transaction. */ | 53 /** Attempt to add an invalid payer name and cancel the transaction. */ |
55 @MediumTest | 54 @MediumTest |
56 @FlakyTest(message = "crbug.com/673371") | |
57 @Feature({"Payments"}) | 55 @Feature({"Payments"}) |
58 public void testAddInvalidNameAndCancel() | 56 public void testAddInvalidNameAndCancel() |
59 throws InterruptedException, ExecutionException, TimeoutException { | 57 throws InterruptedException, ExecutionException, TimeoutException { |
60 triggerUIAndWait(mReadyToPay); | 58 triggerUIAndWait(mReadyToPay); |
61 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 59 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); |
62 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; | 60 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; |
63 setTextInEditorAndWait(new String[] {""}, mEditorTextUpdate); | 61 setTextInEditorAndWait(new String[] {""}, mEditorTextUpdate); |
64 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); | 62 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); |
65 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyToPay); | 63 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyToPay); |
66 clickAndWait(R.id.close_button, mDismissed); | 64 clickAndWait(R.id.close_button, mDismissed); |
(...skipping 28 matching lines...) Expand all Loading... |
95 triggerUIAndWait(mReadyToPay); | 93 triggerUIAndWait(mReadyToPay); |
96 | 94 |
97 // Make sure that only the appropriate enum value was logged. | 95 // Make sure that only the appropriate enum value was logged. |
98 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i
) { | 96 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i
) { |
99 assertEquals((i == PaymentRequestMetrics.REQUESTED_INFORMATION_NAME
? 1 : 0), | 97 assertEquals((i == PaymentRequestMetrics.REQUESTED_INFORMATION_NAME
? 1 : 0), |
100 RecordHistogram.getHistogramValueCountForTesting( | 98 RecordHistogram.getHistogramValueCountForTesting( |
101 "PaymentRequest.RequestedInformation", i)); | 99 "PaymentRequest.RequestedInformation", i)); |
102 } | 100 } |
103 } | 101 } |
104 } | 102 } |
OLD | NEW |