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

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

Issue 2182123003: [Payments] Add information requested by merchant metrics to PR. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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.ThreadUtils; 10 import org.chromium.base.ThreadUtils;
11 import org.chromium.base.metrics.RecordHistogram;
11 import org.chromium.chrome.R; 12 import org.chromium.chrome.R;
12 import org.chromium.chrome.browser.autofill.AutofillTestHelper; 13 import org.chromium.chrome.browser.autofill.AutofillTestHelper;
13 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; 14 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
14 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; 15 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
15 16
16 import java.util.concurrent.ExecutionException; 17 import java.util.concurrent.ExecutionException;
17 import java.util.concurrent.TimeoutException; 18 import java.util.concurrent.TimeoutException;
18 19
19 /** 20 /**
20 * A payment integration test for a merchant that requests contact details. 21 * A payment integration test for a merchant that requests contact details.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 public void run() { 163 public void run() {
163 mUI.getDialogForTest().findViewById(R.id.button_secondary).perfo rmClick(); 164 mUI.getDialogForTest().findViewById(R.id.button_secondary).perfo rmClick();
164 mUI.getContactDetailsSectionForTest().findViewById( 165 mUI.getContactDetailsSectionForTest().findViewById(
165 R.id.payments_add_option_button).performClick(); 166 R.id.payments_add_option_button).performClick();
166 } 167 }
167 }); 168 });
168 mDismissed.waitForCallback(callCount); 169 mDismissed.waitForCallback(callCount);
169 170
170 expectResultContains(new String[] {"Request cancelled"}); 171 expectResultContains(new String[] {"Request cancelled"});
171 } 172 }
173
174 /**
175 * Test that starting a payment request that requires the user's email addre ss and phone number
176 * results in the appropriate metric being logged in the PaymentRequest.Requ estedInformation
177 * histogram.
178 */
179 @MediumTest
180 public void testRequestedInformationMetric() throws InterruptedException, Ex ecutionException,
181 TimeoutException {
182 // Start the Payment Request.
183 triggerUIAndWait(mReadyToPay);
184
185 // Make sure that only the appropriate enum value was logged.
186 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i ) {
187 assertEquals((i == (PaymentRequestMetrics.REQUESTED_INFORMATION_EMAI L
188 | PaymentRequestMetrics.REQUESTED_INFORMATION_PHONE) ? 1 : 0 ),
189 RecordHistogram.getHistogramValueCountForTesting(
190 "PaymentRequest.RequestedInformation", i));
191 }
192 }
172 } 193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698