OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/json/json_reader.h" | 5 #include "base/json/json_reader.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "components/autofill/content/browser/wallet/required_action.h" | 10 #include "components/autofill/content/browser/wallet/required_action.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 " \"expiration_year\":2012," | 27 " \"expiration_year\":2012," |
28 " \"billing_address\":" | 28 " \"billing_address\":" |
29 " {" | 29 " {" |
30 " \"name\":\"name\"," | 30 " \"name\":\"name\"," |
31 " \"address1\":\"address1\"," | 31 " \"address1\":\"address1\"," |
32 " \"address2\":\"address2\"," | 32 " \"address2\":\"address2\"," |
33 " \"city\":\"city\"," | 33 " \"city\":\"city\"," |
34 " \"state\":\"state\"," | 34 " \"state\":\"state\"," |
35 " \"postal_code\":\"postal_code\"," | 35 " \"postal_code\":\"postal_code\"," |
36 " \"phone_number\":\"phone_number\"," | 36 " \"phone_number\":\"phone_number\"," |
37 " \"country_code\":\"country_code\"," | 37 " \"country_code\":\"US\"," |
38 " \"type\":\"FULL\"" | 38 " \"type\":\"FULL\"" |
39 " }," | 39 " }," |
40 " \"status\":\"VALID\"," | 40 " \"status\":\"VALID\"," |
41 " \"object_id\":\"object_id\"" | 41 " \"object_id\":\"object_id\"" |
42 "}"; | 42 "}"; |
43 | 43 |
44 const char kMaskedInstrumentMissingStatus[] = | 44 const char kMaskedInstrumentMissingStatus[] = |
45 "{" | 45 "{" |
46 " \"descriptive_name\":\"descriptive_name\"," | 46 " \"descriptive_name\":\"descriptive_name\"," |
47 " \"type\":\"VISA\"," | 47 " \"type\":\"VISA\"," |
48 " \"supported_currency\":" | 48 " \"supported_currency\":" |
49 " [" | 49 " [" |
50 " \"currency\"" | 50 " \"currency\"" |
51 " ]," | 51 " ]," |
52 " \"last_four_digits\":\"last_four_digits\"," | 52 " \"last_four_digits\":\"last_four_digits\"," |
53 " \"expiration_month\":12," | 53 " \"expiration_month\":12," |
54 " \"expiration_year\":2012," | 54 " \"expiration_year\":2012," |
55 " \"billing_address\":" | 55 " \"billing_address\":" |
56 " {" | 56 " {" |
57 " \"name\":\"name\"," | 57 " \"name\":\"name\"," |
58 " \"address1\":\"address1\"," | 58 " \"address1\":\"address1\"," |
59 " \"address2\":\"address2\"," | 59 " \"address2\":\"address2\"," |
60 " \"city\":\"city\"," | 60 " \"city\":\"city\"," |
61 " \"state\":\"state\"," | 61 " \"state\":\"state\"," |
62 " \"postal_code\":\"postal_code\"," | 62 " \"postal_code\":\"postal_code\"," |
63 " \"phone_number\":\"phone_number\"," | 63 " \"phone_number\":\"phone_number\"," |
64 " \"country_code\":\"country_code\"" | 64 " \"country_code\":\"US\"" |
65 " }," | 65 " }," |
66 " \"object_id\":\"object_id\"," | 66 " \"object_id\":\"object_id\"," |
67 " \"amex_disallowed\":true" | 67 " \"amex_disallowed\":true" |
68 "}"; | 68 "}"; |
69 | 69 |
70 const char kMaskedInstrumentMissingType[] = | 70 const char kMaskedInstrumentMissingType[] = |
71 "{" | 71 "{" |
72 " \"descriptive_name\":\"descriptive_name\"," | 72 " \"descriptive_name\":\"descriptive_name\"," |
73 " \"supported_currency\":" | 73 " \"supported_currency\":" |
74 " [" | 74 " [" |
75 " \"currency\"" | 75 " \"currency\"" |
76 " ]," | 76 " ]," |
77 " \"last_four_digits\":\"last_four_digits\"," | 77 " \"last_four_digits\":\"last_four_digits\"," |
78 " \"expiration_month\":12," | 78 " \"expiration_month\":12," |
79 " \"expiration_year\":2012," | 79 " \"expiration_year\":2012," |
80 " \"billing_address\":" | 80 " \"billing_address\":" |
81 " {" | 81 " {" |
82 " \"name\":\"name\"," | 82 " \"name\":\"name\"," |
83 " \"address1\":\"address1\"," | 83 " \"address1\":\"address1\"," |
84 " \"address2\":\"address2\"," | 84 " \"address2\":\"address2\"," |
85 " \"city\":\"city\"," | 85 " \"city\":\"city\"," |
86 " \"state\":\"state\"," | 86 " \"state\":\"state\"," |
87 " \"postal_code\":\"postal_code\"," | 87 " \"postal_code\":\"postal_code\"," |
88 " \"phone_number\":\"phone_number\"," | 88 " \"phone_number\":\"phone_number\"," |
89 " \"country_code\":\"country_code\"" | 89 " \"country_code\":\"US\"" |
90 " }," | 90 " }," |
91 " \"status\":\"VALID\"," | 91 " \"status\":\"VALID\"," |
92 " \"object_id\":\"object_id\"" | 92 " \"object_id\":\"object_id\"" |
93 "}"; | 93 "}"; |
94 | 94 |
95 const char kMaskedInstrumentMissingLastFourDigits[] = | 95 const char kMaskedInstrumentMissingLastFourDigits[] = |
96 "{" | 96 "{" |
97 " \"descriptive_name\":\"descriptive_name\"," | 97 " \"descriptive_name\":\"descriptive_name\"," |
98 " \"type\":\"VISA\"," | 98 " \"type\":\"VISA\"," |
99 " \"supported_currency\":" | 99 " \"supported_currency\":" |
100 " [" | 100 " [" |
101 " \"currency\"" | 101 " \"currency\"" |
102 " ]," | 102 " ]," |
103 " \"expiration_month\":12," | 103 " \"expiration_month\":12," |
104 " \"expiration_year\":2012," | 104 " \"expiration_year\":2012," |
105 " \"billing_address\":" | 105 " \"billing_address\":" |
106 " {" | 106 " {" |
107 " \"name\":\"name\"," | 107 " \"name\":\"name\"," |
108 " \"address1\":\"address1\"," | 108 " \"address1\":\"address1\"," |
109 " \"address2\":\"address2\"," | 109 " \"address2\":\"address2\"," |
110 " \"city\":\"city\"," | 110 " \"city\":\"city\"," |
111 " \"state\":\"state\"," | 111 " \"state\":\"state\"," |
112 " \"postal_code\":\"postal_code\"," | 112 " \"postal_code\":\"postal_code\"," |
113 " \"phone_number\":\"phone_number\"," | 113 " \"phone_number\":\"phone_number\"," |
114 " \"country_code\":\"country_code\"" | 114 " \"country_code\":\"US\"" |
115 " }," | 115 " }," |
116 " \"status\":\"VALID\"," | 116 " \"status\":\"VALID\"," |
117 " \"object_id\":\"object_id\"" | 117 " \"object_id\":\"object_id\"" |
118 "}"; | 118 "}"; |
119 | 119 |
120 const char kMaskedInstrumentMissingAddress[] = | 120 const char kMaskedInstrumentMissingAddress[] = |
121 "{" | 121 "{" |
122 " \"descriptive_name\":\"descriptive_name\"," | 122 " \"descriptive_name\":\"descriptive_name\"," |
123 " \"type\":\"VISA\"," | 123 " \"type\":\"VISA\"," |
124 " \"supported_currency\":" | 124 " \"supported_currency\":" |
(...skipping 18 matching lines...) Expand all Loading... |
143 " \"last_four_digits\":\"last_four_digits\"," | 143 " \"last_four_digits\":\"last_four_digits\"," |
144 " \"expiration_month\":12," | 144 " \"expiration_month\":12," |
145 " \"expiration_year\":2012," | 145 " \"expiration_year\":2012," |
146 " \"billing_address\":" | 146 " \"billing_address\":" |
147 " {" | 147 " {" |
148 " \"address1\":\"address1\"," | 148 " \"address1\":\"address1\"," |
149 " \"address2\":\"address2\"," | 149 " \"address2\":\"address2\"," |
150 " \"city\":\"city\"," | 150 " \"city\":\"city\"," |
151 " \"state\":\"state\"," | 151 " \"state\":\"state\"," |
152 " \"phone_number\":\"phone_number\"," | 152 " \"phone_number\":\"phone_number\"," |
153 " \"country_code\":\"country_code\"" | 153 " \"country_code\":\"US\"" |
154 " }," | 154 " }," |
155 " \"status\":\"VALID\"," | 155 " \"status\":\"VALID\"," |
156 " \"object_id\":\"object_id\"" | 156 " \"object_id\":\"object_id\"" |
157 "}"; | 157 "}"; |
158 | 158 |
159 const char kMaskedInstrumentMissingObjectId[] = | 159 const char kMaskedInstrumentMissingObjectId[] = |
160 "{" | 160 "{" |
161 " \"descriptive_name\":\"descriptive_name\"," | 161 " \"descriptive_name\":\"descriptive_name\"," |
162 " \"type\":\"VISA\"," | 162 " \"type\":\"VISA\"," |
163 " \"supported_currency\":" | 163 " \"supported_currency\":" |
164 " [" | 164 " [" |
165 " \"currency\"" | 165 " \"currency\"" |
166 " ]," | 166 " ]," |
167 " \"last_four_digits\":\"last_four_digits\"," | 167 " \"last_four_digits\":\"last_four_digits\"," |
168 " \"expiration_month\":12," | 168 " \"expiration_month\":12," |
169 " \"expiration_year\":2012," | 169 " \"expiration_year\":2012," |
170 " \"billing_address\":" | 170 " \"billing_address\":" |
171 " {" | 171 " {" |
172 " \"name\":\"name\"," | 172 " \"name\":\"name\"," |
173 " \"address1\":\"address1\"," | 173 " \"address1\":\"address1\"," |
174 " \"address2\":\"address2\"," | 174 " \"address2\":\"address2\"," |
175 " \"city\":\"city\"," | 175 " \"city\":\"city\"," |
176 " \"state\":\"state\"," | 176 " \"state\":\"state\"," |
177 " \"postal_code\":\"postal_code\"," | 177 " \"postal_code\":\"postal_code\"," |
178 " \"phone_number\":\"phone_number\"," | 178 " \"phone_number\":\"phone_number\"," |
179 " \"country_code\":\"country_code\"" | 179 " \"country_code\":\"US\"" |
180 " }," | 180 " }," |
181 " \"status\":\"VALID\"" | 181 " \"status\":\"VALID\"" |
182 "}"; | 182 "}"; |
183 | 183 |
184 const char kLegalDocument[] = | 184 const char kLegalDocument[] = |
185 "{" | 185 "{" |
186 " \"legal_document_id\":\"doc_id\"," | 186 " \"legal_document_id\":\"doc_id\"," |
187 " \"display_name\":\"display_name\"" | 187 " \"display_name\":\"display_name\"" |
188 "}"; | 188 "}"; |
189 | 189 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 " \"expiration_year\":2012," | 243 " \"expiration_year\":2012," |
244 " \"billing_address\":" | 244 " \"billing_address\":" |
245 " {" | 245 " {" |
246 " \"name\":\"name\"," | 246 " \"name\":\"name\"," |
247 " \"address1\":\"address1\"," | 247 " \"address1\":\"address1\"," |
248 " \"address2\":\"address2\"," | 248 " \"address2\":\"address2\"," |
249 " \"city\":\"city\"," | 249 " \"city\":\"city\"," |
250 " \"state\":\"state\"," | 250 " \"state\":\"state\"," |
251 " \"postal_code\":\"postal_code\"," | 251 " \"postal_code\":\"postal_code\"," |
252 " \"phone_number\":\"phone_number\"," | 252 " \"phone_number\":\"phone_number\"," |
253 " \"country_code\":\"country_code\"" | 253 " \"country_code\":\"US\"" |
254 " }," | 254 " }," |
255 " \"status\":\"VALID\"," | 255 " \"status\":\"VALID\"," |
256 " \"object_id\":\"object_id\"" | 256 " \"object_id\":\"object_id\"" |
257 " }" | 257 " }" |
258 " ]," | 258 " ]," |
259 " \"default_instrument_id\":\"default_instrument_id\"," | 259 " \"default_instrument_id\":\"default_instrument_id\"," |
260 " \"address\":" | 260 " \"address\":" |
261 " [" | 261 " [" |
262 " {" | 262 " {" |
263 " \"id\":\"id\"," | 263 " \"id\":\"id\"," |
264 " \"phone_number\":\"phone_number\"," | 264 " \"phone_number\":\"phone_number\"," |
265 " \"postal_address\":" | 265 " \"postal_address\":" |
266 " {" | 266 " {" |
267 " \"recipient_name\":\"recipient_name\"," | 267 " \"recipient_name\":\"recipient_name\"," |
268 " \"address_line\":" | 268 " \"address_line\":" |
269 " [" | 269 " [" |
270 " \"address_line_1\"," | 270 " \"address_line_1\"," |
271 " \"address_line_2\"" | 271 " \"address_line_2\"" |
272 " ]," | 272 " ]," |
273 " \"locality_name\":\"locality_name\"," | 273 " \"locality_name\":\"locality_name\"," |
274 " \"administrative_area_name\":\"administrative_area_name\"," | 274 " \"administrative_area_name\":\"administrative_area_name\"," |
275 " \"postal_code_number\":\"postal_code_number\"," | 275 " \"postal_code_number\":\"postal_code_number\"," |
276 " \"country_name_code\":\"country_name_code\"" | 276 " \"country_name_code\":\"US\"" |
277 " }" | 277 " }" |
278 " }" | 278 " }" |
279 " ]," | 279 " ]," |
280 " \"default_address_id\":\"default_address_id\"," | 280 " \"default_address_id\":\"default_address_id\"," |
281 " \"obfuscated_gaia_id\":\"obfuscated_gaia_id\"," | 281 " \"obfuscated_gaia_id\":\"obfuscated_gaia_id\"," |
282 " \"amex_disallowed\":true," | 282 " \"amex_disallowed\":true," |
283 " \"required_legal_document\":" | 283 " \"required_legal_document\":" |
284 " [" | 284 " [" |
285 " {" | 285 " {" |
286 " \"legal_document_id\":\"doc_id\"," | 286 " \"legal_document_id\":\"doc_id\"," |
(...skipping 22 matching lines...) Expand all Loading... |
309 " \"expiration_year\":2012," | 309 " \"expiration_year\":2012," |
310 " \"billing_address\":" | 310 " \"billing_address\":" |
311 " {" | 311 " {" |
312 " \"name\":\"name\"," | 312 " \"name\":\"name\"," |
313 " \"address1\":\"address1\"," | 313 " \"address1\":\"address1\"," |
314 " \"address2\":\"address2\"," | 314 " \"address2\":\"address2\"," |
315 " \"city\":\"city\"," | 315 " \"city\":\"city\"," |
316 " \"state\":\"state\"," | 316 " \"state\":\"state\"," |
317 " \"postal_code\":\"postal_code\"," | 317 " \"postal_code\":\"postal_code\"," |
318 " \"phone_number\":\"phone_number\"," | 318 " \"phone_number\":\"phone_number\"," |
319 " \"country_code\":\"country_code\"," | 319 " \"country_code\":\"US\"," |
320 " \"type\":\"FULL\"" | 320 " \"type\":\"FULL\"" |
321 " }," | 321 " }," |
322 " \"status\":\"VALID\"," | 322 " \"status\":\"VALID\"," |
323 " \"object_id\":\"object_id\"" | 323 " \"object_id\":\"object_id\"" |
324 " }" | 324 " }" |
325 " ]," | 325 " ]," |
326 " \"default_instrument_id\":\"default_instrument_id\"," | 326 " \"default_instrument_id\":\"default_instrument_id\"," |
327 " \"address\":" | 327 " \"address\":" |
328 " [" | 328 " [" |
329 " {" | 329 " {" |
330 " \"id\":\"id\"," | 330 " \"id\":\"id\"," |
331 " \"phone_number\":\"phone_number\"," | 331 " \"phone_number\":\"phone_number\"," |
332 " \"postal_address\":" | 332 " \"postal_address\":" |
333 " {" | 333 " {" |
334 " \"recipient_name\":\"recipient_name\"," | 334 " \"recipient_name\":\"recipient_name\"," |
335 " \"address_line\":" | 335 " \"address_line\":" |
336 " [" | 336 " [" |
337 " \"address_line_1\"," | 337 " \"address_line_1\"," |
338 " \"address_line_2\"" | 338 " \"address_line_2\"" |
339 " ]," | 339 " ]," |
340 " \"locality_name\":\"locality_name\"," | 340 " \"locality_name\":\"locality_name\"," |
341 " \"administrative_area_name\":\"administrative_area_name\"," | 341 " \"administrative_area_name\":\"administrative_area_name\"," |
342 " \"postal_code_number\":\"postal_code_number\"," | 342 " \"postal_code_number\":\"postal_code_number\"," |
343 " \"country_name_code\":\"country_name_code\"" | 343 " \"country_name_code\":\"US\"" |
344 " }" | 344 " }" |
345 " }" | 345 " }" |
346 " ]," | 346 " ]," |
347 " \"default_address_id\":\"default_address_id\"," | 347 " \"default_address_id\":\"default_address_id\"," |
348 " \"obfuscated_gaia_id\":\"obfuscated_gaia_id\"," | 348 " \"obfuscated_gaia_id\":\"obfuscated_gaia_id\"," |
349 " \"amex_disallowed\":true"; | 349 " \"amex_disallowed\":true"; |
350 | 350 |
351 const char kRequiredLegalDocument[] = | 351 const char kRequiredLegalDocument[] = |
352 " ," | 352 " ," |
353 " \"required_legal_document\":" | 353 " \"required_legal_document\":" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } | 409 } |
410 | 410 |
411 TEST_F(WalletItemsTest, CreateMaskedInstrumentMissingObjectId) { | 411 TEST_F(WalletItemsTest, CreateMaskedInstrumentMissingObjectId) { |
412 SetUpDictionary(kMaskedInstrumentMissingObjectId); | 412 SetUpDictionary(kMaskedInstrumentMissingObjectId); |
413 EXPECT_EQ(NULL, | 413 EXPECT_EQ(NULL, |
414 WalletItems::MaskedInstrument::CreateMaskedInstrument(*dict).get()); | 414 WalletItems::MaskedInstrument::CreateMaskedInstrument(*dict).get()); |
415 } | 415 } |
416 | 416 |
417 TEST_F(WalletItemsTest, CreateMaskedInstrument) { | 417 TEST_F(WalletItemsTest, CreateMaskedInstrument) { |
418 SetUpDictionary(kMaskedInstrument); | 418 SetUpDictionary(kMaskedInstrument); |
419 scoped_ptr<Address> address(new Address("country_code", | 419 scoped_ptr<Address> address(new Address("US", |
420 ASCIIToUTF16("name"), | 420 ASCIIToUTF16("name"), |
421 ASCIIToUTF16("address1"), | 421 ASCIIToUTF16("address1"), |
422 ASCIIToUTF16("address2"), | 422 ASCIIToUTF16("address2"), |
423 ASCIIToUTF16("city"), | 423 ASCIIToUTF16("city"), |
424 ASCIIToUTF16("state"), | 424 ASCIIToUTF16("state"), |
425 ASCIIToUTF16("postal_code"), | 425 ASCIIToUTF16("postal_code"), |
426 ASCIIToUTF16("phone_number"), | 426 ASCIIToUTF16("phone_number"), |
427 std::string())); | 427 std::string())); |
428 std::vector<base::string16> supported_currencies; | 428 std::vector<base::string16> supported_currencies; |
429 supported_currencies.push_back(ASCIIToUTF16("currency")); | 429 supported_currencies.push_back(ASCIIToUTF16("currency")); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 TEST_F(WalletItemsTest, CreateWalletItems) { | 521 TEST_F(WalletItemsTest, CreateWalletItems) { |
522 SetUpDictionary(std::string(kWalletItems) + std::string(kCloseJson)); | 522 SetUpDictionary(std::string(kWalletItems) + std::string(kCloseJson)); |
523 std::vector<RequiredAction> required_actions; | 523 std::vector<RequiredAction> required_actions; |
524 WalletItems expected(required_actions, | 524 WalletItems expected(required_actions, |
525 "google_transaction_id", | 525 "google_transaction_id", |
526 "default_instrument_id", | 526 "default_instrument_id", |
527 "default_address_id", | 527 "default_address_id", |
528 "obfuscated_gaia_id", | 528 "obfuscated_gaia_id", |
529 AMEX_DISALLOWED); | 529 AMEX_DISALLOWED); |
530 | 530 |
531 scoped_ptr<Address> billing_address(new Address("country_code", | 531 scoped_ptr<Address> billing_address(new Address("US", |
532 ASCIIToUTF16("name"), | 532 ASCIIToUTF16("name"), |
533 ASCIIToUTF16("address1"), | 533 ASCIIToUTF16("address1"), |
534 ASCIIToUTF16("address2"), | 534 ASCIIToUTF16("address2"), |
535 ASCIIToUTF16("city"), | 535 ASCIIToUTF16("city"), |
536 ASCIIToUTF16("state"), | 536 ASCIIToUTF16("state"), |
537 ASCIIToUTF16("postal_code"), | 537 ASCIIToUTF16("postal_code"), |
538 ASCIIToUTF16("phone_number"), | 538 ASCIIToUTF16("phone_number"), |
539 std::string())); | 539 std::string())); |
540 std::vector<base::string16> supported_currencies; | 540 std::vector<base::string16> supported_currencies; |
541 supported_currencies.push_back(ASCIIToUTF16("currency")); | 541 supported_currencies.push_back(ASCIIToUTF16("currency")); |
542 scoped_ptr<WalletItems::MaskedInstrument> masked_instrument( | 542 scoped_ptr<WalletItems::MaskedInstrument> masked_instrument( |
543 new WalletItems::MaskedInstrument(ASCIIToUTF16("descriptive_name"), | 543 new WalletItems::MaskedInstrument(ASCIIToUTF16("descriptive_name"), |
544 WalletItems::MaskedInstrument::VISA, | 544 WalletItems::MaskedInstrument::VISA, |
545 supported_currencies, | 545 supported_currencies, |
546 ASCIIToUTF16("last_four_digits"), | 546 ASCIIToUTF16("last_four_digits"), |
547 12, | 547 12, |
548 2012, | 548 2012, |
549 billing_address.Pass(), | 549 billing_address.Pass(), |
550 WalletItems::MaskedInstrument::VALID, | 550 WalletItems::MaskedInstrument::VALID, |
551 "object_id")); | 551 "object_id")); |
552 expected.AddInstrument(masked_instrument.Pass()); | 552 expected.AddInstrument(masked_instrument.Pass()); |
553 | 553 |
554 scoped_ptr<Address> shipping_address( | 554 scoped_ptr<Address> shipping_address( |
555 new Address("country_name_code", | 555 new Address("US", |
556 ASCIIToUTF16("recipient_name"), | 556 ASCIIToUTF16("recipient_name"), |
557 ASCIIToUTF16("address_line_1"), | 557 ASCIIToUTF16("address_line_1"), |
558 ASCIIToUTF16("address_line_2"), | 558 ASCIIToUTF16("address_line_2"), |
559 ASCIIToUTF16("locality_name"), | 559 ASCIIToUTF16("locality_name"), |
560 ASCIIToUTF16("administrative_area_name"), | 560 ASCIIToUTF16("administrative_area_name"), |
561 ASCIIToUTF16("postal_code_number"), | 561 ASCIIToUTF16("postal_code_number"), |
562 ASCIIToUTF16("phone_number"), | 562 ASCIIToUTF16("phone_number"), |
563 "id")); | 563 "id")); |
564 expected.AddAddress(shipping_address.Pass()); | 564 expected.AddAddress(shipping_address.Pass()); |
565 EXPECT_EQ(expected, *WalletItems::CreateWalletItems(*dict)); | 565 EXPECT_EQ(expected, *WalletItems::CreateWalletItems(*dict)); |
566 | 566 |
567 // Now try with a legal document as well. | 567 // Now try with a legal document as well. |
568 SetUpDictionary(std::string(kWalletItems) + | 568 SetUpDictionary(std::string(kWalletItems) + |
569 std::string(kRequiredLegalDocument) + | 569 std::string(kRequiredLegalDocument) + |
570 std::string(kCloseJson)); | 570 std::string(kCloseJson)); |
571 scoped_ptr<WalletItems::LegalDocument> legal_document( | 571 scoped_ptr<WalletItems::LegalDocument> legal_document( |
572 new WalletItems::LegalDocument("doc_id", | 572 new WalletItems::LegalDocument("doc_id", |
573 ASCIIToUTF16("display_name"))); | 573 ASCIIToUTF16("display_name"))); |
574 expected.AddLegalDocument(legal_document.Pass()); | 574 expected.AddLegalDocument(legal_document.Pass()); |
575 expected.AddLegalDocument( | 575 expected.AddLegalDocument( |
576 WalletItems::LegalDocument::CreatePrivacyPolicyDocument()); | 576 WalletItems::LegalDocument::CreatePrivacyPolicyDocument()); |
577 | 577 |
578 EXPECT_EQ(expected, *WalletItems::CreateWalletItems(*dict)); | 578 EXPECT_EQ(expected, *WalletItems::CreateWalletItems(*dict)); |
579 } | 579 } |
580 | 580 |
581 } // namespace wallet | 581 } // namespace wallet |
582 } // namespace autofill | 582 } // namespace autofill |
OLD | NEW |