| 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.test.suitebuilder.annotation.MediumTest; | 7 import android.test.suitebuilder.annotation.MediumTest; | 
| 8 | 8 | 
| 9 import org.chromium.base.test.util.Feature; | 9 import org.chromium.base.test.util.Feature; | 
| 10 import org.chromium.chrome.R; | 10 import org.chromium.chrome.R; | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 106         clickInShippingSummaryAndWait(R.id.payments_section, mReadyForInput); | 106         clickInShippingSummaryAndWait(R.id.payments_section, mReadyForInput); | 
| 107         clickInShippingAddressAndWait(R.id.payments_add_option_button, mReadyToE
     dit); | 107         clickInShippingAddressAndWait(R.id.payments_add_option_button, mReadyToE
     dit); | 
| 108         setTextInEditorAndWait(new String[] {"Seb Doe", "Google", "340 Main St",
      "Los Angeles", | 108         setTextInEditorAndWait(new String[] {"Seb Doe", "Google", "340 Main St",
      "Los Angeles", | 
| 109                 "CA", "90291", "555-555-5555"}, mEditorTextUpdate); | 109                 "CA", "90291", "555-555-5555"}, mEditorTextUpdate); | 
| 110         clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); | 110         clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); | 
| 111 | 111 | 
| 112         // Make sure that the shipping label does not include the country. | 112         // Make sure that the shipping label does not include the country. | 
| 113         assertTrue(getShippingAddressOptionRowAtIndex(0).getLabelText().toString
     ().equals( | 113         assertTrue(getShippingAddressOptionRowAtIndex(0).getLabelText().toString
     ().equals( | 
| 114                 "Seb Doe\nGoogle, 340 Main St, Los Angeles, CA 90291\n555-555-55
     55")); | 114                 "Seb Doe\nGoogle, 340 Main St, Los Angeles, CA 90291\n555-555-55
     55")); | 
| 115     } | 115     } | 
|  | 116 | 
|  | 117     /** Test that going into the editor and cancelling will leave the row checke
     d. */ | 
|  | 118     @MediumTest | 
|  | 119     @Feature({"Payments"}) | 
|  | 120     public void testEditShippingAddressAndCancelEditorShouldKeepAddressSelected(
     ) | 
|  | 121             throws InterruptedException, ExecutionException, TimeoutException { | 
|  | 122         triggerUIAndWait(mReadyToPay); | 
|  | 123         clickInShippingSummaryAndWait(R.id.payments_section, mReadyForInput); | 
|  | 124         expectShippingAddressRowIsSelected(0); | 
|  | 125         clickInShippingAddressAndWait(R.id.payments_open_editor_pencil_button, m
     ReadyToEdit); | 
|  | 126 | 
|  | 127         // Cancel the editor. | 
|  | 128         clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); | 
|  | 129 | 
|  | 130         // Expect the row to still be selected in the Shipping Address section. | 
|  | 131         expectShippingAddressRowIsSelected(0); | 
|  | 132     } | 
|  | 133 | 
|  | 134     /** Test that going into the "add" flow  and cancelling will leave the exist
     ing row checked. */ | 
|  | 135     @MediumTest | 
|  | 136     @Feature({"Payments"}) | 
|  | 137     public void testAddShippingAddressAndCancelEditorShouldKeepAddressSelected() | 
|  | 138             throws InterruptedException, ExecutionException, TimeoutException { | 
|  | 139         triggerUIAndWait(mReadyToPay); | 
|  | 140         clickInShippingSummaryAndWait(R.id.payments_section, mReadyForInput); | 
|  | 141         expectShippingAddressRowIsSelected(0); | 
|  | 142         clickInShippingAddressAndWait(R.id.payments_add_option_button, mReadyToE
     dit); | 
|  | 143 | 
|  | 144         // Cancel the editor. | 
|  | 145         clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); | 
|  | 146 | 
|  | 147         // Expect the existing row to still be selected in the Shipping Address 
     section. | 
|  | 148         expectShippingAddressRowIsSelected(0); | 
|  | 149     } | 
| 116 } | 150 } | 
| OLD | NEW | 
|---|