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

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/payments/AutofillContactTest.java

Issue 2081533002: Edit contacts UI for PaymentRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contactDetails
Patch Set: Addressed comments Created 4 years, 6 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/junit/src/org/chromium/chrome/browser/payments/AutofillContactTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/payments/AutofillContactTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/payments/AutofillContactTest.java
index 4c899435f7f40e0f1332f72f0b06f1cdb05ae281..f4daa6066f29a244c6a5de32ae30031258d6bd8f 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/payments/AutofillContactTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/payments/AutofillContactTest.java
@@ -4,6 +4,8 @@
package org.chromium.chrome.browser.payments;
+import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
+
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -21,23 +23,28 @@ public class AutofillContactTest {
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
- {"j@d.co", "555-5555", "555-5555", "j@d.co", "j@d.co", "555-5555"},
- {"j@d.co", null, "j@d.co", null, "j@d.co", null},
- {null, "555-5555", "555-5555", null, null, "555-5555"},
+ {"555-5555", "j@d.co", true, "555-5555", "j@d.co", "j@d.co", "555-5555"},
+ {null, "j@d.co", true, "j@d.co", null, "j@d.co", null},
+ {"", "j@d.co", true, "j@d.co", null, "j@d.co", null},
+ {"555-5555", null, true, "555-5555", null, null, "555-5555"},
+ {"555-5555", "", false, "555-5555", null, null, "555-5555"},
});
}
- private final String mPayerEmail;
private final String mPayerPhone;
+ private final String mPayerEmail;
+ private final boolean mIsComplete;
private final String mExpectedLabel;
private final String mExpectedSublabel;
private final String mExpectedPayerEmail;
private final String mExpectedPayerPhone;
- public AutofillContactTest(String payerEmail, String payerPhone, String expectedLabel,
- String expectedSublabel, String expectedPayerEmail, String expectedPayerPhone) {
- mPayerEmail = payerEmail;
+ public AutofillContactTest(String payerPhone, String payerEmail, boolean isComplete,
+ String expectedLabel, String expectedSublabel, String expectedPayerEmail,
+ String expectedPayerPhone) {
mPayerPhone = payerPhone;
+ mPayerEmail = payerEmail;
+ mIsComplete = isComplete;
mExpectedLabel = expectedLabel;
mExpectedSublabel = expectedSublabel;
mExpectedPayerEmail = expectedPayerEmail;
@@ -46,15 +53,29 @@ public class AutofillContactTest {
@Test
public void test() {
- AutofillContact contact = new AutofillContact(mPayerEmail, mPayerPhone);
-
- Assert.assertEquals("Label should be " + mExpectedLabel,
- mExpectedLabel, contact.getLabel());
- Assert.assertEquals("Sublabel should be " + mExpectedSublabel,
- mExpectedSublabel, contact.getSublabel());
- Assert.assertEquals("Email should be " + mExpectedPayerEmail,
- mExpectedPayerEmail, contact.getPayerEmail());
- Assert.assertEquals("Phone should be " + mExpectedPayerPhone,
- mExpectedPayerPhone, contact.getPayerPhone());
+ AutofillProfile profile = new AutofillProfile();
+ AutofillContact contact =
+ new AutofillContact(profile, mPayerPhone, mPayerEmail, mIsComplete);
+
+ Assert.assertEquals(mIsComplete, contact.isComplete());
+ Assert.assertEquals(profile, contact.getProfile());
+ Assert.assertEquals(profile.getGUID(), contact.getIdentifier());
+ assertPhoneEmailLabelSublabel(mExpectedPayerPhone, mExpectedPayerEmail, mExpectedLabel,
+ mExpectedSublabel, contact);
+
+ contact.completeContact("999-9999", "a@b.com");
+ Assert.assertTrue(contact.isComplete());
+ assertPhoneEmailLabelSublabel("999-9999", "a@b.com", "999-9999", "a@b.com", contact);
+ }
+
+ private void assertPhoneEmailLabelSublabel(String expectedPhone, String expectedEmail,
+ String expectedLabel, String expectedSublabel, AutofillContact actual) {
+ Assert.assertEquals(
+ "Phone should be " + expectedPhone, expectedPhone, actual.getPayerPhone());
+ Assert.assertEquals(
+ "Email should be " + expectedEmail, expectedEmail, actual.getPayerEmail());
+ Assert.assertEquals("Label should be " + expectedLabel, expectedLabel, actual.getLabel());
+ Assert.assertEquals(
+ "Sublabel should be " + expectedSublabel, expectedSublabel, actual.getSublabel());
}
}

Powered by Google App Engine
This is Rietveld 408576698