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

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

Issue 2368073002: PaymentRequest: Add payer name field to payer info editor. (android) (Closed)
Patch Set: PaymentRequest: Add payer name field to payer info editor. (android) Created 4 years, 2 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 60596a84a83622af4afe8ed5cac52f3da2fcd5b7..48c1d10e73fc1794ad0b59944234ae290bc5080a 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,14 +4,14 @@
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;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
+import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
+
import java.util.Arrays;
import java.util.Collection;
@@ -23,58 +23,98 @@ public class AutofillContactTest {
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
- {"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"},
+ {"Jon Doe", "555-5555", "j@d.co", true,
+ "Jon Doe", "555-5555", "j@d.co",
+ "Jon Doe", "555-5555", "j@d.co"},
+ {null, "555-5555", "j@d.co", true,
+ "555-5555", "j@d.co", null,
+ null, "555-5555", "j@d.co"},
+ {"", "555-5555", "j@d.co", true,
+ "555-5555", "j@d.co", null,
+ null, "555-5555", "j@d.co"},
+ {"Jon Doe", null, "j@d.co", true,
+ "Jon Doe", "j@d.co", null,
+ "Jon Doe", null, "j@d.co"},
+ {"Jon Doe", "", "j@d.co", true,
+ "Jon Doe", "j@d.co", null,
+ "Jon Doe", null, "j@d.co"},
+ {"Jon Doe", "555-5555", null, true,
+ "Jon Doe", "555-5555", null,
+ "Jon Doe", "555-5555", null},
+ {"Jon Doe", "555-5555", "", true,
+ "Jon Doe", "555-5555", null,
+ "Jon Doe", "555-5555", null},
+ {null, "555-5555", null, true,
+ "555-5555", null, null,
+ null, "555-5555", null},
+ {"", "555-5555", "", true,
+ "555-5555", null, null,
+ null, "555-5555", null},
+ {null, null, "j@d.co", true,
+ "j@d.co", null, null,
+ null, null, "j@d.co"},
+ {"", "", "j@d.co", true,
+ "j@d.co", null, null,
+ null, null, "j@d.co"},
+ {"", "555-5555", "", false,
+ "555-5555", null, null,
+ null, "555-5555", null}
});
}
+ private final String mPayerName;
private final String mPayerPhone;
private final String mPayerEmail;
private final boolean mIsComplete;
private final String mExpectedLabel;
private final String mExpectedSublabel;
+ private final String mExpectedTertiaryLabel;
+ private final String mExpectedPayerName;
private final String mExpectedPayerEmail;
private final String mExpectedPayerPhone;
- public AutofillContactTest(String payerPhone, String payerEmail, boolean isComplete,
- String expectedLabel, String expectedSublabel, String expectedPayerEmail,
- String expectedPayerPhone) {
+ public AutofillContactTest(String payerName, String payerPhone, String payerEmail,
+ boolean isComplete, String expectedLabel, String expectedSublabel,
+ String expectedTertiaryLabel, String expectedPayerName, String expectedPayerPhone,
+ String expectedPayerEmail) {
+ mPayerName = payerName;
mPayerPhone = payerPhone;
mPayerEmail = payerEmail;
mIsComplete = isComplete;
mExpectedLabel = expectedLabel;
mExpectedSublabel = expectedSublabel;
- mExpectedPayerEmail = expectedPayerEmail;
+ mExpectedTertiaryLabel = expectedTertiaryLabel;
+ mExpectedPayerName = expectedPayerName;
mExpectedPayerPhone = expectedPayerPhone;
+ mExpectedPayerEmail = expectedPayerEmail;
}
@Test
public void test() {
AutofillProfile profile = new AutofillProfile();
AutofillContact contact =
- new AutofillContact(profile, mPayerPhone, mPayerEmail, mIsComplete);
+ new AutofillContact(profile, mPayerName, mPayerPhone, mPayerEmail, mIsComplete);
Assert.assertEquals(
mIsComplete ? "Contact should be complete" : "Contact should be incomplete",
mIsComplete, contact.isComplete());
Assert.assertEquals("Contact's profile should be the same as passed into the constructor",
profile, contact.getProfile());
- assertIdPhoneEmailLabelSublabel(profile.getGUID(), mExpectedPayerPhone, mExpectedPayerEmail,
- mExpectedLabel, mExpectedSublabel, contact);
+ assertContact(profile.getGUID(), mExpectedPayerName, mExpectedPayerPhone,
+ mExpectedPayerEmail, mExpectedLabel, mExpectedSublabel, mExpectedTertiaryLabel,
+ contact);
- contact.completeContact("some-guid-here", "999-9999", "a@b.com");
+ contact.completeContact("some-guid-here", "Jon Doe", "999-9999", "a@b.com");
Assert.assertTrue("Contact should be complete", contact.isComplete());
- assertIdPhoneEmailLabelSublabel("some-guid-here", "999-9999", "a@b.com", "999-9999",
- "a@b.com", contact);
+ assertContact("some-guid-here", "Jon Doe", "999-9999", "a@b.com",
+ "Jon Doe", "999-9999", "a@b.com", contact);
}
- private void assertIdPhoneEmailLabelSublabel(String id, String expectedPhone,
+ private void assertContact(String id, String expectedName, String expectedPhone,
String expectedEmail, String expectedLabel, String expectedSublabel,
- AutofillContact actual) {
+ String expectedTertiaryLabel, AutofillContact actual) {
Assert.assertEquals("Identifier should be " + id, id, actual.getIdentifier());
+ Assert.assertEquals("Name should be " + expectedName, expectedName, actual.getPayerName());
Assert.assertEquals(
"Phone should be " + expectedPhone, expectedPhone, actual.getPayerPhone());
Assert.assertEquals(
@@ -82,5 +122,7 @@ public class AutofillContactTest {
Assert.assertEquals("Label should be " + expectedLabel, expectedLabel, actual.getLabel());
Assert.assertEquals(
"Sublabel should be " + expectedSublabel, expectedSublabel, actual.getSublabel());
+ Assert.assertEquals("TertiaryLabel should be " + expectedTertiaryLabel,
+ expectedTertiaryLabel, actual.getTertiaryLabel());
}
}

Powered by Google App Engine
This is Rietveld 408576698