| 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.support.test.filters.MediumTest; | 7 import android.support.test.filters.MediumTest; |
| 8 | 8 |
| 9 import org.chromium.base.ThreadUtils; | 9 import org.chromium.base.ThreadUtils; |
| 10 import org.chromium.base.metrics.RecordHistogram; | 10 import org.chromium.base.metrics.RecordHistogram; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); | 57 installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); |
| 58 } | 58 } |
| 59 | 59 |
| 60 /** Provide the existing valid payer name, phone number and email address to
the merchant. */ | 60 /** Provide the existing valid payer name, phone number and email address to
the merchant. */ |
| 61 @MediumTest | 61 @MediumTest |
| 62 @Feature({"Payments"}) | 62 @Feature({"Payments"}) |
| 63 public void testPay() throws InterruptedException, ExecutionException, Timeo
utException { | 63 public void testPay() throws InterruptedException, ExecutionException, Timeo
utException { |
| 64 triggerUIAndWait(mReadyToPay); | 64 triggerUIAndWait(mReadyToPay); |
| 65 clickAndWait(R.id.button_primary, mDismissed); | 65 clickAndWait(R.id.button_primary, mDismissed); |
| 66 expectResultContains(new String[] {"Jon Doe", "555-555-5555", "jon.doe@g
oogle.com"}); | 66 expectResultContains(new String[] {"Jon Doe", "+15555555555", "jon.doe@g
oogle.com"}); |
| 67 } | 67 } |
| 68 | 68 |
| 69 /** Attempt to add invalid contact information and cancel the transaction. *
/ | 69 /** Attempt to add invalid contact information and cancel the transaction. *
/ |
| 70 @MediumTest | 70 @MediumTest |
| 71 @Feature({"Payments"}) | 71 @Feature({"Payments"}) |
| 72 public void testAddInvalidContactAndCancel() | 72 public void testAddInvalidContactAndCancel() |
| 73 throws InterruptedException, ExecutionException, TimeoutException { | 73 throws InterruptedException, ExecutionException, TimeoutException { |
| 74 triggerUIAndWait(mReadyToPay); | 74 triggerUIAndWait(mReadyToPay); |
| 75 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 75 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); |
| 76 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; | 76 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 87 public void testAddContactAndPay() | 87 public void testAddContactAndPay() |
| 88 throws InterruptedException, ExecutionException, TimeoutException { | 88 throws InterruptedException, ExecutionException, TimeoutException { |
| 89 triggerUIAndWait(mReadyToPay); | 89 triggerUIAndWait(mReadyToPay); |
| 90 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 90 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); |
| 91 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; | 91 clickInContactInfoAndWait(R.id.payments_add_option_button, mReadyToEdit)
; |
| 92 setTextInEditorAndWait(new String[] {"Jane Jones", "999-999-9999", "jane
.jones@google.com"}, | 92 setTextInEditorAndWait(new String[] {"Jane Jones", "999-999-9999", "jane
.jones@google.com"}, |
| 93 mEditorTextUpdate); | 93 mEditorTextUpdate); |
| 94 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); | 94 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); |
| 95 | 95 |
| 96 clickAndWait(R.id.button_primary, mDismissed); | 96 clickAndWait(R.id.button_primary, mDismissed); |
| 97 expectResultContains(new String[] {"Jane Jones", "999-999-9999", "jane.j
ones@google.com"}); | 97 expectResultContains(new String[] {"Jane Jones", "+19999999999", "jane.j
ones@google.com"}); |
| 98 } | 98 } |
| 99 | 99 |
| 100 /** Quickly pressing on "add contact info" and then [X] should not crash. */ | 100 /** Quickly pressing on "add contact info" and then [X] should not crash. */ |
| 101 @MediumTest | 101 @MediumTest |
| 102 @Feature({"Payments"}) | 102 @Feature({"Payments"}) |
| 103 public void testQuickAddContactAndCloseShouldNotCrash() | 103 public void testQuickAddContactAndCloseShouldNotCrash() |
| 104 throws InterruptedException, ExecutionException, TimeoutException { | 104 throws InterruptedException, ExecutionException, TimeoutException { |
| 105 triggerUIAndWait(mReadyToPay); | 105 triggerUIAndWait(mReadyToPay); |
| 106 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | 106 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); |
| 107 | 107 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 // Make sure that only the appropriate enum value was logged. | 255 // Make sure that only the appropriate enum value was logged. |
| 256 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i
) { | 256 for (int i = 0; i < PaymentRequestMetrics.REQUESTED_INFORMATION_MAX; ++i
) { |
| 257 assertEquals((i == (PaymentRequestMetrics.REQUESTED_INFORMATION_EMAI
L | 257 assertEquals((i == (PaymentRequestMetrics.REQUESTED_INFORMATION_EMAI
L |
| 258 | PaymentRequestMetrics.REQUESTED_INFORMATION_PHONE | 258 | PaymentRequestMetrics.REQUESTED_INFORMATION_PHONE |
| 259 | PaymentRequestMetrics.REQUESTED_INFORMATION_NAME) ? 1 : 0)
, | 259 | PaymentRequestMetrics.REQUESTED_INFORMATION_NAME) ? 1 : 0)
, |
| 260 RecordHistogram.getHistogramValueCountForTesting( | 260 RecordHistogram.getHistogramValueCountForTesting( |
| 261 "PaymentRequest.RequestedInformation", i)); | 261 "PaymentRequest.RequestedInformation", i)); |
| 262 } | 262 } |
| 263 } | 263 } |
| 264 } | 264 } |
| OLD | NEW |