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.support.test.filters.MediumTest; | 8 import android.support.test.filters.MediumTest; |
9 | 9 |
10 import org.chromium.base.ThreadUtils; | 10 import org.chromium.base.ThreadUtils; |
11 import org.chromium.base.metrics.RecordHistogram; | 11 import org.chromium.base.metrics.RecordHistogram; |
12 import org.chromium.base.test.util.Feature; | 12 import org.chromium.base.test.util.Feature; |
| 13 import org.chromium.base.test.util.FlakyTest; |
13 import org.chromium.chrome.R; | 14 import org.chromium.chrome.R; |
14 import org.chromium.chrome.browser.autofill.AutofillTestHelper; | 15 import org.chromium.chrome.browser.autofill.AutofillTestHelper; |
15 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; | 16 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
16 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; | 17 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; |
17 | 18 |
18 import java.util.concurrent.ExecutionException; | 19 import java.util.concurrent.ExecutionException; |
19 import java.util.concurrent.TimeoutException; | 20 import java.util.concurrent.TimeoutException; |
20 | 21 |
21 /** | 22 /** |
22 * A payment integration test for a merchant that does not require shipping addr
ess. | 23 * A payment integration test for a merchant that does not require shipping addr
ess. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // still being ready to pay with the previously selected credit card. | 107 // still being ready to pay with the previously selected credit card. |
107 fillNewCardForm("123", "Bob", DECEMBER, NEXT_YEAR, FIRST_BILLING_ADDRESS
); | 108 fillNewCardForm("123", "Bob", DECEMBER, NEXT_YEAR, FIRST_BILLING_ADDRESS
); |
108 clickInCardEditorAndWait(R.id.payments_edit_done_button, mEditorValidati
onError); | 109 clickInCardEditorAndWait(R.id.payments_edit_done_button, mEditorValidati
onError); |
109 clickInCardEditorAndWait(R.id.payments_edit_cancel_button, mReadyToPay); | 110 clickInCardEditorAndWait(R.id.payments_edit_cancel_button, mReadyToPay); |
110 clickAndWait(R.id.close_button, mDismissed); | 111 clickAndWait(R.id.close_button, mDismissed); |
111 expectResultContains(new String[] {"Request cancelled"}); | 112 expectResultContains(new String[] {"Request cancelled"}); |
112 } | 113 } |
113 | 114 |
114 /** Attempt to add a credit card with an empty name on card and cancel payme
nt. */ | 115 /** Attempt to add a credit card with an empty name on card and cancel payme
nt. */ |
115 @MediumTest | 116 @MediumTest |
| 117 @FlakyTest(message = "crbug.com/678983") |
116 @Feature({"Payments"}) | 118 @Feature({"Payments"}) |
117 public void testAddEmptyNameOnCardAndCancel() | 119 public void testAddEmptyNameOnCardAndCancel() |
118 throws InterruptedException, ExecutionException, TimeoutException { | 120 throws InterruptedException, ExecutionException, TimeoutException { |
119 fillNewCardForm("5454-5454-5454-5454", "", DECEMBER, NEXT_YEAR, FIRST_BI
LLING_ADDRESS); | 121 fillNewCardForm("5454-5454-5454-5454", "", DECEMBER, NEXT_YEAR, FIRST_BI
LLING_ADDRESS); |
120 clickInCardEditorAndWait(R.id.payments_edit_done_button, mEditorValidati
onError); | 122 clickInCardEditorAndWait(R.id.payments_edit_done_button, mEditorValidati
onError); |
121 clickInCardEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInpu
t); | 123 clickInCardEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInpu
t); |
122 clickAndWait(R.id.close_button, mDismissed); | 124 clickAndWait(R.id.close_button, mDismissed); |
123 expectResultContains(new String[] {"Request cancelled"}); | 125 expectResultContains(new String[] {"Request cancelled"}); |
124 } | 126 } |
125 | 127 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 triggerUIAndWait(mReadyToPay); | 374 triggerUIAndWait(mReadyToPay); |
373 | 375 |
374 // Make sure that only the appropriate enum value was logged. | 376 // Make sure that only the appropriate enum value was logged. |
375 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i
) { | 377 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i
) { |
376 assertEquals((i == PaymentRequestMetrics.REQUESTED_INFORMATION_NONE
? 1 : 0), | 378 assertEquals((i == PaymentRequestMetrics.REQUESTED_INFORMATION_NONE
? 1 : 0), |
377 RecordHistogram.getHistogramValueCountForTesting( | 379 RecordHistogram.getHistogramValueCountForTesting( |
378 "PaymentRequest.RequestedInformation", i)); | 380 "PaymentRequest.RequestedInformation", i)); |
379 } | 381 } |
380 } | 382 } |
381 } | 383 } |
OLD | NEW |