| 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 static org.chromium.chrome.browser.payments.PaymentRequestTestRule.HAVE_I
NSTRUMENTS; | 7 import static org.chromium.chrome.browser.payments.PaymentRequestTestRule.HAVE_I
NSTRUMENTS; |
| 8 import static org.chromium.chrome.browser.payments.PaymentRequestTestRule.IMMEDI
ATE_RESPONSE; | 8 import static org.chromium.chrome.browser.payments.PaymentRequestTestRule.IMMEDI
ATE_RESPONSE; |
| 9 | 9 |
| 10 import android.support.test.filters.MediumTest; | 10 import android.support.test.filters.MediumTest; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 @Feature({"Payments"}) | 310 @Feature({"Payments"}) |
| 311 public void testSuggestionsDeduped() | 311 public void testSuggestionsDeduped() |
| 312 throws InterruptedException, ExecutionException, TimeoutException { | 312 throws InterruptedException, ExecutionException, TimeoutException { |
| 313 mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getRead
yToPay()); | 313 mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getRead
yToPay()); |
| 314 mPaymentRequestTestRule.clickInContactInfoAndWait( | 314 mPaymentRequestTestRule.clickInContactInfoAndWait( |
| 315 R.id.payments_section, mPaymentRequestTestRule.getReadyForInput(
)); | 315 R.id.payments_section, mPaymentRequestTestRule.getReadyForInput(
)); |
| 316 Assert.assertEquals(1, mPaymentRequestTestRule.getNumberOfContactDetailS
uggestions()); | 316 Assert.assertEquals(1, mPaymentRequestTestRule.getNumberOfContactDetailS
uggestions()); |
| 317 } | 317 } |
| 318 | 318 |
| 319 /** | 319 /** |
| 320 * Test that starting a payment request that requires the user's email addre
ss, phone number and | 320 * Test that ending a payment request that requires the user's email address
, phone number and |
| 321 * name results in the appropriate metric being logged in the | 321 * name results in the appropriate metric being logged in the |
| 322 * PaymentRequest.RequestedInformation histogram. | 322 * PaymentRequest.RequestedInformation histogram. |
| 323 */ | 323 */ |
| 324 @Test | 324 @Test |
| 325 @MediumTest | 325 @MediumTest |
| 326 @Feature({"Payments"}) | 326 @Feature({"Payments"}) |
| 327 public void testRequestedInformationMetric() | 327 public void testRequestedInformationMetric() |
| 328 throws InterruptedException, ExecutionException, TimeoutException { | 328 throws InterruptedException, ExecutionException, TimeoutException { |
| 329 // Start the Payment Request. | 329 // Start and complete the Payment Request. |
| 330 mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getRead
yToPay()); | 330 mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getRead
yToPay()); |
| 331 mPaymentRequestTestRule.clickAndWait( |
| 332 R.id.button_primary, mPaymentRequestTestRule.getDismissed()); |
| 333 mPaymentRequestTestRule.expectResultContains( |
| 334 new String[] {"Jon Doe", "+15555555555", "jon.doe@google.com"}); |
| 331 | 335 |
| 332 // Make sure that only the appropriate enum value was logged. | 336 // Make sure that only the appropriate enum value was logged. |
| 333 for (int i = 0; i < RequestedInformation.MAX; ++i) { | 337 for (int i = 0; i < RequestedInformation.MAX; ++i) { |
| 334 Assert.assertEquals((i | 338 Assert.assertEquals((i |
| 335 == (RequestedInformation
.EMAIL | 339 == (RequestedInformation
.EMAIL |
| 336 | RequestedIn
formation.PHONE | 340 | RequestedIn
formation.PHONE |
| 337 | RequestedIn
formation.NAME) | 341 | RequestedIn
formation.NAME) |
| 338 ? 1 | 342 ? 1 |
| 339 : 0), | 343 : 0), |
| 340 RecordHistogram.getHistogramValueCountForTesting( | 344 RecordHistogram.getHistogramValueCountForTesting( |
| 341 "PaymentRequest.RequestedInformation", i)); | 345 "PaymentRequest.RequestedInformation", i)); |
| 342 } | 346 } |
| 343 } | 347 } |
| 344 } | 348 } |
| OLD | NEW |