OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/payments/core/profile_util.h" | 5 #include "components/payments/core/profile_util.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "components/autofill/core/browser/autofill_profile.h" | 13 #include "components/autofill/core/browser/autofill_profile.h" |
14 #include "components/autofill/core/browser/autofill_test_utils.h" | 14 #include "components/autofill/core/browser/autofill_test_utils.h" |
15 #include "components/payments/core/payment_options_provider.h" | 15 #include "components/payments/core/payment_options_provider.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 using autofill::AutofillProfile; | 18 using autofill::AutofillProfile; |
19 | 19 |
20 namespace payments { | 20 namespace payments { |
21 namespace profile_util { | |
22 | 21 |
23 constexpr uint32_t kRequestPayerName = 1 << 0; | 22 constexpr uint32_t kRequestPayerName = 1 << 0; |
24 constexpr uint32_t kRequestPayerEmail = 1 << 1; | 23 constexpr uint32_t kRequestPayerEmail = 1 << 1; |
25 constexpr uint32_t kRequestPayerPhone = 1 << 2; | 24 constexpr uint32_t kRequestPayerPhone = 1 << 2; |
26 constexpr uint32_t kRequestShipping = 1 << 3; | 25 constexpr uint32_t kRequestShipping = 1 << 3; |
27 | 26 |
28 class MockPaymentOptionsProvider : public PaymentOptionsProvider { | 27 class MockPaymentOptionsProvider : public PaymentOptionsProvider { |
29 public: | 28 public: |
30 MockPaymentOptionsProvider(uint32_t options) : options_(options) {} | 29 MockPaymentOptionsProvider(uint32_t options) : options_(options) {} |
31 | 30 |
(...skipping 18 matching lines...) Expand all Loading... |
50 | 49 |
51 AutofillProfile CreateProfileWithContactInfo(const char* name, | 50 AutofillProfile CreateProfileWithContactInfo(const char* name, |
52 const char* email, | 51 const char* email, |
53 const char* phone) { | 52 const char* phone) { |
54 AutofillProfile profile(base::GenerateGUID(), "http://www.example.com/"); | 53 AutofillProfile profile(base::GenerateGUID(), "http://www.example.com/"); |
55 autofill::test::SetProfileInfo(&profile, name, "", "", email, "", "", "", "", | 54 autofill::test::SetProfileInfo(&profile, name, "", "", email, "", "", "", "", |
56 "", "", "", phone); | 55 "", "", "", phone); |
57 return profile; | 56 return profile; |
58 } | 57 } |
59 | 58 |
| 59 AutofillProfile CreateProfileWithCompleteAddress(const char* name, |
| 60 const char* phone) { |
| 61 AutofillProfile profile(base::GenerateGUID(), "http://www.example.com/"); |
| 62 autofill::test::SetProfileInfo(&profile, name, "", "", "", "", "123 Fake St.", |
| 63 "", "Fakesville", "MN", "54000", "US", phone); |
| 64 return profile; |
| 65 } |
| 66 |
| 67 AutofillProfile CreateProfileWithPartialAddress(const char* name, |
| 68 const char* phone) { |
| 69 AutofillProfile profile(base::GenerateGUID(), "http://www.example.com/"); |
| 70 autofill::test::SetProfileInfo(&profile, name, "", "", "", "", "123 Fake St.", |
| 71 "", "", "", "54000", "", phone); |
| 72 return profile; |
| 73 } |
| 74 |
60 TEST(PaymentRequestProfileUtilTest, FilterProfilesForContact) { | 75 TEST(PaymentRequestProfileUtilTest, FilterProfilesForContact) { |
61 // These profiles are subset/equal, so only the first complete one is | 76 // These profiles are subset/equal, so only the first complete one is |
62 // included. | 77 // included. |
63 AutofillProfile exclude_1 = | 78 AutofillProfile exclude_1 = |
64 CreateProfileWithContactInfo("Homer", "", "5551234567"); | 79 CreateProfileWithContactInfo("Homer", "", "6515553226"); |
65 | 80 |
66 AutofillProfile exclude_2 = | 81 AutofillProfile exclude_2 = |
67 CreateProfileWithContactInfo("Homer", "homer@simpson.net", ""); | 82 CreateProfileWithContactInfo("Homer", "homer@simpson.net", ""); |
68 | 83 |
69 AutofillProfile include_1 = | 84 AutofillProfile include_1 = |
70 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "5551234567"); | 85 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "6515553226"); |
71 | 86 |
72 AutofillProfile exclude_3 = | 87 AutofillProfile exclude_3 = |
73 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "5551234567"); | 88 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "6515553226"); |
74 | 89 |
75 // This profile is different, so it should also be included. Since it is | 90 // This profile is different, so it should also be included. Since it is |
76 // less complete than |include_1|, it will appear after. | 91 // less complete than |include_1|, it will appear after. |
77 AutofillProfile include_2 = | 92 AutofillProfile include_2 = |
78 CreateProfileWithContactInfo("Marge", "marge@simpson.net", ""); | 93 CreateProfileWithContactInfo("Marge", "marge@simpson.net", ""); |
79 | 94 |
80 // This profile is different, so it should also be included. Since it is | 95 // This profile is different, so it should also be included. Since it is |
81 // equally complete with |include_1|, it will appear before |include_2|, but | 96 // equally complete with |include_1|, it will appear before |include_2|, but |
82 // after |include_1| since order is preserved amongst profiles of equal | 97 // after |include_1| since order is preserved amongst profiles of equal |
83 // completeness. | 98 // completeness. |
84 AutofillProfile include_3 = CreateProfileWithContactInfo( | 99 AutofillProfile include_3 = CreateProfileWithContactInfo( |
85 "Bart", "eatmyshorts@simpson.net", "5551234567"); | 100 "Bart", "eatmyshorts@simpson.net", "6515553226"); |
86 | 101 |
87 std::vector<AutofillProfile*> profiles = {&exclude_1, &exclude_2, &include_1, | 102 std::vector<AutofillProfile*> profiles = {&exclude_1, &exclude_2, &include_1, |
88 &exclude_3, &include_2, &include_3}; | 103 &exclude_3, &include_2, &include_3}; |
89 | 104 |
90 MockPaymentOptionsProvider provider(kRequestPayerName | kRequestPayerEmail | | 105 MockPaymentOptionsProvider provider(kRequestPayerName | kRequestPayerEmail | |
91 kRequestPayerPhone); | 106 kRequestPayerPhone); |
| 107 PaymentsProfileComparator comp("en-US", provider); |
| 108 |
92 std::vector<AutofillProfile*> filtered = | 109 std::vector<AutofillProfile*> filtered = |
93 FilterProfilesForContact(profiles, "en-US", provider); | 110 comp.FilterProfilesForContact(profiles); |
94 | 111 |
95 ASSERT_EQ(3u, filtered.size()); | 112 ASSERT_EQ(3u, filtered.size()); |
96 EXPECT_EQ(&include_1, filtered[0]); | 113 EXPECT_EQ(&include_1, filtered[0]); |
97 EXPECT_EQ(&include_3, filtered[1]); | 114 EXPECT_EQ(&include_3, filtered[1]); |
98 EXPECT_EQ(&include_2, filtered[2]); | 115 EXPECT_EQ(&include_2, filtered[2]); |
99 | 116 |
100 // Repeat the filter using a provider set to only request phone numbers. | 117 // Repeat the filter using a provider set to only request phone numbers. |
101 // Under these rules, since all profiles have the same (or no) phone number, | 118 // Under these rules, since all profiles have the same (or no) phone number, |
102 // we should only see the first profile with a phone number, |exclude_1|. | 119 // we should only see the first profile with a phone number, |exclude_1|. |
103 MockPaymentOptionsProvider phone_only_provider(kRequestPayerPhone); | 120 MockPaymentOptionsProvider phone_only_provider(kRequestPayerPhone); |
| 121 PaymentsProfileComparator phone_only_comp("en-US", phone_only_provider); |
104 std::vector<AutofillProfile*> filtered_phones = | 122 std::vector<AutofillProfile*> filtered_phones = |
105 FilterProfilesForContact(profiles, "en-US", phone_only_provider); | 123 phone_only_comp.FilterProfilesForContact(profiles); |
106 ASSERT_EQ(1u, filtered_phones.size()); | 124 ASSERT_EQ(1u, filtered_phones.size()); |
107 EXPECT_EQ(&exclude_1, filtered_phones[0]); | 125 EXPECT_EQ(&exclude_1, filtered_phones[0]); |
108 } | 126 } |
109 | 127 |
110 TEST(PaymentRequestProfileUtilTest, IsContactEqualOrSuperset) { | 128 TEST(PaymentRequestProfileUtilTest, IsContactEqualOrSuperset) { |
111 MockPaymentOptionsProvider provider(kRequestPayerName | kRequestPayerEmail | | 129 MockPaymentOptionsProvider provider(kRequestPayerName | kRequestPayerEmail | |
112 kRequestPayerPhone); | 130 kRequestPayerPhone); |
113 PaymentsProfileComparator comp("en-US", provider); | 131 PaymentsProfileComparator comp("en-US", provider); |
114 | 132 |
115 AutofillProfile p1 = | 133 AutofillProfile p1 = |
116 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "5551234567"); | 134 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "6515553226"); |
117 | 135 |
118 // Candidate subset profile is equal. | 136 // Candidate subset profile is equal. |
119 AutofillProfile p2 = | 137 AutofillProfile p2 = |
120 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "5551234567"); | 138 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "6515553226"); |
121 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p1, p2)); | 139 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p1, p2)); |
122 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p2, p1)); | 140 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p2, p1)); |
123 | 141 |
124 // Candidate subset profile has non-matching fields. | 142 // Candidate subset profile has non-matching fields. |
125 AutofillProfile p3 = CreateProfileWithContactInfo( | 143 AutofillProfile p3 = CreateProfileWithContactInfo( |
126 "Homer", "homer@springfieldnuclear.gov", "5551234567"); | 144 "Homer", "homer@springfieldnuclear.gov", "6515553226"); |
127 EXPECT_FALSE(comp.IsContactEqualOrSuperset(p1, p3)); | 145 EXPECT_FALSE(comp.IsContactEqualOrSuperset(p1, p3)); |
128 EXPECT_FALSE(comp.IsContactEqualOrSuperset(p3, p1)); | 146 EXPECT_FALSE(comp.IsContactEqualOrSuperset(p3, p1)); |
129 | 147 |
130 // Candidate subset profile is equal, except for missing fields. | 148 // Candidate subset profile is equal, except for missing fields. |
131 AutofillProfile p4 = | 149 AutofillProfile p4 = |
132 CreateProfileWithContactInfo("Homer", "homer@simpson.net", ""); | 150 CreateProfileWithContactInfo("Homer", "homer@simpson.net", ""); |
133 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p1, p4)); | 151 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p1, p4)); |
134 EXPECT_FALSE(comp.IsContactEqualOrSuperset(p4, p1)); | 152 EXPECT_FALSE(comp.IsContactEqualOrSuperset(p4, p1)); |
135 | 153 |
136 // One field is common, but each has a field which the other is missing. | 154 // One field is common, but each has a field which the other is missing. |
137 AutofillProfile p5 = | 155 AutofillProfile p5 = |
138 CreateProfileWithContactInfo("Homer", "homer@simpson.net", ""); | 156 CreateProfileWithContactInfo("Homer", "homer@simpson.net", ""); |
139 AutofillProfile p6 = CreateProfileWithContactInfo("Homer", "", "5551234567"); | 157 AutofillProfile p6 = CreateProfileWithContactInfo("Homer", "", "6515553226"); |
140 EXPECT_FALSE(comp.IsContactEqualOrSuperset(p5, p6)); | 158 EXPECT_FALSE(comp.IsContactEqualOrSuperset(p5, p6)); |
141 EXPECT_FALSE(comp.IsContactEqualOrSuperset(p6, p5)); | 159 EXPECT_FALSE(comp.IsContactEqualOrSuperset(p6, p5)); |
142 } | 160 } |
143 | 161 |
144 TEST(PaymentRequestProfileUtilTest, IsContactEqualOrSuperset_WithFieldIgnored) { | 162 TEST(PaymentRequestProfileUtilTest, IsContactEqualOrSuperset_WithFieldIgnored) { |
145 // Discrepancies in email should be ignored throughout this test. | 163 // Discrepancies in email should be ignored throughout this test. |
146 MockPaymentOptionsProvider provider(kRequestPayerName | kRequestPayerPhone); | 164 MockPaymentOptionsProvider provider(kRequestPayerName | kRequestPayerPhone); |
147 PaymentsProfileComparator comp("en-US", provider); | 165 PaymentsProfileComparator comp("en-US", provider); |
148 | 166 |
149 AutofillProfile p1 = | 167 AutofillProfile p1 = |
150 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "5551234567"); | 168 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "6515553226"); |
151 | 169 |
152 // Candidate subset profile is equal. | 170 // Candidate subset profile is equal. |
153 AutofillProfile p2 = | 171 AutofillProfile p2 = |
154 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "5551234567"); | 172 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "6515553226"); |
155 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p1, p2)); | 173 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p1, p2)); |
156 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p2, p1)); | 174 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p2, p1)); |
157 | 175 |
158 // Email fields don't match, but profiles are still equal. | 176 // Email fields don't match, but profiles are still equal. |
159 AutofillProfile p3 = CreateProfileWithContactInfo( | 177 AutofillProfile p3 = CreateProfileWithContactInfo( |
160 "Homer", "homer@springfieldnuclear.gov", "5551234567"); | 178 "Homer", "homer@springfieldnuclear.gov", "6515553226"); |
161 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p1, p3)); | 179 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p1, p3)); |
162 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p3, p1)); | 180 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p3, p1)); |
163 | 181 |
164 // Profile without an email is mutual subset of profile with an email. | 182 // Profile without an email is mutual subset of profile with an email. |
165 AutofillProfile p4 = CreateProfileWithContactInfo("Homer", "", "5551234567"); | 183 AutofillProfile p4 = CreateProfileWithContactInfo("Homer", "", "6515553226"); |
166 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p1, p4)); | 184 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p1, p4)); |
167 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p4, p1)); | 185 EXPECT_TRUE(comp.IsContactEqualOrSuperset(p4, p1)); |
168 } | 186 } |
169 | 187 |
170 TEST(PaymentRequestProfileUtilTest, GetContactCompletenessScore) { | 188 TEST(PaymentRequestProfileUtilTest, GetContactCompletenessScore) { |
171 MockPaymentOptionsProvider provider(kRequestPayerName | kRequestPayerPhone); | 189 MockPaymentOptionsProvider provider(kRequestPayerName | kRequestPayerPhone); |
172 PaymentsProfileComparator comp("en-US", provider); | 190 PaymentsProfileComparator comp("en-US", provider); |
173 | 191 |
174 // Two completeness points: One each for name and phone number, but not email | 192 // Two completeness points: One each for name and phone number, but not email |
175 // as it was not requested. | 193 // as it was not requested. |
176 AutofillProfile p1 = | 194 AutofillProfile p1 = |
177 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "5551234567"); | 195 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "6515553226"); |
178 EXPECT_EQ(2, comp.GetContactCompletenessScore(&p1)); | 196 EXPECT_EQ(2, comp.GetContactCompletenessScore(&p1)); |
179 | 197 |
180 // One completeness point for name, no points for phone number (missing) or | 198 // One completeness point for name, no points for phone number (missing) or |
181 // email (not requested). | 199 // email (not requested). |
182 AutofillProfile p2 = | 200 AutofillProfile p2 = |
183 CreateProfileWithContactInfo("Homer", "homer@simpson.net", ""); | 201 CreateProfileWithContactInfo("Homer", "homer@simpson.net", ""); |
184 EXPECT_EQ(1, comp.GetContactCompletenessScore(&p2)); | 202 EXPECT_EQ(1, comp.GetContactCompletenessScore(&p2)); |
185 | 203 |
186 // No completeness points, as the only field present was not requested. | 204 // No completeness points, as the only field present was not requested. |
187 AutofillProfile p3 = | 205 AutofillProfile p3 = |
188 CreateProfileWithContactInfo("", "homer@simpson.net", ""); | 206 CreateProfileWithContactInfo("", "homer@simpson.net", ""); |
189 EXPECT_EQ(0, comp.GetContactCompletenessScore(&p3)); | 207 EXPECT_EQ(0, comp.GetContactCompletenessScore(&p3)); |
190 | 208 |
191 // Null profile returns 0. | 209 // Null profile returns 0. |
192 EXPECT_EQ(0, comp.GetContactCompletenessScore(nullptr)); | 210 EXPECT_EQ(0, comp.GetContactCompletenessScore(nullptr)); |
193 } | 211 } |
194 | 212 |
195 TEST(PaymentRequestProfileUtilTest, IsContactInfoComplete) { | 213 TEST(PaymentRequestProfileUtilTest, IsContactInfoComplete) { |
196 MockPaymentOptionsProvider provider(kRequestPayerName | kRequestPayerEmail); | 214 MockPaymentOptionsProvider provider(kRequestPayerName | kRequestPayerEmail); |
197 PaymentsProfileComparator comp("en-US", provider); | 215 PaymentsProfileComparator comp("en-US", provider); |
198 | 216 |
199 // If name and email are present, return true regardless of the (ignored) | 217 // If name and email are present, return true regardless of the (ignored) |
200 // phone value. | 218 // phone value. |
201 AutofillProfile p1 = | 219 AutofillProfile p1 = |
202 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "5551234567"); | 220 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "6515553226"); |
203 AutofillProfile p2 = | 221 AutofillProfile p2 = |
204 CreateProfileWithContactInfo("Homer", "homer@simpson.net", ""); | 222 CreateProfileWithContactInfo("Homer", "homer@simpson.net", ""); |
205 | 223 |
206 EXPECT_TRUE(comp.IsContactInfoComplete(&p1)); | 224 EXPECT_TRUE(comp.IsContactInfoComplete(&p1)); |
207 EXPECT_TRUE(comp.IsContactInfoComplete(&p2)); | 225 EXPECT_TRUE(comp.IsContactInfoComplete(&p2)); |
208 | 226 |
209 // If name is not present, return false regardless of the (ignored) | 227 // If name is not present, return false regardless of the (ignored) |
210 // phone value. | 228 // phone value. |
211 AutofillProfile p3 = | 229 AutofillProfile p3 = |
212 CreateProfileWithContactInfo("", "homer@simpson.net", "5551234567"); | 230 CreateProfileWithContactInfo("", "homer@simpson.net", "6515553226"); |
213 AutofillProfile p4 = | 231 AutofillProfile p4 = |
214 CreateProfileWithContactInfo("", "homer@simpson.net", ""); | 232 CreateProfileWithContactInfo("", "homer@simpson.net", ""); |
215 | 233 |
216 EXPECT_FALSE(comp.IsContactInfoComplete(&p3)); | 234 EXPECT_FALSE(comp.IsContactInfoComplete(&p3)); |
217 EXPECT_FALSE(comp.IsContactInfoComplete(&p4)); | 235 EXPECT_FALSE(comp.IsContactInfoComplete(&p4)); |
218 | 236 |
219 // If no fields are requested, any profile (even empty or null) is complete. | 237 // If no fields are requested, any profile (even empty or null) is complete. |
220 MockPaymentOptionsProvider empty_provider(0); | 238 MockPaymentOptionsProvider empty_provider(0); |
221 PaymentsProfileComparator empty_comp("en-US", empty_provider); | 239 PaymentsProfileComparator empty_comp("en-US", empty_provider); |
222 | 240 |
223 AutofillProfile p5 = CreateProfileWithContactInfo("", "", ""); | 241 AutofillProfile p5 = CreateProfileWithContactInfo("", "", ""); |
224 | 242 |
225 EXPECT_TRUE(empty_comp.IsContactInfoComplete(&p1)); | 243 EXPECT_TRUE(empty_comp.IsContactInfoComplete(&p1)); |
226 EXPECT_TRUE(empty_comp.IsContactInfoComplete(&p5)); | 244 EXPECT_TRUE(empty_comp.IsContactInfoComplete(&p5)); |
227 EXPECT_TRUE(empty_comp.IsContactInfoComplete(nullptr)); | 245 EXPECT_TRUE(empty_comp.IsContactInfoComplete(nullptr)); |
228 } | 246 } |
229 | 247 |
230 } // namespace profile_util | 248 TEST(PaymentRequestProfileUtilTest, IsShippingComplete) { |
| 249 MockPaymentOptionsProvider provider(kRequestShipping); |
| 250 PaymentsProfileComparator comp("en-US", provider); |
| 251 |
| 252 // True if name, phone, and address are all populated. |
| 253 AutofillProfile p1 = CreateProfileWithCompleteAddress("Homer", "6515553226"); |
| 254 EXPECT_TRUE(comp.IsShippingComplete(&p1)); |
| 255 |
| 256 // False if address is partially populated. |
| 257 AutofillProfile p2 = CreateProfileWithPartialAddress("Homer", "6515553226"); |
| 258 EXPECT_FALSE(comp.IsShippingComplete(&p2)); |
| 259 |
| 260 // False if name isn't populated. |
| 261 AutofillProfile p3 = CreateProfileWithCompleteAddress("", "6515553226"); |
| 262 EXPECT_FALSE(comp.IsShippingComplete(&p3)); |
| 263 |
| 264 // False if phone isn't populated. |
| 265 AutofillProfile p4 = CreateProfileWithCompleteAddress("Homer", ""); |
| 266 EXPECT_FALSE(comp.IsShippingComplete(&p4)); |
| 267 |
| 268 // False if only contact info (no address fields) is populated. |
| 269 AutofillProfile p5 = |
| 270 CreateProfileWithContactInfo("Homer", "homer@simpson.net", "6515553226"); |
| 271 EXPECT_FALSE(comp.IsShippingComplete(&p5)); |
| 272 |
| 273 MockPaymentOptionsProvider provider_no_shipping(0); |
| 274 PaymentsProfileComparator comp_no_shipping("en-US", provider_no_shipping); |
| 275 // nullptr is handled correctly: false if shipping requested, true if not. |
| 276 EXPECT_FALSE(comp.IsShippingComplete(nullptr)); |
| 277 EXPECT_TRUE(comp_no_shipping.IsShippingComplete(nullptr)); |
| 278 } |
| 279 |
231 } // namespace payments | 280 } // namespace payments |
OLD | NEW |