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.test.util.Feature; | 10 import org.chromium.base.test.util.Feature; |
11 import org.chromium.chrome.R; | 11 import org.chromium.chrome.R; |
12 import org.chromium.chrome.browser.autofill.AutofillTestHelper; | 12 import org.chromium.chrome.browser.autofill.AutofillTestHelper; |
13 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; | 13 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
14 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; | 14 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; |
15 | 15 |
16 import java.util.concurrent.ExecutionException; | 16 import java.util.concurrent.ExecutionException; |
17 import java.util.concurrent.TimeoutException; | 17 import java.util.concurrent.TimeoutException; |
18 | 18 |
19 /** | 19 /** |
20 * A payment integration test for a merchant that requests contact details from
a user that has | 20 * A payment integration test for a merchant that requests payer information det
ails from a user |
21 * incomplete contact details stored on disk. | 21 * that has incomplete payer information details stored on disk. |
22 */ | 22 */ |
23 public class PaymentRequestIncompleteContactDetailsTest extends PaymentRequestTe
stBase { | 23 public class PaymentRequestIncompletePayerInfoDetailsTest extends PaymentRequest
TestBase { |
24 public PaymentRequestIncompleteContactDetailsTest() { | 24 public PaymentRequestIncompletePayerInfoDetailsTest() { |
25 // This merchant requests both a phone number and an email address. | 25 // This merchant requests payer information. |
26 super("payment_request_contact_details_test.html"); | 26 super("payment_request_payer_info_details_test.html"); |
27 } | 27 } |
28 | 28 |
29 @Override | 29 @Override |
30 public void onMainActivityStarted() | 30 public void onMainActivityStarted() |
31 throws InterruptedException, ExecutionException, TimeoutException { | 31 throws InterruptedException, ExecutionException, TimeoutException { |
32 AutofillTestHelper helper = new AutofillTestHelper(); | 32 AutofillTestHelper helper = new AutofillTestHelper(); |
33 // The user has an invalid email address on disk. | 33 // The user has an invalid email address on disk. |
34 String billingAddressId = helper.setProfile(new AutofillProfile("", "htt
ps://example.com", | 34 String billingAddressId = helper.setProfile(new AutofillProfile("", "htt
ps://example.com", |
35 true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "
", "90291", "", | 35 true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "
", "90291", "", |
36 "US", "333-333-3333", "jon.doe" /* invalid email address */, "en
-US")); | 36 "US", "333-333-3333", "jon.doe" /* invalid email address */, "en
-US")); |
37 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru
e, "Jon Doe", | 37 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru
e, "Jon Doe", |
38 "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_
visa, | 38 "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_
visa, |
39 billingAddressId, "" /* serverId */)); | 39 billingAddressId, "" /* serverId */)); |
40 } | 40 } |
41 | 41 |
42 /** Attempt to update the contact information with invalid data and cancel t
he transaction. */ | 42 /** Attempt to update the payer information with invalid data and cancel the
transaction. */ |
43 @MediumTest | 43 @MediumTest |
44 @Feature({"Payments"}) | 44 @Feature({"Payments"}) |
45 public void testEditIncompleteContactAndCancel() | 45 public void testEditIncompletePayerInfoAndCancel() |
46 throws InterruptedException, ExecutionException, TimeoutException { | 46 throws InterruptedException, ExecutionException, TimeoutException { |
47 triggerUIAndWait(mReadyForInput); | 47 triggerUIAndWait(mReadyForInput); |
48 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 48 clickInPayerInfoAndWait(R.id.payments_section, mReadyForInput); |
49 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); | 49 clickInPayerInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit); |
50 setTextInEditorAndWait(new String[] {"---", "jane.jones"}, mEditorTextUp
date); | 50 setTextInEditorAndWait(new String[] {"", "---", "jane.jones"}, mEditorTe
xtUpdate); |
51 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); | 51 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); |
52 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); | 52 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); |
53 clickAndWait(R.id.close_button, mDismissed); | 53 clickAndWait(R.id.close_button, mDismissed); |
54 expectResultContains(new String[] {"Request cancelled"}); | 54 expectResultContains(new String[] {"Request cancelled"}); |
55 } | 55 } |
56 | 56 |
57 /** Update the contact information with valid data and provide that to the m
erchant. */ | 57 /** Update the payer information with valid data and provide that to the mer
chant. */ |
58 @MediumTest | 58 @MediumTest |
59 @Feature({"Payments"}) | 59 @Feature({"Payments"}) |
60 public void testEditIncompleteContactAndPay() | 60 public void testEditIncompletePayerInfoAndPay() |
61 throws InterruptedException, ExecutionException, TimeoutException { | 61 throws InterruptedException, ExecutionException, TimeoutException { |
62 triggerUIAndWait(mReadyForInput); | 62 triggerUIAndWait(mReadyForInput); |
63 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 63 clickInPayerInfoAndWait(R.id.payments_section, mReadyForInput); |
64 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); | 64 clickInPayerInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit); |
65 setTextInEditorAndWait(new String[] {"555-555-5555", "jon.doe@google.com
"}, | 65 setTextInEditorAndWait(new String[] {"Jon Doe", "555-555-5555", "jon.doe
@google.com"}, |
66 mEditorTextUpdate); | 66 mEditorTextUpdate); |
67 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); | 67 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); |
68 clickAndWait(R.id.button_primary, mReadyForUnmaskInput); | 68 clickAndWait(R.id.button_primary, mReadyForUnmaskInput); |
69 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo
Unmask); | 69 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo
Unmask); |
70 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed
); | 70 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed
); |
71 expectResultContains(new String[] {"555-555-5555", "jon.doe@google.com"}
); | 71 expectResultContains(new String[] {"Jon Doe", "555-555-5555", "jon.doe@g
oogle.com"}); |
72 } | 72 } |
73 } | 73 } |
OLD | NEW |