Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java

Issue 2287513002: [Payments] Show name and address when selecting a CC billing address. (Closed)
Patch Set: Fixed error Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java
index bcf7fad60897441046021b5affee236a66c41295..8456779c8dedc55ded48cb3aa490597eb22f6465 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/PersonalDataManagerTest.java
@@ -33,6 +33,12 @@ public class PersonalDataManagerTest extends NativeLibraryTestBase {
mHelper = new AutofillTestHelper();
}
+ private AutofillProfile createTestProfile() {
+ return new AutofillProfile("" /* guid */, "https://www.example.com" /* origin */,
+ "John Major", "Acme Inc.", "123 Main", "California", "Los Angeles", "", "90210", "",
+ "US", "555 123-4567", "jm@example.com", "");
+ }
+
@SmallTest
@Feature({"Autofill"})
public void testAddAndEditProfiles() throws InterruptedException, ExecutionException,
@@ -104,13 +110,7 @@ public class PersonalDataManagerTest extends NativeLibraryTestBase {
@Feature({"Autofill"})
public void testAddAndDeleteProfile() throws InterruptedException, ExecutionException,
TimeoutException {
- AutofillProfile profile = new AutofillProfile(
- "" /* guid */, "Chrome settings" /* origin */,
- "John Smith", "Acme Inc.",
- "1 Main\nApt A", "CA", "San Francisco", "",
- "94102", "",
- "US", "4158889999", "john@acme.inc", "");
- String profileOneGUID = mHelper.setProfile(profile);
+ String profileOneGUID = mHelper.setProfile(createTestProfile());
assertEquals(1, mHelper.getNumberOfProfilesForSettings());
mHelper.deleteProfile(profileOneGUID);
@@ -318,7 +318,7 @@ public class PersonalDataManagerTest extends NativeLibraryTestBase {
// a bigger use count that the first profile. It should be second.
mHelper.setProfileUseStatsForTesting(guid3, 6, 5000);
- List<AutofillProfile> profiles = mHelper.getProfilesToSuggest();
+ List<AutofillProfile> profiles = mHelper.getProfilesToSuggest(false /* includeName */);
assertEquals(3, profiles.size());
assertTrue("Profile2 should be ranked first", guid2.equals(profiles.get(0).getGUID()));
assertTrue("Profile3 should be ranked second", guid3.equals(profiles.get(1).getGUID()));
@@ -389,10 +389,7 @@ public class PersonalDataManagerTest extends NativeLibraryTestBase {
@Feature({"Autofill"})
public void testProfileUseStatsSettingAndGetting() throws InterruptedException,
ExecutionException, TimeoutException {
- String guid = mHelper.setProfile(
- new AutofillProfile("" /* guid */, "https://www.example.com" /* origin */,
- "Jasper Lundgren", "", "1500 Second Ave", "California", "Hollywood", "",
- "90068", "", "US", "555 123-9876", "jasperl@example.com", ""));
+ String guid = mHelper.setProfile(createTestProfile());
// Make sure the profile does not have the specific use stats form the start.
assertTrue(1234 != mHelper.getProfileUseCountForTesting(guid));
@@ -433,10 +430,7 @@ public class PersonalDataManagerTest extends NativeLibraryTestBase {
@Feature({"Autofill"})
public void testRecordAndLogProfileUse() throws InterruptedException, ExecutionException,
TimeoutException {
- String guid = mHelper.setProfile(
- new AutofillProfile("" /* guid */, "https://www.example.com" /* origin */,
- "Jasper Lundgren", "", "1500 Second Ave", "California", "Hollywood", "",
- "90068", "", "US", "555 123-9876", "jasperl@example.com", ""));
+ String guid = mHelper.setProfile(createTestProfile());
// Set specific use stats for the profile.
mHelper.setProfileUseStatsForTesting(guid, 1234, 1234);
@@ -485,4 +479,26 @@ public class PersonalDataManagerTest extends NativeLibraryTestBase {
assertTrue(timeBeforeRecord <= mHelper.getCreditCardUseDateForTesting(guid));
assertTrue(timeAfterRecord >= mHelper.getCreditCardUseDateForTesting(guid));
}
+
+ @SmallTest
+ @Feature({"Autofill"})
+ public void testGetProfilesToSuggest_NoName() throws InterruptedException, ExecutionException,
+ TimeoutException {
+ mHelper.setProfile(createTestProfile());
+
+ List<AutofillProfile> profiles = mHelper.getProfilesToSuggest(false /* includeName */);
+ assertEquals("Acme Inc., 123 Main, Los Angeles, California 90210, United States",
+ profiles.get(0).getLabel());
+ }
+
+ @SmallTest
+ @Feature({"Autofill"})
+ public void testGetProfilesToSuggest_WithName() throws InterruptedException, ExecutionException,
+ TimeoutException {
+ mHelper.setProfile(createTestProfile());
+
+ List<AutofillProfile> profiles = mHelper.getProfilesToSuggest(true /* includeName */);
+ assertEquals("John Major, Acme Inc., 123 Main, Los Angeles, California 90210, "
+ + "United States", profiles.get(0).getLabel());
+ }
}

Powered by Google App Engine
This is Rietveld 408576698