Commit 6e4945b0 authored by Jeffrey Cohen's avatar Jeffrey Cohen Committed by Commit Bot

Reland "Add FieldTrial Testing config for Company Name Test in Beta"

TBR=mpearson@chromium.org
This is a reland of 3244db37

Original change's description:
> Add FieldTrial Testing config for Company Name Test in Beta
>
>
> Bug: 890972
> Change-Id: Ib1aad147f260a1fd84df4d6ad9fc761742e16491
> Reviewed-on: https://chromium-review.googlesource.com/c/1385547
> Reviewed-by: Theresa <twellington@chromium.org>
> Reviewed-by: Ganggui Tang <gogerald@chromium.org>
> Reviewed-by: Mark Pearson <mpearson@chromium.org>
> Commit-Queue: Jeffrey Cohen <jeffreycohen@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#622647}

Bug: 890972
Change-Id: I63e7c059bc4d2d3d0cf8ba390a95394566c43a15
Reviewed-on: https://chromium-review.googlesource.com/c/1427101Reviewed-by: default avatarMark Pearson <mpearson@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Reviewed-by: default avatarRoger McFarlane <rogerm@chromium.org>
Commit-Queue: Jeffrey Cohen <jeffreycohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625447}
parent 335e6b27
......@@ -156,6 +156,7 @@ public abstract class ChromeFeatureList {
"AllowStartingServiceManagerOnly";
public static final String AUTOFILL_ALLOW_NON_HTTP_ACTIVATION =
"AutofillAllowNonHttpActivation";
public static final String AUTOFILL_ENABLE_COMPANY_NAME = "AutofillEnableCompanyName";
public static final String ADJUST_WEBAPK_INSTALLATION_SPACE = "AdjustWebApkInstallationSpace";
public static final String ANDROID_NIGHT_MODE = "AndroidNightMode";
public static final String ANDROID_PAY_INTEGRATION_V1 = "AndroidPayIntegrationV1";
......
......@@ -18,6 +18,7 @@ import org.junit.runner.RunWith;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.autofill.AutofillTestHelper;
import org.chromium.chrome.browser.autofill.CardType;
......@@ -324,10 +325,17 @@ public class PaymentRequestBillingAddressTest implements MainActivityStartCallba
mPaymentRequestTestRule.setSpinnerSelectionsInCardEditorAndWait(
new int[] {DECEMBER, NEXT_YEAR, ADD_BILLING_ADDRESS},
mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Seb Doe", "Google", "340 Main St", "Los Angeles", "CA", "90291",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Seb Doe", "Google", "340 Main St", "Los Angeles", "CA", "90291",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
} else {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {
"Seb Doe", "340 Main St", "Los Angeles", "CA", "90291", "650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
}
mPaymentRequestTestRule.clickInEditorAndWait(
R.id.editor_dialog_done_button, mPaymentRequestTestRule.getReadyToEdit());
......@@ -382,10 +390,17 @@ public class PaymentRequestBillingAddressTest implements MainActivityStartCallba
R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
mPaymentRequestTestRule.clickInShippingAddressAndWait(
R.id.payments_add_option_button, mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Seb Doe", "Google", "340 Main St", "Los Angeles", "CA", "90291",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Seb Doe", "Google", "340 Main St", "Los Angeles", "CA", "90291",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
} else {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {
"Seb Doe", "340 Main St", "Los Angeles", "CA", "90291", "650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
}
mPaymentRequestTestRule.clickInEditorAndWait(
R.id.editor_dialog_done_button, mPaymentRequestTestRule.getReadyToPay());
......@@ -445,10 +460,17 @@ public class PaymentRequestBillingAddressTest implements MainActivityStartCallba
// recipient name brings up the address editor.
mPaymentRequestTestRule.setSpinnerSelectionsInCardEditorAndWait(
new int[] {DECEMBER, NEXT_YEAR, 5}, mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Lisa Doh", "Google", "340 Main St", "Los Angeles", "CA", "90291",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Lisa Doh", "Google", "340 Main St", "Los Angeles", "CA", "90291",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
} else {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Lisa Doh", "340 Main St", "Los Angeles", "CA", "90291",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
}
mPaymentRequestTestRule.clickInEditorAndWait(
R.id.editor_dialog_done_button, mPaymentRequestTestRule.getReadyToEdit());
......
......@@ -18,6 +18,7 @@ import org.junit.runner.RunWith;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.autofill.AutofillTestHelper;
import org.chromium.chrome.browser.autofill.CardType;
......@@ -149,10 +150,16 @@ public class PaymentRequestBillingAddressWithoutPhoneTest implements MainActivit
mPaymentRequestTestRule.setSpinnerSelectionsInCardEditorAndWait(
new int[] {DECEMBER, NEXT_YEAR, ADD_BILLING_ADDRESS},
mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Seb Doe", "Google", "340 Main St", "Los Angeles", "CA", "90291", ""},
mPaymentRequestTestRule.getEditorTextUpdate());
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {
"Seb Doe", "Google", "340 Main St", "Los Angeles", "CA", "90291", ""},
mPaymentRequestTestRule.getEditorTextUpdate());
} else {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Seb Doe", "340 Main St", "Los Angeles", "CA", "90291", ""},
mPaymentRequestTestRule.getEditorTextUpdate());
}
// Trying to add the address without a phone number should fail.
mPaymentRequestTestRule.clickInEditorAndWait(
R.id.editor_dialog_done_button, mPaymentRequestTestRule.getEditorValidationError());
......
......@@ -15,6 +15,7 @@ import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.autofill.AutofillTestHelper;
import org.chromium.chrome.browser.autofill.CardType;
......@@ -105,10 +106,17 @@ public class PaymentRequestEmailAndFreeShippingTest implements MainActivityStart
R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
mPaymentRequestTestRule.clickInShippingAddressAndWait(
R.id.payments_add_option_button, mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Bob", "Google", "1600 Amphitheatre Pkwy", "Mountain View", "CA",
"94043", "650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Bob", "Google", "1600 Amphitheatre Pkwy", "Mountain View", "CA",
"94043", "650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
} else {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Bob", "1600 Amphitheatre Pkwy", "Mountain View", "CA", "94043",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
}
mPaymentRequestTestRule.clickInEditorAndWait(
R.id.editor_dialog_done_button, mPaymentRequestTestRule.getReadyForInput());
mPaymentRequestTestRule.clickAndWait(
......
......@@ -17,6 +17,7 @@ import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.FlakyTest;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.autofill.AutofillTestHelper;
import org.chromium.chrome.browser.autofill.CardType;
......@@ -108,10 +109,17 @@ public class PaymentRequestFreeShippingTest implements MainActivityStartCallback
R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
mPaymentRequestTestRule.clickInShippingAddressAndWait(
R.id.payments_add_option_button, mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Bob", "Google", "1600 Amphitheatre Pkwy", "Mountain View", "CA",
"94043", "650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Bob", "Google", "1600 Amphitheatre Pkwy", "Mountain View", "CA",
"94043", "650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
} else {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Bob", "1600 Amphitheatre Pkwy", "Mountain View", "CA", "94043",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
}
mPaymentRequestTestRule.clickInEditorAndWait(
R.id.editor_dialog_done_button, mPaymentRequestTestRule.getReadyToPay());
mPaymentRequestTestRule.clickAndWait(
......@@ -137,10 +145,16 @@ public class PaymentRequestFreeShippingTest implements MainActivityStartCallback
R.id.payments_add_option_button, mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setSpinnerSelectionInEditorAndWait(
0 /* Afghanistan */, mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {
"Alice", "Supreme Court", "Airport Road", "Kabul", "1043", "020-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Alice", "Supreme Court", "Airport Road", "Kabul", "1043",
"020-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
} else {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Alice", "Airport Road", "Kabul", "1043", "020-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
}
mPaymentRequestTestRule.clickInEditorAndWait(
R.id.editor_dialog_done_button, mPaymentRequestTestRule.getReadyToPay());
mPaymentRequestTestRule.clickAndWait(
......@@ -149,8 +163,13 @@ public class PaymentRequestFreeShippingTest implements MainActivityStartCallback
R.id.card_unmask_input, "123", mPaymentRequestTestRule.getReadyToUnmask());
mPaymentRequestTestRule.clickCardUnmaskButtonAndWait(
ModalDialogProperties.ButtonType.POSITIVE, mPaymentRequestTestRule.getDismissed());
mPaymentRequestTestRule.expectResultContains(new String[] {
"Alice", "Supreme Court", "Airport Road", "Kabul", "1043", "+93202530000"});
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
mPaymentRequestTestRule.expectResultContains(new String[] {
"Alice", "Supreme Court", "Airport Road", "Kabul", "1043", "+93202530000"});
} else {
mPaymentRequestTestRule.expectResultContains(
new String[] {"Alice", "Airport Road", "Kabul", "1043", "+93202530000"});
}
}
/** Quickly pressing on "add address" and then [X] should not crash. */
......
......@@ -17,6 +17,7 @@ import org.junit.runner.RunWith;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.autofill.AutofillTestHelper;
import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
......@@ -69,10 +70,17 @@ public class PaymentRequestIncompleteContactDetailsAndFreeShippingTest
"Phone number required"));
mPaymentRequestTestRule.clickInShippingAddressAndWait(
R.id.payments_first_radio_button, mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Jon Doe", "Google", "340 Main St", "Los Angeles", "CA", "90291",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Jon Doe", "Google", "340 Main St", "Los Angeles", "CA", "90291",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
} else {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {
"Jon Doe", "340 Main St", "Los Angeles", "CA", "90291", "650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
}
// The contact is now complete, but not selected.
mPaymentRequestTestRule.clickInEditorAndWait(
R.id.editor_dialog_done_button, mPaymentRequestTestRule.getReadyForInput());
......@@ -107,10 +115,17 @@ public class PaymentRequestIncompleteContactDetailsAndFreeShippingTest
// Add a new Shipping Address and see that the contact section updates.
mPaymentRequestTestRule.clickInShippingAddressAndWait(
R.id.payments_add_option_button, mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Jane Doe", "Edge Corp.", "111 Wall St.", "New York", "NY", "10110",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Jane Doe", "Edge Corp.", "111 Wall St.", "New York", "NY",
"10110", "650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
} else {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {
"Jane Doe", "111 Wall St.", "New York", "NY", "10110", "650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
}
mPaymentRequestTestRule.clickInEditorAndWait(
R.id.editor_dialog_done_button, mPaymentRequestTestRule.getReadyForInput());
Assert.assertEquals("Jon Doe\njon.doe@google.com\nPhone number required",
......
......@@ -24,6 +24,7 @@ import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.RetryOnFailure;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.autofill.AutofillTestHelper;
import org.chromium.chrome.browser.autofill.CardType;
......@@ -206,10 +207,16 @@ public class PaymentRequestJourneyLoggerTest implements MainActivityStartCallbac
R.id.payments_add_option_button, mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setSpinnerSelectionInEditorAndWait(
0 /* Afghanistan */, mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {
"Alice", "Supreme Court", "Airport Road", "Kabul", "1043", "020-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Alice", "Supreme Court", "Airport Road", "Kabul", "1043",
"020-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
} else {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Alice", "Airport Road", "Kabul", "1043", "020-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
}
mPaymentRequestTestRule.clickInEditorAndWait(
R.id.editor_dialog_done_button, mPaymentRequestTestRule.getReadyToPay());
......
......@@ -22,6 +22,7 @@ import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.autofill.AutofillTestHelper;
import org.chromium.chrome.browser.autofill.CardType;
......@@ -246,11 +247,17 @@ public class PaymentRequestNoShippingTest implements MainActivityStartCallback {
mPaymentRequestTestRule.setSpinnerSelectionsInCardEditorAndWait(
new int[] {DECEMBER, NEXT_YEAR, addBillingAddress},
mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Bob", "Google", "1600 Amphitheatre Pkwy", "Mountain View", "CA",
"94043", "650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Bob", "Google", "1600 Amphitheatre Pkwy", "Mountain View", "CA",
"94043", "650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
} else {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Bob", "1600 Amphitheatre Pkwy", "Mountain View", "CA", "94043",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
}
mPaymentRequestTestRule.clickInEditorAndWait(
R.id.editor_dialog_done_button, mPaymentRequestTestRule.getReadyToEdit());
......@@ -262,9 +269,15 @@ public class PaymentRequestNoShippingTest implements MainActivityStartCallback {
R.id.card_unmask_input, "123", mPaymentRequestTestRule.getReadyToUnmask());
mPaymentRequestTestRule.clickCardUnmaskButtonAndWait(
ModalDialogProperties.ButtonType.POSITIVE, mPaymentRequestTestRule.getDismissed());
mPaymentRequestTestRule.expectResultContains(
new String[] {"5454545454545454", "12", "Bob", "Google", "1600 Amphitheatre Pkwy",
"Mountain View", "CA", "94043", "+16502530000"});
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
mPaymentRequestTestRule.expectResultContains(new String[] {"5454545454545454", "12",
"Bob", "Google", "1600 Amphitheatre Pkwy", "Mountain View", "CA", "94043",
"+16502530000"});
} else {
mPaymentRequestTestRule.expectResultContains(
new String[] {"5454545454545454", "12", "Bob", "1600 Amphitheatre Pkwy",
"Mountain View", "CA", "94043", "+16502530000"});
}
}
/** Quickly pressing on "add card" and then [X] should not crash. */
......
......@@ -14,6 +14,7 @@ import org.junit.runner.RunWith;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.autofill.AutofillTestHelper;
import org.chromium.chrome.browser.autofill.CardType;
......@@ -147,19 +148,30 @@ public class PaymentRequestShippingAddressAndOptionTest implements MainActivityS
R.id.payments_section, mPaymentRequestTestRule.getReadyForInput());
mPaymentRequestTestRule.clickInShippingAddressAndWait(
R.id.payments_add_option_button, mPaymentRequestTestRule.getReadyToEdit());
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Seb Doe", "Google", "340 Main St", "Los Angeles", "CA", "90291",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
Boolean is_company_name_enabled =
ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME);
if (is_company_name_enabled) {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {"Seb Doe", "Google", "340 Main St", "Los Angeles", "CA", "90291",
"650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
} else {
mPaymentRequestTestRule.setTextInEditorAndWait(
new String[] {
"Seb Doe", "340 Main St", "Los Angeles", "CA", "90291", "650-253-0000"},
mPaymentRequestTestRule.getEditorTextUpdate());
}
mPaymentRequestTestRule.clickInEditorAndWait(
R.id.editor_dialog_done_button, mPaymentRequestTestRule.getReadyToPay());
// Make sure that the shipping label does not include the country.
Assert.assertTrue(mPaymentRequestTestRule.getShippingAddressOptionRowAtIndex(0)
.getLabelText()
.toString()
.equals("Seb Doe\nGoogle, 340 Main St, Los Angeles, CA 90291\n"
+ "+1 650-253-0000"));
Assert.assertEquals(mPaymentRequestTestRule.getShippingAddressOptionRowAtIndex(0)
.getLabelText()
.toString(),
is_company_name_enabled ? "Seb Doe\nGoogle, 340 Main St, Los Angeles, CA 90291\n"
+ "+1 650-253-0000"
: "Seb Doe\n340 Main St, Los Angeles, CA 90291\n"
+ "+1 650-253-0000");
}
/**
......
......@@ -20,6 +20,7 @@ import org.chromium.base.ThreadUtils;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Feature;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.autofill.AutofillTestHelper;
import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
import org.chromium.chrome.browser.preferences.Preferences;
......@@ -35,6 +36,7 @@ import java.util.concurrent.TimeoutException;
/**
* Unit test suite for AutofillProfilesFragment.
*/
@RunWith(BaseJUnit4ClassRunner.class)
public class AutofillProfilesFragmentTest {
@Rule
......@@ -79,10 +81,19 @@ public class AutofillProfilesFragmentTest {
Assert.assertNotNull(addProfile);
// Add a profile.
updatePreferencesAndWait(autofillProfileFragment, addProfile,
new String[] {"Alice Doe", "Google", "111 Added St", "Los Angeles",
"CA", "90291", "650-253-0000", "add@profile.com"},
R.id.editor_dialog_done_button, false);
// TODO(jeffreycohen): Change this test into a parameterized test that exercises
// both branches of this if statement.
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
updatePreferencesAndWait(autofillProfileFragment, addProfile,
new String[] {"Alice Doe", "Google", "111 Added St", "Los Angeles", "CA",
"90291", "650-253-0000", "add@profile.com"},
R.id.editor_dialog_done_button, false);
} else {
updatePreferencesAndWait(autofillProfileFragment, addProfile,
new String[] {"Alice Doe", "111 Added St", "Los Angeles", "CA", "90291",
"650-253-0000", "add@profile.com"},
R.id.editor_dialog_done_button, false);
}
Assert.assertEquals(7 /* One toggle + one add button + five profiles. */,
autofillProfileFragment.getPreferenceScreen().getPreferenceCount());
......@@ -172,11 +183,17 @@ public class AutofillProfilesFragmentTest {
Assert.assertEquals("John Doe", johnProfile.getTitle());
// Edit a profile.
updatePreferencesAndWait(autofillProfileFragment, johnProfile,
new String[] {"Emily Doe", "Google", "111 Edited St", "Los Angeles",
"CA", "90291", "650-253-0000", "edit@profile.com"},
R.id.editor_dialog_done_button, false);
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ENABLE_COMPANY_NAME)) {
updatePreferencesAndWait(autofillProfileFragment, johnProfile,
new String[] {"Emily Doe", "Google", "111 Edited St", "Los Angeles", "CA",
"90291", "650-253-0000", "edit@profile.com"},
R.id.editor_dialog_done_button, false);
} else {
updatePreferencesAndWait(autofillProfileFragment, johnProfile,
new String[] {"Emily Doe", "111 Edited St", "Los Angeles", "CA", "90291",
"650-253-0000", "edit@profile.com"},
R.id.editor_dialog_done_button, false);
}
// Check if the preferences are updated correctly.
Assert.assertEquals(6 /* One toggle + one add button + four profiles. */,
autofillProfileFragment.getPreferenceScreen().getPreferenceCount());
......@@ -313,4 +330,4 @@ public class AutofillProfilesFragmentTest {
rule.waitForThePreferenceUpdate();
}
}
}
\ No newline at end of file
}
file://components/autofill/OWNERS
\ No newline at end of file
......@@ -646,6 +646,26 @@
]
}
],
"AutofillEnableCompanyName": [
{
"platforms": [
"android",
"chromeos",
"ios",
"linux",
"mac",
"windows"
],
"experiments": [
{
"name": "Disabled",
"disable_features": [
"AutofillEnableCompanyName"
]
}
]
}
],
"AutofillFieldMetadata": [
{
"platforms": [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment