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