Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcActivePaymentQueryTest.java

Issue 2467393002: Add canMakeActivePayment() method to web payments. (Closed)
Patch Set: Hide behind a flag Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.payments;
6
7 import android.test.suitebuilder.annotation.MediumTest;
8
9 import org.chromium.base.test.util.Feature;
10 import org.chromium.chrome.R;
11 import org.chromium.chrome.browser.autofill.AutofillTestHelper;
12 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
13 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
14
15 import java.util.concurrent.ExecutionException;
16 import java.util.concurrent.TimeoutException;
17
18 /**
19 * A payment integration test for checking whether user can make active payment via a credit card.
20 * This user has a complete credit card on file.
21 */
22 public class PaymentRequestCcActivePaymentQueryTest extends PaymentRequestTestBa se {
23 public PaymentRequestCcActivePaymentQueryTest() {
24 super("payment_request_active_payment_query_cc_test.html");
25 }
26
27 @Override
28 public void onMainActivityStarted() throws InterruptedException, ExecutionEx ception,
29 TimeoutException {
30 // The user has a complete credit card on file. This is sufficient for
31 // canMakeActivePayment() to return true.
32 AutofillTestHelper helper = new AutofillTestHelper();
33 String billingAddressId = helper.setProfile(new AutofillProfile("", "htt ps://example.com",
34 true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", " ", "90291", "",
35 "US", "555-555-5555", "", "en-US"));
36 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru e, "Jon Doe",
37 "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_ visa,
38 billingAddressId, "" /* serverId */));
39 }
40
41 @MediumTest
42 @Feature({"Payments"})
43 public void testCanMakeActivePayment() throws InterruptedException, Executio nException,
44 TimeoutException {
45 triggerUIAndWait(mActivePaymentQueryResponded);
46 expectResultContains(new String[]{"true"});
47
48 // Repeating a query does not count against the quota.
49 clickNodeAndWait("buy", mActivePaymentQueryResponded);
50 expectResultContains(new String[]{"true"});
51
52 clickNodeAndWait("buy", mActivePaymentQueryResponded);
53 expectResultContains(new String[]{"true"});
54
55 // Different queries are throttled for a period of time.
56 clickNodeAndWait("other-buy", mActivePaymentQueryResponded);
57 expectResultContains(new String[]{"Query quota exceeded"});
58
59 // Repeating the same query again does not count against the quota.
60 clickNodeAndWait("buy", mActivePaymentQueryResponded);
61 expectResultContains(new String[]{"true"});
62 }
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698