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 #include "modules/payments/ShippingAddress.h" | 5 #include "modules/payments/ShippingAddress.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 namespace { | 11 namespace { |
12 | 12 |
13 TEST(ShippingAddressTest, ValuesAreCopiedOver) | 13 TEST(ShippingAddressTest, ValuesAreCopiedOver) |
14 { | 14 { |
15 mojom::wtf::ShippingAddressPtr input = mojom::wtf::ShippingAddress::New(); | 15 mojom::blink::ShippingAddressPtr input = mojom::blink::ShippingAddress::New(
); |
16 input->region_code = "US"; | 16 input->region_code = "US"; |
17 input->address_line = mojo::WTFArray<WTF::String>::New(3); | 17 input->address_line = mojo::WTFArray<WTF::String>::New(3); |
18 input->address_line[0] = "340 Main St"; | 18 input->address_line[0] = "340 Main St"; |
19 input->address_line[1] = "BIN1"; | 19 input->address_line[1] = "BIN1"; |
20 input->address_line[2] = "First floor"; | 20 input->address_line[2] = "First floor"; |
21 input->administrative_area = "CA"; | 21 input->administrative_area = "CA"; |
22 input->locality = "Los Angeles"; | 22 input->locality = "Los Angeles"; |
23 input->dependent_locality = "Venice"; | 23 input->dependent_locality = "Venice"; |
24 input->postal_code = "90291"; | 24 input->postal_code = "90291"; |
25 input->sorting_code = "CEDEX"; | 25 input->sorting_code = "CEDEX"; |
(...skipping 14 matching lines...) Expand all Loading... |
40 EXPECT_EQ("Venice", output.dependentLocality()); | 40 EXPECT_EQ("Venice", output.dependentLocality()); |
41 EXPECT_EQ("90291", output.postalCode()); | 41 EXPECT_EQ("90291", output.postalCode()); |
42 EXPECT_EQ("CEDEX", output.sortingCode()); | 42 EXPECT_EQ("CEDEX", output.sortingCode()); |
43 EXPECT_EQ("en-Latn", output.languageCode()); | 43 EXPECT_EQ("en-Latn", output.languageCode()); |
44 EXPECT_EQ("Google", output.organization()); | 44 EXPECT_EQ("Google", output.organization()); |
45 EXPECT_EQ("Jon Doe", output.recipient()); | 45 EXPECT_EQ("Jon Doe", output.recipient()); |
46 } | 46 } |
47 | 47 |
48 TEST(ShippingAddressTest, IgnoreScriptCodeWithEmptyLanguageCode) | 48 TEST(ShippingAddressTest, IgnoreScriptCodeWithEmptyLanguageCode) |
49 { | 49 { |
50 mojom::wtf::ShippingAddressPtr input = mojom::wtf::ShippingAddress::New(); | 50 mojom::blink::ShippingAddressPtr input = mojom::blink::ShippingAddress::New(
); |
51 input->script_code = "Latn"; | 51 input->script_code = "Latn"; |
52 | 52 |
53 ShippingAddress output(std::move(input)); | 53 ShippingAddress output(std::move(input)); |
54 | 54 |
55 EXPECT_TRUE(output.languageCode().isEmpty()); | 55 EXPECT_TRUE(output.languageCode().isEmpty()); |
56 } | 56 } |
57 | 57 |
58 TEST(ShippingAddressTest, NoHyphenWithEmptyScriptCode) | 58 TEST(ShippingAddressTest, NoHyphenWithEmptyScriptCode) |
59 { | 59 { |
60 mojom::wtf::ShippingAddressPtr input = mojom::wtf::ShippingAddress::New(); | 60 mojom::blink::ShippingAddressPtr input = mojom::blink::ShippingAddress::New(
); |
61 input->language_code = "en"; | 61 input->language_code = "en"; |
62 | 62 |
63 ShippingAddress output(std::move(input)); | 63 ShippingAddress output(std::move(input)); |
64 | 64 |
65 EXPECT_EQ("en", output.languageCode()); | 65 EXPECT_EQ("en", output.languageCode()); |
66 } | 66 } |
67 | 67 |
68 } // namespace | 68 } // namespace |
69 } // namespace blink | 69 } // namespace blink |
OLD | NEW |