diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoUpdateWithTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoUpdateWithTest.java index f061671dd9ec2e..a820dfc98e6d1d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoUpdateWithTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestNoUpdateWithTest.java @@ -13,15 +13,14 @@ import org.junit.runner.RunWith; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.autofill.AutofillProfile; import org.chromium.chrome.browser.autofill.AutofillTestHelper; -import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; import org.chromium.chrome.browser.flags.ChromeSwitches; +import org.chromium.chrome.browser.payments.PaymentRequestTestRule.AppPresence; +import org.chromium.chrome.browser.payments.PaymentRequestTestRule.FactorySpeed; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.R; -import org.chromium.ui.modaldialog.ModalDialogProperties; import java.util.concurrent.TimeoutException; @@ -51,20 +50,18 @@ public void setUp() throws TimeoutException { .setPhoneNumber("555 123-4567") .setEmailAddress("lisa@simpson.com") .build()); - String billingAddressId = helper.setProfile(AutofillProfile.builder() - .setFullName("Maggie Simpson") - .setCompanyName("Acme Inc.") - .setStreetAddress("123 Main") - .setRegion("California") - .setLocality("Los Angeles") - .setPostalCode("90210") - .setCountryCode("Uzbekistan") - .setPhoneNumber("555 123-4567") - .setEmailAddress("maggie@simpson.com") - .build()); - helper.setCreditCard(new CreditCard("", "https://example.test", true, true, "Jon Doe", - "4111111111111111", "1111", "12", "2050", "visa", R.drawable.visa_card, - billingAddressId, "" /* serverId */)); + helper.setProfile(AutofillProfile.builder() + .setFullName("Maggie Simpson") + .setCompanyName("Acme Inc.") + .setStreetAddress("123 Main") + .setRegion("California") + .setLocality("Los Angeles") + .setPostalCode("90210") + .setCountryCode("Uzbekistan") + .setPhoneNumber("555 123-4567") + .setEmailAddress("maggie@simpson.com") + .build()); + mRule.addPaymentAppFactory(AppPresence.HAVE_APPS, FactorySpeed.FAST_FACTORY); } /** @@ -73,17 +70,14 @@ public void setUp() throws TimeoutException { */ @Test @MediumTest - @DisabledTest(message = "crbug.com/1182234") @Feature({"Payments"}) public void testNoEventListener() throws Throwable { - mRule.triggerUIAndWait("buyWithoutListeners", mRule.getReadyForInput()); + mRule.runJavaScriptAndWaitForUIEvent( + "buyWithoutListenersWithMethods([{supportedMethods: 'https://bobpay.test'}]);", + mRule.getReadyToPay()); mRule.clickInShippingAddressAndWait(R.id.payments_section, mRule.getReadyForInput()); mRule.clickOnShippingAddressSuggestionOptionAndWait(1, mRule.getReadyForInput()); - mRule.clickAndWait(R.id.button_primary, mRule.getReadyForUnmaskInput()); - mRule.setTextInCardUnmaskDialogAndWait( - R.id.card_unmask_input, "123", mRule.getReadyToUnmask()); - mRule.clickCardUnmaskButtonAndWait( - ModalDialogProperties.ButtonType.POSITIVE, mRule.getDismissed()); + mRule.clickAndWait(R.id.button_primary, mRule.getDismissed()); mRule.expectResultContains(new String[] {"freeShipping"}); } @@ -93,36 +87,30 @@ public void testNoEventListener() throws Throwable { */ @Test @MediumTest - @DisabledTest(message = "crbug.com/1182234") @Feature({"Payments"}) public void testNoUpdateWith() throws Throwable { - mRule.triggerUIAndWait("buyWithoutCallingUpdateWith", mRule.getReadyForInput()); + mRule.runJavaScriptAndWaitForUIEvent( + "buyWithoutCallingUpdateWithWithMethods([{supportedMethods: 'https://bobpay.test'}]);", + mRule.getReadyToPay()); mRule.clickInShippingAddressAndWait(R.id.payments_section, mRule.getReadyForInput()); mRule.clickOnShippingAddressSuggestionOptionAndWait(1, mRule.getReadyForInput()); - mRule.clickAndWait(R.id.button_primary, mRule.getReadyForUnmaskInput()); - mRule.setTextInCardUnmaskDialogAndWait( - R.id.card_unmask_input, "123", mRule.getReadyToUnmask()); - mRule.clickCardUnmaskButtonAndWait( - ModalDialogProperties.ButtonType.POSITIVE, mRule.getDismissed()); + mRule.clickAndWait(R.id.button_primary, mRule.getDismissed()); mRule.expectResultContains(new String[] {"freeShipping"}); } /** A merchant that calls updateWith() without using promises will not cause timeouts in UI. */ @Test @MediumTest - @DisabledTest(message = "crbug.com/1182234") @Feature({"Payments"}) public void testNoPromises() throws Throwable { - mRule.triggerUIAndWait("buyWithoutPromises", mRule.getReadyForInput()); + mRule.runJavaScriptAndWaitForUIEvent( + "buyWithoutPromisesWithMethods([{supportedMethods: 'https://bobpay.test'}]);", + mRule.getReadyToPay()); Assert.assertEquals("USD $5.00", mRule.getOrderSummaryTotal()); mRule.clickInShippingAddressAndWait(R.id.payments_section, mRule.getReadyForInput()); mRule.clickOnShippingAddressSuggestionOptionAndWait(1, mRule.getReadyForInput()); Assert.assertEquals("USD $10.00", mRule.getOrderSummaryTotal()); - mRule.clickAndWait(R.id.button_primary, mRule.getReadyForUnmaskInput()); - mRule.setTextInCardUnmaskDialogAndWait( - R.id.card_unmask_input, "123", mRule.getReadyToUnmask()); - mRule.clickCardUnmaskButtonAndWait( - ModalDialogProperties.ButtonType.POSITIVE, mRule.getDismissed()); + mRule.clickAndWait(R.id.button_primary, mRule.getDismissed()); mRule.expectResultContains(new String[] {"updatedShipping"}); } } diff --git a/components/test/data/payments/no_update_with.js b/components/test/data/payments/no_update_with.js index daaf476dd83eff..66fafb3ce62e8e 100644 --- a/components/test/data/payments/no_update_with.js +++ b/components/test/data/payments/no_update_with.js @@ -48,14 +48,6 @@ function showPaymentRequest(pr) { }); } -/** - * Show a basic-card PaymentRequest that requests a shipping address, but has no - * listeners. - */ -function buyWithoutListeners() { - buyWithoutListenersWithMethods([{supportedMethods: 'basic-card'}]); -} - /** * Show a PaymentRequest using methodData that requests a shipping address, but * has no listeners. @@ -66,14 +58,6 @@ function buyWithoutListeners() { showPaymentRequest(buildPaymentRequest(methodData)); } -/** - * Show a basic-card PaymentRequest that requests a shipping address, but - * listeners don't call updateWith(). - */ -function buyWithoutCallingUpdateWith() { - buyWithoutCallingUpdateWithWithMethods([{supportedMethods: 'basic-card'}]); -} - /** * Show a PaymentRequest using methodData that requests a shipping address, but * listeners don't call updateWith(). @@ -91,14 +75,6 @@ function buyWithoutCallingUpdateWith() { showPaymentRequest(pr); } -/** - * Show a basic-card PaymentRequest that requests a shipping address, but - * listeners don't use promises to update the UI. - */ -function buyWithoutPromises() { - buyWithoutPromisesWithMethods([{supportedMethods: 'basic-card'}]); -} - /** * Show a PaymentRequest using methodData that requests a shipping address, but * listeners don't use promises to update the UI. diff --git a/components/test/data/payments/payment_request_no_update_with_test.html b/components/test/data/payments/payment_request_no_update_with_test.html index ef914daccf0689..58d262ff2ecf11 100644 --- a/components/test/data/payments/payment_request_no_update_with_test.html +++ b/components/test/data/payments/payment_request_no_update_with_test.html @@ -14,9 +14,6 @@ - - -