| 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..50856a130bc5c8652e3355feab2b3273568d24a7 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,26 @@ 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"},
|
| + {"j@d.co", "555-5555", true, "555-5555", "j@d.co", "j@d.co", "555-5555"},
|
| + {"j@d.co", null, true, "j@d.co", null, "j@d.co", null},
|
| + {null, "555-5555", true, "555-5555", null, null, "555-5555"},
|
| });
|
| }
|
|
|
| private final String mPayerEmail;
|
| private final String mPayerPhone;
|
| + 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) {
|
| + public AutofillContactTest(String payerEmail, String payerPhone, boolean isComplete,
|
| + String expectedLabel, String expectedSublabel, String expectedPayerEmail,
|
| + String expectedPayerPhone) {
|
| mPayerEmail = payerEmail;
|
| mPayerPhone = payerPhone;
|
| + mIsComplete = isComplete;
|
| mExpectedLabel = expectedLabel;
|
| mExpectedSublabel = expectedSublabel;
|
| mExpectedPayerEmail = expectedPayerEmail;
|
| @@ -46,15 +51,34 @@ 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("guid" /* guid */,
|
| + "http://example.com" /* origin */, true /* isLocal */, "" /* fullName */,
|
| + "" /* companyName */, "" /* streetAddress */, "" /* region */, "" /* locality */,
|
| + "" /* dependentLocality */, "" /* postalCode */, "" /* sortingCode */, "US",
|
| + mPayerPhone, mPayerEmail, "en-US");
|
| + AutofillContact contact =
|
| + new AutofillContact(profile, mPayerEmail, mPayerPhone, mIsComplete);
|
| +
|
| + Assert.assertEquals(profile, contact.getProfile());
|
| + Assert.assertEquals("guid", contact.getIdentifier());
|
| + 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());
|
| +
|
| + contact.setPayerEmail("a@b.com");
|
| + contact.setPayerPhone("999-9999");
|
| + Assert.assertEquals("a@b.com", contact.getPayerEmail());
|
| + Assert.assertEquals("999-9999", contact.getPayerPhone());
|
| + Assert.assertEquals("999-9999", contact.getLabel());
|
| + Assert.assertEquals("a@b.com", contact.getSublabel());
|
| +
|
| + Assert.assertEquals(mIsComplete, contact.isComplete());
|
| + contact.setComplete();
|
| + Assert.assertTrue(contact.isComplete());
|
| }
|
| }
|
|
|