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

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

Issue 2413533003: [Payments] Normalize billing address before sending to the merchant. (Closed)
Patch Set: Addressed comments 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.test.util.Feature; 10 import org.chromium.base.test.util.Feature;
(...skipping 25 matching lines...) Expand all
36 mHelper = new AutofillTestHelper(); 36 mHelper = new AutofillTestHelper();
37 // The user has a shipping address and a credit card associated with tha t address on disk. 37 // The user has a shipping address and a credit card associated with tha t address on disk.
38 mBillingAddressId = mHelper.setProfile(new AutofillProfile("", "https:// example.com", 38 mBillingAddressId = mHelper.setProfile(new AutofillProfile("", "https:// example.com",
39 true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", " ", "90291", "", 39 true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", " ", "90291", "",
40 "US", "555-555-5555", "", "en-US")); 40 "US", "555-555-5555", "", "en-US"));
41 mCreditCardId = mHelper.setCreditCard(new CreditCard("", "https://exampl e.com", true, true, 41 mCreditCardId = mHelper.setCreditCard(new CreditCard("", "https://exampl e.com", true, true,
42 "Jon Doe", "4111111111111111", "1111", "12", "2050", "visa", R.d rawable.pr_visa, 42 "Jon Doe", "4111111111111111", "1111", "12", "2050", "visa", R.d rawable.pr_visa,
43 mBillingAddressId, "" /* serverId */)); 43 mBillingAddressId, "" /* serverId */));
44 // Set specific use stats for the profile and credit card. 44 // Set specific use stats for the profile and credit card.
45 mHelper.setProfileUseStatsForTesting(mBillingAddressId, 20, 5000); 45 mHelper.setProfileUseStatsForTesting(mBillingAddressId, 20, 5000);
46 mHelper.setCreditCardUseStatsForTesting(mCreditCardId, 10, 5000); 46 mHelper.setCreditCardUseStatsForTesting(mCreditCardId, 1, 5000);
47 } 47 }
48 48
49 /** Expect that using a profile and credit card to pay updates their usage s tats. */ 49 /** Expect that using a profile and credit card to pay updates their usage s tats. */
50 @MediumTest 50 @MediumTest
51 @Feature({"Payments"}) 51 @Feature({"Payments"})
52 public void testLogProfileAndCreditCardUse() throws InterruptedException, Ex ecutionException, 52 public void testLogProfileAndCreditCardUse() throws InterruptedException, Ex ecutionException,
53 TimeoutException { 53 TimeoutException {
54 triggerUIAndWait(mReadyToPay); 54 triggerUIAndWait(mReadyToPay);
55 55
56 // Get the current date value just before the start of the Payment Reque st. 56 // Get the current date value just before the start of the Payment Reque st.
57 long timeBeforeRecord = mHelper.getCurrentDateForTesting(); 57 long timeBeforeRecord = mHelper.getCurrentDateForTesting();
58 58
59 // Proceed with the payment. 59 // Proceed with the payment.
60 clickAndWait(R.id.button_primary, mReadyForUnmaskInput); 60 clickAndWait(R.id.button_primary, mReadyForUnmaskInput);
61 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo Unmask); 61 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo Unmask);
62 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed ); 62 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed );
63 63
64 // Get the current date value just after the end of the Payment Request. 64 // Get the current date value just after the end of the Payment Request.
65 long timeAfterRecord = mHelper.getCurrentDateForTesting(); 65 long timeAfterRecord = mHelper.getCurrentDateForTesting();
66 66
67 // Make sure the use counts were incremented and the use dates were set to the current time. 67 // Make sure the use counts were incremented and the use dates were set to the current time.
68 assertEquals(21, mHelper.getProfileUseCountForTesting(mBillingAddressId) ); 68 assertEquals(21, mHelper.getProfileUseCountForTesting(mBillingAddressId) );
69 assertTrue(timeBeforeRecord <= mHelper.getProfileUseDateForTesting(mBill ingAddressId)); 69 assertTrue(timeBeforeRecord <= mHelper.getProfileUseDateForTesting(mBill ingAddressId));
70 assertTrue(timeAfterRecord >= mHelper.getProfileUseDateForTesting(mBilli ngAddressId)); 70 assertTrue(timeAfterRecord >= mHelper.getProfileUseDateForTesting(mBilli ngAddressId));
71 assertEquals(11, mHelper.getCreditCardUseCountForTesting(mCreditCardId)) ; 71 assertEquals(2, mHelper.getCreditCardUseCountForTesting(mCreditCardId));
please use gerrit instead 2016/10/19 19:10:59 What's the difference between going from 10 to 11
sebsg 2016/10/20 17:06:52 That's what I was talking about offline. The diffe
72 assertTrue(timeBeforeRecord <= mHelper.getCreditCardUseDateForTesting(mC reditCardId)); 72 assertTrue(timeBeforeRecord <= mHelper.getCreditCardUseDateForTesting(mC reditCardId));
73 assertTrue(timeAfterRecord >= mHelper.getCreditCardUseDateForTesting(mCr editCardId)); 73 assertTrue(timeAfterRecord >= mHelper.getCreditCardUseDateForTesting(mCr editCardId));
74 } 74 }
75 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698