| 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.support.test.filters.MediumTest; | 8 import android.support.test.filters.MediumTest; |
| 9 | 9 |
| 10 import org.junit.Assert; | 10 import org.junit.Assert; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 throws InterruptedException, ExecutionException, TimeoutException { | 128 throws InterruptedException, ExecutionException, TimeoutException { |
| 129 mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getRead
yToPay()); | 129 mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getRead
yToPay()); |
| 130 mPaymentRequestTestRule.clickInShippingAddressAndWait( | 130 mPaymentRequestTestRule.clickInShippingAddressAndWait( |
| 131 R.id.payments_section, mPaymentRequestTestRule.getReadyForInput(
)); | 131 R.id.payments_section, mPaymentRequestTestRule.getReadyForInput(
)); |
| 132 mPaymentRequestTestRule.clickInShippingAddressAndWait( | 132 mPaymentRequestTestRule.clickInShippingAddressAndWait( |
| 133 R.id.payments_add_option_button, mPaymentRequestTestRule.getRead
yToEdit()); | 133 R.id.payments_add_option_button, mPaymentRequestTestRule.getRead
yToEdit()); |
| 134 mPaymentRequestTestRule.setSpinnerSelectionInEditorAndWait( | 134 mPaymentRequestTestRule.setSpinnerSelectionInEditorAndWait( |
| 135 0 /* Afghanistan */, mPaymentRequestTestRule.getReadyToEdit()); | 135 0 /* Afghanistan */, mPaymentRequestTestRule.getReadyToEdit()); |
| 136 mPaymentRequestTestRule.setTextInEditorAndWait( | 136 mPaymentRequestTestRule.setTextInEditorAndWait( |
| 137 new String[] { | 137 new String[] { |
| 138 "Alice", "Supreme Court", "Airport Road", "Kabul", "1043
", "650-253-0000"}, | 138 "Alice", "Supreme Court", "Airport Road", "Kabul", "1043
", "020-253-0000"}, |
| 139 mPaymentRequestTestRule.getEditorTextUpdate()); | 139 mPaymentRequestTestRule.getEditorTextUpdate()); |
| 140 mPaymentRequestTestRule.clickInEditorAndWait( | 140 mPaymentRequestTestRule.clickInEditorAndWait( |
| 141 R.id.payments_edit_done_button, mPaymentRequestTestRule.getReady
ToPay()); | 141 R.id.payments_edit_done_button, mPaymentRequestTestRule.getReady
ToPay()); |
| 142 mPaymentRequestTestRule.clickAndWait( | 142 mPaymentRequestTestRule.clickAndWait( |
| 143 R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskIn
put()); | 143 R.id.button_primary, mPaymentRequestTestRule.getReadyForUnmaskIn
put()); |
| 144 mPaymentRequestTestRule.setTextInCardUnmaskDialogAndWait( | 144 mPaymentRequestTestRule.setTextInCardUnmaskDialogAndWait( |
| 145 R.id.card_unmask_input, "123", mPaymentRequestTestRule.getReadyT
oUnmask()); | 145 R.id.card_unmask_input, "123", mPaymentRequestTestRule.getReadyT
oUnmask()); |
| 146 mPaymentRequestTestRule.clickCardUnmaskButtonAndWait( | 146 mPaymentRequestTestRule.clickCardUnmaskButtonAndWait( |
| 147 DialogInterface.BUTTON_POSITIVE, mPaymentRequestTestRule.getDism
issed()); | 147 DialogInterface.BUTTON_POSITIVE, mPaymentRequestTestRule.getDism
issed()); |
| 148 mPaymentRequestTestRule.expectResultContains(new String[] { | 148 mPaymentRequestTestRule.expectResultContains(new String[] { |
| 149 "Alice", "Supreme Court", "Airport Road", "Kabul", "1043", "+165
02530000"}); | 149 "Alice", "Supreme Court", "Airport Road", "Kabul", "1043", "+932
02530000"}); |
| 150 } | 150 } |
| 151 | 151 |
| 152 /** Quickly pressing on "add address" and then [X] should not crash. */ | 152 /** Quickly pressing on "add address" and then [X] should not crash. */ |
| 153 @Test | 153 @Test |
| 154 @MediumTest | 154 @MediumTest |
| 155 @Feature({"Payments"}) | 155 @Feature({"Payments"}) |
| 156 public void testQuickAddAddressAndCloseShouldNotCrash() | 156 public void testQuickAddAddressAndCloseShouldNotCrash() |
| 157 throws InterruptedException, ExecutionException, TimeoutException { | 157 throws InterruptedException, ExecutionException, TimeoutException { |
| 158 mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getRead
yToPay()); | 158 mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getRead
yToPay()); |
| 159 mPaymentRequestTestRule.clickInShippingAddressAndWait( | 159 mPaymentRequestTestRule.clickInShippingAddressAndWait( |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 mPaymentRequestTestRule.expectResultContains(new String[] {"Request canc
elled"}); | 294 mPaymentRequestTestRule.expectResultContains(new String[] {"Request canc
elled"}); |
| 295 | 295 |
| 296 // Make sure that only the appropriate enum value was logged. | 296 // Make sure that only the appropriate enum value was logged. |
| 297 for (int i = 0; i < RequestedInformation.MAX; ++i) { | 297 for (int i = 0; i < RequestedInformation.MAX; ++i) { |
| 298 Assert.assertEquals((i == RequestedInformation.SHIPPING ? 1 : 0), | 298 Assert.assertEquals((i == RequestedInformation.SHIPPING ? 1 : 0), |
| 299 RecordHistogram.getHistogramValueCountForTesting( | 299 RecordHistogram.getHistogramValueCountForTesting( |
| 300 "PaymentRequest.RequestedInformation", i)); | 300 "PaymentRequest.RequestedInformation", i)); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 } | 303 } |
| OLD | NEW |