| 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 f1712f7dbeef6f99438df2b417a926b0ba354a2b..23cd0372c83824d99272471d08a07ec4948db58c 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
|
| @@ -11,6 +11,7 @@ import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
|
| import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
|
| import org.chromium.chrome.shell.ChromeShellTestBase;
|
|
|
| +import java.util.List;
|
| import java.util.concurrent.ExecutionException;
|
|
|
| /**
|
| @@ -220,4 +221,48 @@ public class PersonalDataManagerTest extends ChromeShellTestBase {
|
| AutofillProfile storedProfile2 = mHelper.getProfile(profileGuid2);
|
| assertEquals(streetAddress2, storedProfile2.getStreetAddress());
|
| }
|
| +
|
| + @SmallTest
|
| + @Feature({"Autofill"})
|
| + public void testLabels() throws InterruptedException, ExecutionException {
|
| + AutofillProfile profile1 = new AutofillProfile(
|
| + "" /* guid */, "https://www.example.com" /* origin */,
|
| + "John Major", "Acme Inc.",
|
| + "123 Main", "Los Angeles", "California", "",
|
| + "90210", "",
|
| + "US", "555 123-4567", "jm@example.com", "");
|
| + // An almost identical profile.
|
| + AutofillProfile profile2 = new AutofillProfile(
|
| + "" /* guid */, "https://www.example.com" /* origin */,
|
| + "John Major", "Acme Inc.",
|
| + "123 Main", "Los Angeles", "California", "",
|
| + "90210", "",
|
| + "US", "555 123-4567", "jm-work@example.com", "");
|
| + // A different profile.
|
| + AutofillProfile profile3 = new AutofillProfile(
|
| + "" /* guid */, "https://www.example.com" /* origin */,
|
| + "Jasper Lundgren", "",
|
| + "1500 Second Ave", "Los Angeles", "California", "",
|
| + "90068", "",
|
| + "US", "555 123-9876", "jasperl@example.com", "");
|
| + // A profile where a lot of stuff is missing.
|
| + AutofillProfile profile4 = new AutofillProfile(
|
| + "" /* guid */, "https://www.example.com" /* origin */,
|
| + "Joe Sergeant", "",
|
| + "", "Los Angeles", "California", "",
|
| + "", "",
|
| + "US", "", "", "");
|
| +
|
| + mHelper.setProfile(profile1);
|
| + mHelper.setProfile(profile2);
|
| + mHelper.setProfile(profile3);
|
| + mHelper.setProfile(profile4);
|
| +
|
| + List<AutofillProfile> profiles = mHelper.getProfiles();
|
| + assertEquals(4, profiles.size());
|
| + assertEquals("123 Main, jm@example.com", profiles.get(0).getLabel());
|
| + assertEquals("123 Main, jm-work@example.com", profiles.get(1).getLabel());
|
| + assertEquals("1500 Second Ave, Los Angeles", profiles.get(2).getLabel());
|
| + assertEquals("Los Angeles, California", profiles.get(3).getLabel());
|
| + }
|
| }
|
|
|