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

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

Issue 440283002: Android: Get AutofillProfile summary labels from PersonalDataManagerAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: after early return Created 6 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 f1712f7dbeef6f99438df2b417a926b0ba354a2b..a3e6795608d0f871c1de67db77f7b74ff4a1e484 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", "California", "Los Angeles", "",
+ "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", "California", "Los Angeles", "",
+ "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", "California", "Hollywood", "",
+ "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", "",
+ "", "Texas", "Fort Worth", "",
+ "", "",
+ "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, Los Angeles, jm@example.com", profiles.get(0).getLabel());
+ assertEquals("123 Main, Los Angeles, jm-work@example.com", profiles.get(1).getLabel());
+ assertEquals("1500 Second Ave, Hollywood", profiles.get(2).getLabel());
+ assertEquals("Fort Worth, Texas", profiles.get(3).getLabel());
+ }
}

Powered by Google App Engine
This is Rietveld 408576698