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 22 matching lines...) Expand all Loading... | |
33 Assert.assertFalse(pattern.matcher("").matches()); | 33 Assert.assertFalse(pattern.matcher("").matches()); |
34 } | 34 } |
35 | 35 |
36 @Test | 36 @Test |
37 public void testToPaymentAddress() { | 37 public void testToPaymentAddress() { |
38 AutofillAddress input = new AutofillAddress(new AutofillProfile("guid", "origin", | 38 AutofillAddress input = new AutofillAddress(new AutofillProfile("guid", "origin", |
39 true /* isLocal */, "full name", "company name", "street\naddres s", "region", | 39 true /* isLocal */, "full name", "company name", "street\naddres s", "region", |
40 "locality", "dependent locality", "postal code", "sorting code", "US", | 40 "locality", "dependent locality", "postal code", "sorting code", "US", |
41 "phone number", "email@address.com", "en-Latn-US")); | 41 "phone number", "email@address.com", "en-Latn-US")); |
42 PaymentAddress output = input.toPaymentAddress(); | 42 PaymentAddress output = input.toPaymentAddress(); |
43 Assert.assertEquals("US", output.regionCode); | 43 Assert.assertEquals("US", output.country); |
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.administrativeArea); | 45 Assert.assertEquals("region", output.region); |
46 Assert.assertEquals("locality", output.locality); | 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); |
please use gerrit instead
2016/06/06 16:01:14
Test that output.careOf is empty string and output
zino
2016/06/06 17:23:16
Done.
| |
54 } | 54 } |
55 | 55 |
56 @Test | 56 @Test |
57 public void testToPaymentAddressWithoutMatchingLanguageScriptCode() { | 57 public void testToPaymentAddressWithoutMatchingLanguageScriptCode() { |
58 AutofillAddress input = new AutofillAddress(new AutofillProfile("guid", "origin", | 58 AutofillAddress input = new AutofillAddress(new AutofillProfile("guid", "origin", |
59 true /* isLocal */, "full name", "company name", "street\naddres s", "region", | 59 true /* isLocal */, "full name", "company name", "street\naddres s", "region", |
60 "locality", "dependent locality", "postal code", "sorting code", "US", | 60 "locality", "dependent locality", "postal code", "sorting code", "US", |
61 "phone number", "email@address.com", "language-code")); | 61 "phone number", "email@address.com", "language-code")); |
62 PaymentAddress output = input.toPaymentAddress(); | 62 PaymentAddress output = input.toPaymentAddress(); |
63 Assert.assertEquals("", output.languageCode); | 63 Assert.assertEquals("", output.languageCode); |
(...skipping 29 matching lines...) Expand all Loading... | |
93 "locality", "dependent locality", "postal code", "sorting code", "US", | 93 "locality", "dependent locality", "postal code", "sorting code", "US", |
94 "phone number", "email@address.com", "en-Latn")); | 94 "phone number", "email@address.com", "en-Latn")); |
95 PaymentAddress output1 = input.toPaymentAddress(); | 95 PaymentAddress output1 = input.toPaymentAddress(); |
96 PaymentAddress output2 = input.toPaymentAddress(); | 96 PaymentAddress output2 = input.toPaymentAddress(); |
97 Assert.assertEquals("en", output1.languageCode); | 97 Assert.assertEquals("en", output1.languageCode); |
98 Assert.assertEquals("en", output2.languageCode); | 98 Assert.assertEquals("en", output2.languageCode); |
99 Assert.assertEquals("Latn", output1.scriptCode); | 99 Assert.assertEquals("Latn", output1.scriptCode); |
100 Assert.assertEquals("Latn", output2.scriptCode); | 100 Assert.assertEquals("Latn", output2.scriptCode); |
101 } | 101 } |
102 } | 102 } |
OLD | NEW |