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