Index: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppAndCardsWithModifiersTest.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppAndCardsWithModifiersTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppAndCardsWithModifiersTest.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..963935cdf502a3d482e71c048e929dce63aff36e |
--- /dev/null |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppAndCardsWithModifiersTest.java |
@@ -0,0 +1,77 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.chrome.browser.payments; |
+ |
+import android.support.test.filters.MediumTest; |
+ |
+import org.chromium.base.test.util.Feature; |
+import org.chromium.chrome.R; |
+import org.chromium.chrome.browser.autofill.AutofillTestHelper; |
+import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
+import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; |
+ |
+import java.util.concurrent.ExecutionException; |
+import java.util.concurrent.TimeoutException; |
+ |
+/** |
+ * A payment integration test for a merchant that requests payment via Bob Pay or cards, and |
+ * modifiers at the same time. |
gogerald1
2017/05/17 19:11:47
"A payment integration test for a merchant that re
wuandy1
2017/05/18 20:12:29
Done.
|
+ */ |
+public class PaymentRequestPaymentAppAndCardsWithModifiersTest extends PaymentRequestTestBase { |
+ public PaymentRequestPaymentAppAndCardsWithModifiersTest() { |
gogerald1
2017/05/17 19:11:47
We are moving from using jUnit3 to jUnit4, you can
wuandy1
2017/05/18 20:12:29
Done.
|
+ super("payment_request_bobpay_and_cards_with_modifiers_test.html"); |
+ } |
+ |
+ @Override |
+ public void onMainActivityStarted() |
+ throws InterruptedException, ExecutionException, TimeoutException { |
+ AutofillTestHelper helper = new AutofillTestHelper(); |
+ String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com", |
+ true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", |
+ "US", "310-310-6000", "jon.doe@gmail.com", "en-US")); |
+ // Mastercard card without a billing address. |
+ helper.setCreditCard(new CreditCard("", "https://example.com", true, true, "Jon Doe", |
+ "5454545454545454", "", "12", "2050", "mastercard", R.drawable.pr_mc, |
+ "" /* billingAddressId */, "" /* serverId */)); |
+ // Visa card with complete set of information. |
+ helper.setCreditCard(new CreditCard("", "https://example.com", true, true, "Jon Doe", |
+ "4111111111111111", "", "12", "2050", "visa", R.drawable.pr_visa, billingAddressId, |
+ "" /* serverId */)); |
+ } |
+ |
+ /** |
+ * If Bob Pay does not have any instruments, show [visa, mastercard]. Here the payment app |
gogerald1
2017/05/17 19:11:47
You used 'HAVE_INSTRUMENTS' below, but here says '
wuandy1
2017/05/18 20:12:29
fixed.
|
+ * responds quickly. |
+ */ |
+ @MediumTest |
+ @Feature({"Payments"}) |
+ public void testModifierUpdateTotalAndInstrumentLabel() |
gogerald1
2017/05/17 19:11:47
suggest name: testUpdateTotalAndInstrumentLabelWit
wuandy1
2017/05/18 20:12:29
Done.
|
+ throws InterruptedException, ExecutionException, TimeoutException { |
+ installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); |
+ triggerUIAndWait(getReadyToPay()); |
+ |
+ assertTrue(getSelectedPaymentInstrumentLabel().startsWith("https://bobpay.com")); |
+ assertEquals("USD $4.00", getOrderSummaryTotal()); |
+ |
+ clickOnPaymentMethodSuggestionOptionAndWait(1, getReadyForInput()); |
gogerald1
2017/05/17 19:11:47
Comments on what you are doing here
wuandy1
2017/05/18 20:12:29
Done.
wuandy1
2017/05/18 20:12:29
Done.
|
+ assertTrue(getSelectedPaymentInstrumentLabel().startsWith("Visa")); |
+ assertEquals("USD $5.00", getOrderSummaryTotal()); |
+ } |
+ |
+ @MediumTest |
+ @Feature({"Payments"}) |
+ public void testPaymentAppAbleToPayAfterApplyingModifiers() |
gogerald1
2017/05/17 19:11:47
suggest name: testPaymentAppCanPayWithModifiers
gogerald1
2017/05/17 19:11:47
Add comments to explain this test
wuandy1
2017/05/18 20:12:29
Done.
wuandy1
2017/05/18 20:12:29
Done.
|
+ throws InterruptedException, ExecutionException, TimeoutException { |
+ installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); |
+ triggerUIAndWait(getReadyToPay()); |
+ |
+ assertTrue(getSelectedPaymentInstrumentLabel().startsWith("https://bobpay.com")); |
+ assertEquals("USD $4.00", getOrderSummaryTotal()); |
+ |
+ clickAndWait(R.id.button_primary, getDismissed()); |
+ |
+ expectResultContains(new String[] {"https://bobpay.com", "\"transaction\"", "1337"}); |
gogerald1
2017/05/17 19:11:47
Can you check whether the received modifiers are c
wuandy1
2017/05/18 20:12:29
Current test-supporting code does not provide a wa
gogerald1
2017/05/18 21:57:33
Acknowledged.
|
+ } |
+} |