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 static org.chromium.chrome.browser.payments.PaymentRequestTestRule.DECEMB
ER; | 7 import static org.chromium.chrome.browser.payments.PaymentRequestTestRule.DECEMB
ER; |
8 import static org.chromium.chrome.browser.payments.PaymentRequestTestRule.FIRST_
BILLING_ADDRESS; | 8 import static org.chromium.chrome.browser.payments.PaymentRequestTestRule.FIRST_
BILLING_ADDRESS; |
9 import static org.chromium.chrome.browser.payments.PaymentRequestTestRule.NEXT_Y
EAR; | 9 import static org.chromium.chrome.browser.payments.PaymentRequestTestRule.NEXT_Y
EAR; |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 private static final int BILLING_ADDRESS_DROPDOWN_INDEX = 2; | 52 private static final int BILLING_ADDRESS_DROPDOWN_INDEX = 2; |
53 | 53 |
54 @Override | 54 @Override |
55 public void onMainActivityStarted() | 55 public void onMainActivityStarted() |
56 throws InterruptedException, ExecutionException, TimeoutException { | 56 throws InterruptedException, ExecutionException, TimeoutException { |
57 AutofillTestHelper helper = new AutofillTestHelper(); | 57 AutofillTestHelper helper = new AutofillTestHelper(); |
58 String profile1 = helper.setProfile(new AutofillProfile("", "https://exa
mple.com", true, | 58 String profile1 = helper.setProfile(new AutofillProfile("", "https://exa
mple.com", true, |
59 "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90
291", "", "US", | 59 "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90
291", "", "US", |
60 "650-253-0000", "jon.doe@gmail.com", "en-US")); | 60 "650-253-0000", "jon.doe@gmail.com", "en-US")); |
61 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru
e, "Jon Doe", | 61 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru
e, "Jon Doe", |
62 "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_
visa, profile1, | 62 "4111111111111111", "1111", "12", "2050", "visa", R.drawable.vis
a_card, profile1, |
63 "" /* serverId */)); | 63 "" /* serverId */)); |
64 String profile2 = helper.setProfile(new AutofillProfile("", "https://exa
mple.com", true, | 64 String profile2 = helper.setProfile(new AutofillProfile("", "https://exa
mple.com", true, |
65 "Rob Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90
291", "", "US", | 65 "Rob Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90
291", "", "US", |
66 "650-253-0000", "jon.doe@gmail.com", "en-US")); | 66 "650-253-0000", "jon.doe@gmail.com", "en-US")); |
67 String profile3 = helper.setProfile(new AutofillProfile("", "https://exa
mple.com", true, | 67 String profile3 = helper.setProfile(new AutofillProfile("", "https://exa
mple.com", true, |
68 "Tom Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90
291", "", "US", | 68 "Tom Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90
291", "", "US", |
69 "650-253-0000", "jon.doe@gmail.com", "en-US")); | 69 "650-253-0000", "jon.doe@gmail.com", "en-US")); |
70 | 70 |
71 // Incomplete profile (invalid address). | 71 // Incomplete profile (invalid address). |
72 String profile4 = helper.setProfile(new AutofillProfile("", "https://exa
mple.com", true, | 72 String profile4 = helper.setProfile(new AutofillProfile("", "https://exa
mple.com", true, |
(...skipping 14 matching lines...) Expand all Loading... |
87 String profile7 = helper.setProfile(new AutofillProfile("", "https://exa
mple.com", true, "", | 87 String profile7 = helper.setProfile(new AutofillProfile("", "https://exa
mple.com", true, "", |
88 "Google", "340 Main St", "CA", "", "", "90291", "", "US", "", ""
, "en-US")); | 88 "Google", "340 Main St", "CA", "", "", "90291", "", "US", "", ""
, "en-US")); |
89 | 89 |
90 // Profile with empty street address (should not be presented to user). | 90 // Profile with empty street address (should not be presented to user). |
91 String profile8 = helper.setProfile(new AutofillProfile("", "https://exa
mple.com", true, | 91 String profile8 = helper.setProfile(new AutofillProfile("", "https://exa
mple.com", true, |
92 "Jerry Doe", "Google", "" /* streetAddress */, "CA", "Los Angele
s", "", "90291", "", | 92 "Jerry Doe", "Google", "" /* streetAddress */, "CA", "Los Angele
s", "", "90291", "", |
93 "US", "650-253-0000", "jerry.doe@gmail.com", "en-US")); | 93 "US", "650-253-0000", "jerry.doe@gmail.com", "en-US")); |
94 | 94 |
95 // This card has no billing address selected. | 95 // This card has no billing address selected. |
96 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru
e, "Jane Doe", | 96 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru
e, "Jane Doe", |
97 "4242424242424242", "1111", "12", "2050", "visa", R.drawable.pr_
visa, profile6, | 97 "4242424242424242", "1111", "12", "2050", "visa", R.drawable.vis
a_card, profile6, |
98 "" /* serverId */)); | 98 "" /* serverId */)); |
99 | 99 |
100 // Assign use stats so that incomplete profiles have the highest frecenc
y, profile2 has the | 100 // Assign use stats so that incomplete profiles have the highest frecenc
y, profile2 has the |
101 // highest frecency and profile3 has the lowest among the complete profi
les, and profile8 | 101 // highest frecency and profile3 has the lowest among the complete profi
les, and profile8 |
102 // has the highest frecency and profile4 has the lowest among the incomp
lete profiles. | 102 // has the highest frecency and profile4 has the lowest among the incomp
lete profiles. |
103 helper.setProfileUseStatsForTesting(profile1, 5, 5); | 103 helper.setProfileUseStatsForTesting(profile1, 5, 5); |
104 helper.setProfileUseStatsForTesting(profile2, 10, 10); | 104 helper.setProfileUseStatsForTesting(profile2, 10, 10); |
105 helper.setProfileUseStatsForTesting(profile3, 1, 1); | 105 helper.setProfileUseStatsForTesting(profile3, 1, 1); |
106 helper.setProfileUseStatsForTesting(profile4, 15, 15); | 106 helper.setProfileUseStatsForTesting(profile4, 15, 15); |
107 helper.setProfileUseStatsForTesting(profile5, 30, 30); | 107 helper.setProfileUseStatsForTesting(profile5, 30, 30); |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 mPaymentRequestTestRule.clickInEditorAndWait( | 496 mPaymentRequestTestRule.clickInEditorAndWait( |
497 R.id.payments_edit_cancel_button, mPaymentRequestTestRule.getRea
dyToEdit()); | 497 R.id.payments_edit_cancel_button, mPaymentRequestTestRule.getRea
dyToEdit()); |
498 | 498 |
499 // The previous selected address should be selected after canceling out
from edit. | 499 // The previous selected address should be selected after canceling out
from edit. |
500 Assert.assertTrue( | 500 Assert.assertTrue( |
501 mPaymentRequestTestRule | 501 mPaymentRequestTestRule |
502 .getSpinnerSelectionTextInCardEditor(BILLING_ADDRESS_DRO
PDOWN_INDEX) | 502 .getSpinnerSelectionTextInCardEditor(BILLING_ADDRESS_DRO
PDOWN_INDEX) |
503 .equals("Jon Doe, 340 Main St, Los Angeles, CA 90291")); | 503 .equals("Jon Doe, 340 Main St, Los Angeles, CA 90291")); |
504 } | 504 } |
505 } | 505 } |
OLD | NEW |