| 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 org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; | 7 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
| 8 import org.chromium.mojom.payments.PaymentAddress; | 8 import org.chromium.mojom.payments.PaymentAddress; |
| 9 import org.chromium.testing.local.LocalRobolectricTestRunner; | 9 import org.chromium.testing.local.LocalRobolectricTestRunner; |
| 10 import org.junit.Assert; | 10 import org.junit.Assert; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 Assert.assertArrayEquals(new String[]{"street", "address"}, output.addre
ssLine); | 44 Assert.assertArrayEquals(new String[]{"street", "address"}, output.addre
ssLine); |
| 45 Assert.assertEquals("region", output.region); | 45 Assert.assertEquals("region", output.region); |
| 46 Assert.assertEquals("locality", output.city); | 46 Assert.assertEquals("locality", output.city); |
| 47 Assert.assertEquals("dependent locality", output.dependentLocality); | 47 Assert.assertEquals("dependent locality", output.dependentLocality); |
| 48 Assert.assertEquals("postal code", output.postalCode); | 48 Assert.assertEquals("postal code", output.postalCode); |
| 49 Assert.assertEquals("sorting code", output.sortingCode); | 49 Assert.assertEquals("sorting code", output.sortingCode); |
| 50 Assert.assertEquals("company name", output.organization); | 50 Assert.assertEquals("company name", output.organization); |
| 51 Assert.assertEquals("full name", output.recipient); | 51 Assert.assertEquals("full name", output.recipient); |
| 52 Assert.assertEquals("en", output.languageCode); | 52 Assert.assertEquals("en", output.languageCode); |
| 53 Assert.assertEquals("Latn", output.scriptCode); | 53 Assert.assertEquals("Latn", output.scriptCode); |
| 54 Assert.assertEquals("", output.careOf); | |
| 55 Assert.assertEquals("phone number", output.phone); | 54 Assert.assertEquals("phone number", output.phone); |
| 56 } | 55 } |
| 57 | 56 |
| 58 @Test | 57 @Test |
| 59 public void testToPaymentAddressWithoutMatchingLanguageScriptCode() { | 58 public void testToPaymentAddressWithoutMatchingLanguageScriptCode() { |
| 60 AutofillAddress input = new AutofillAddress(new AutofillProfile("guid",
"origin", | 59 AutofillAddress input = new AutofillAddress(new AutofillProfile("guid",
"origin", |
| 61 true /* isLocal */, "full name", "company name", "street\naddres
s", "region", | 60 true /* isLocal */, "full name", "company name", "street\naddres
s", "region", |
| 62 "locality", "dependent locality", "postal code", "sorting code",
"US", | 61 "locality", "dependent locality", "postal code", "sorting code",
"US", |
| 63 "phone number", "email@address.com", "language-code")); | 62 "phone number", "email@address.com", "language-code")); |
| 64 PaymentAddress output = input.toPaymentAddress(); | 63 PaymentAddress output = input.toPaymentAddress(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 95 "locality", "dependent locality", "postal code", "sorting code",
"US", | 94 "locality", "dependent locality", "postal code", "sorting code",
"US", |
| 96 "phone number", "email@address.com", "en-Latn")); | 95 "phone number", "email@address.com", "en-Latn")); |
| 97 PaymentAddress output1 = input.toPaymentAddress(); | 96 PaymentAddress output1 = input.toPaymentAddress(); |
| 98 PaymentAddress output2 = input.toPaymentAddress(); | 97 PaymentAddress output2 = input.toPaymentAddress(); |
| 99 Assert.assertEquals("en", output1.languageCode); | 98 Assert.assertEquals("en", output1.languageCode); |
| 100 Assert.assertEquals("en", output2.languageCode); | 99 Assert.assertEquals("en", output2.languageCode); |
| 101 Assert.assertEquals("Latn", output1.scriptCode); | 100 Assert.assertEquals("Latn", output1.scriptCode); |
| 102 Assert.assertEquals("Latn", output2.scriptCode); | 101 Assert.assertEquals("Latn", output2.scriptCode); |
| 103 } | 102 } |
| 104 } | 103 } |
| OLD | NEW |