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

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

Issue 2368073002: PaymentRequest: Add payer name field to payer info editor. (android) (Closed)
Patch Set: PaymentRequest: Add payer name field to payer info editor. (android) Created 4 years, 2 months 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.payments; 5 package org.chromium.chrome.browser.payments;
6 6
7 import android.content.DialogInterface; 7 import android.content.DialogInterface;
8 import android.test.suitebuilder.annotation.MediumTest; 8 import android.test.suitebuilder.annotation.MediumTest;
9 9
10 import org.chromium.base.metrics.RecordHistogram; 10 import org.chromium.base.metrics.RecordHistogram;
11 import org.chromium.base.test.util.Feature; 11 import org.chromium.base.test.util.Feature;
12 import org.chromium.chrome.R; 12 import org.chromium.chrome.R;
13 import org.chromium.chrome.browser.autofill.AutofillTestHelper; 13 import org.chromium.chrome.browser.autofill.AutofillTestHelper;
14 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; 14 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
15 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; 15 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
16 16
17 import java.util.concurrent.ExecutionException; 17 import java.util.concurrent.ExecutionException;
18 import java.util.concurrent.TimeoutException; 18 import java.util.concurrent.TimeoutException;
19 19
20 /** 20 /**
21 * A payment integration test for a merchant that requests a phone number and pr ovides free shipping 21 * A payment integration test for a merchant that requests a payer name and prov ides free shipping
22 * regardless of address. 22 * regardless of address.
23 */ 23 */
24 public class PaymentRequestPhoneAndFreeShippingTest extends PaymentRequestTestBa se { 24 public class PaymentRequestNameAndFreeShippingTest extends PaymentRequestTestBas e {
25 public PaymentRequestPhoneAndFreeShippingTest() { 25 public PaymentRequestNameAndFreeShippingTest() {
26 // This merchant requests a phone number and provides free shipping worl dwide. 26 // This merchant requests a payer name and provides free shipping worldw ide.
27 super("payment_request_phone_and_free_shipping_test.html"); 27 super("payment_request_name_and_free_shipping_test.html");
28 } 28 }
29 29
30 @Override 30 @Override
31 public void onMainActivityStarted() 31 public void onMainActivityStarted()
32 throws InterruptedException, ExecutionException, TimeoutException { 32 throws InterruptedException, ExecutionException, TimeoutException {
33 AutofillTestHelper helper = new AutofillTestHelper(); 33 AutofillTestHelper helper = new AutofillTestHelper();
34 // The user has a shipping address with a valid phone number on disk. 34 // The user has a shipping address with a valid payer name on disk.
35 String billingAddressId = helper.setProfile(new AutofillProfile("", "htt ps://example.com", 35 String billingAddressId = helper.setProfile(new AutofillProfile("", "htt ps://example.com",
36 true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", " ", "90291", "", 36 true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", " ", "90291", "",
37 "US", "555-555-5555", "", "en-US")); 37 "US", "555-555-5555", "", "en-US"));
38 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru e, "Jon Doe", 38 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru e, "Jon Doe",
39 "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_ visa, 39 "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_ visa,
40 billingAddressId, "" /* serverId */)); 40 billingAddressId, "" /* serverId */));
41 } 41 }
42 42
43 /** Submit the phone number and shipping address to the merchant when the us er clicks "Pay." */ 43 /** Submit the payer name and shipping address to the merchant when the user clicks "Pay." */
44 @MediumTest 44 @MediumTest
45 @Feature({"Payments"}) 45 @Feature({"Payments"})
46 public void testPay() throws InterruptedException, ExecutionException, Timeo utException { 46 public void testPay() throws InterruptedException, ExecutionException, Timeo utException {
47 triggerUIAndWait(mReadyToPay); 47 triggerUIAndWait(mReadyToPay);
48 clickAndWait(R.id.button_primary, mReadyForUnmaskInput); 48 clickAndWait(R.id.button_primary, mReadyForUnmaskInput);
49 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo Unmask); 49 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo Unmask);
50 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed ); 50 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed );
51 expectResultContains(new String[] {"555-555-5555", "Jon Doe", "411111111 1111111", "12", 51 expectResultContains(new String[] {"Jon Doe", "Jon Doe", "41111111111111 11", "12",
52 "2050", "visa", "123", "Google", "340 Main St", "CA", "Los Angel es", "90291", "US", 52 "2050", "visa", "123", "Google", "340 Main St", "CA", "Los Angel es", "90291", "US",
53 "en", "freeShippingOption"}); 53 "en", "freeShippingOption"});
54 } 54 }
55 55
56 /** 56 /**
57 * Test that starting a payment request that requires a phone number and a s hipping address 57 * Test that starting a payment request that requires a payer name and a shi pping address
58 * results in the appropriate metric being logged in the PaymentRequest.Requ estedInformation 58 * results in the appropriate metric being logged in the PaymentRequest.Requ estedInformation
59 * histogram. 59 * histogram.
60 */ 60 */
61 @MediumTest 61 @MediumTest
62 @Feature({"Payments"}) 62 @Feature({"Payments"})
63 public void testRequestedInformationMetric() throws InterruptedException, Ex ecutionException, 63 public void testRequestedInformationMetric() throws InterruptedException, Ex ecutionException,
64 TimeoutException { 64 TimeoutException {
65 // Start the Payment Request. 65 // Start the Payment Request.
66 triggerUIAndWait(mReadyToPay); 66 triggerUIAndWait(mReadyToPay);
67 67
68 // Make sure that only the appropriate enum value was logged. 68 // Make sure that only the appropriate enum value was logged.
69 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i ) { 69 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i ) {
70 assertEquals((i == (PaymentRequestMetrics.REQUESTED_INFORMATION_PHON E 70 assertEquals((i == (PaymentRequestMetrics.REQUESTED_INFORMATION_PHON E
71 | PaymentRequestMetrics.REQUESTED_INFORMATION_SHIPPING) ? 1 : 0), 71 | PaymentRequestMetrics.REQUESTED_INFORMATION_SHIPPING) ? 1 : 0),
72 RecordHistogram.getHistogramValueCountForTesting( 72 RecordHistogram.getHistogramValueCountForTesting(
73 "PaymentRequest.RequestedInformation", i)); 73 "PaymentRequest.RequestedInformation", i));
74 } 74 }
75 } 75 }
76 } 76 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698