Chromium Code Reviews| Index: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFieldTrialTest.java |
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFieldTrialTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFieldTrialTest.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cdbb2be1a4b7b5f3617e5dc11c7cecb4b73a6446 |
| --- /dev/null |
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFieldTrialTest.java |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
|
please use gerrit instead
2016/10/20 20:27:44
This file is not necessary with ChromeFeatureList.
sebsg
2016/10/21 02:20:32
Done.
|
| +// 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.test.suitebuilder.annotation.MediumTest; |
| + |
| +import org.chromium.base.test.util.CommandLineFlags; |
| +import org.chromium.base.test.util.Feature; |
| +import org.chromium.chrome.browser.ChromeSwitches; |
| +import org.chromium.chrome.browser.autofill.AutofillTestHelper; |
| +import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
| + |
| +import java.util.concurrent.ExecutionException; |
| +import java.util.concurrent.TimeoutException; |
| + |
| +/** |
| + * A payment integration test for a merchant that provides free shipping regardless of address. |
| + */ |
| +public class PaymentRequestFieldTrialTest extends PaymentRequestTestBase { |
| + public PaymentRequestFieldTrialTest() { |
| + // This merchant provides free shipping worldwide. |
| + super("payment_request_free_shipping_test.html"); |
| + } |
| + |
| + @Override |
| + public void onMainActivityStarted() |
| + throws InterruptedException, ExecutionException, TimeoutException { |
| + AutofillTestHelper helper = new AutofillTestHelper(); |
| + // The user has a shipping address on disk but no credit card. |
| + helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google", |
| + "340 Main St", "CA", "Los Angeles", "", "90291", "", "US", "555-555-5555", "", |
| + "en-US")); |
| + } |
| + |
| + /** |
| + * Tests that the Payment Request is cancelled if the user has no credit card and the proper |
| + * command line flag is set. |
| + */ |
| + @MediumTest |
| + @Feature({"Payments"}) |
| + @CommandLineFlags.Add(ChromeSwitches.ENABLE_NO_CARD_ABORT) |
| + public void testAbortIfNoCard_Enabled() |
| + throws InterruptedException, ExecutionException, TimeoutException { |
| + triggerUIAndWait(mShowFailed); |
| + expectResultContains(new String[] {"The payment method is not supported"}); |
| + } |
| + |
| + /** |
| + * Tests that the Payment Request UI is shown if the user has no credit card and the proper |
| + * command line flag is set. |
| + */ |
| + @MediumTest |
| + @Feature({"Payments"}) |
| + @CommandLineFlags.Add(ChromeSwitches.DISABLE_NO_CARD_ABORT) |
| + public void testAbortIfNoCard_Disabled() |
| + throws InterruptedException, ExecutionException, TimeoutException { |
| + // Check that the Payment Request UI is shown. |
| + triggerUIAndWait(mReadyForInput); |
| + } |
| +} |