| OLD | NEW |
| 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; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 mUI.getContactDetailsSectionForTest().findViewById( | 173 mUI.getContactDetailsSectionForTest().findViewById( |
| 174 R.id.payments_add_option_button).performClick(); | 174 R.id.payments_add_option_button).performClick(); |
| 175 } | 175 } |
| 176 }); | 176 }); |
| 177 mDismissed.waitForCallback(callCount); | 177 mDismissed.waitForCallback(callCount); |
| 178 | 178 |
| 179 expectResultContains(new String[] {"Request cancelled"}); | 179 expectResultContains(new String[] {"Request cancelled"}); |
| 180 } | 180 } |
| 181 | 181 |
| 182 /** | 182 /** |
| 183 * Test that starting a payment request that requires the user's email addre
ss and phone number | 183 * Test that starting a payment request that requires the user's email addre
ss, phone number and |
| 184 * results in the appropriate metric being logged in the PaymentRequest.Requ
estedInformation | 184 * name results in the appropriate metric being logged in the |
| 185 * histogram. | 185 * PaymentRequest.RequestedInformation histogram. |
| 186 */ | 186 */ |
| 187 @MediumTest | 187 @MediumTest |
| 188 @Feature({"Payments"}) | 188 @Feature({"Payments"}) |
| 189 public void testRequestedInformationMetric() throws InterruptedException, Ex
ecutionException, | 189 public void testRequestedInformationMetric() throws InterruptedException, Ex
ecutionException, |
| 190 TimeoutException { | 190 TimeoutException { |
| 191 // Start the Payment Request. | 191 // Start the Payment Request. |
| 192 triggerUIAndWait(mReadyToPay); | 192 triggerUIAndWait(mReadyToPay); |
| 193 | 193 |
| 194 // Make sure that only the appropriate enum value was logged. | 194 // Make sure that only the appropriate enum value was logged. |
| 195 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i
) { | 195 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i
) { |
| 196 assertEquals((i == (PaymentRequestMetrics.REQUESTED_INFORMATION_EMAI
L | 196 assertEquals((i == (PaymentRequestMetrics.REQUESTED_INFORMATION_EMAI
L |
| 197 | PaymentRequestMetrics.REQUESTED_INFORMATION_PHONE) ? 1 : 0
), | 197 | PaymentRequestMetrics.REQUESTED_INFORMATION_PHONE |
| 198 | PaymentRequestMetrics.REQUESTED_INFORMATION_NAME) ? 1 : 0)
, |
| 198 RecordHistogram.getHistogramValueCountForTesting( | 199 RecordHistogram.getHistogramValueCountForTesting( |
| 199 "PaymentRequest.RequestedInformation", i)); | 200 "PaymentRequest.RequestedInformation", i)); |
| 200 } | 201 } |
| 201 } | 202 } |
| 202 } | 203 } |
| OLD | NEW |