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