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 "components/autofill/core/browser/autofill_test_utils.h" | 5 #include "components/autofill/core/browser/autofill_test_utils.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 } | 318 } |
319 | 319 |
320 void SetServerCreditCards(AutofillTable* table, | 320 void SetServerCreditCards(AutofillTable* table, |
321 const std::vector<CreditCard>& cards) { | 321 const std::vector<CreditCard>& cards) { |
322 std::vector<CreditCard> as_masked_cards = cards; | 322 std::vector<CreditCard> as_masked_cards = cards; |
323 for (CreditCard& card : as_masked_cards) { | 323 for (CreditCard& card : as_masked_cards) { |
324 card.set_record_type(CreditCard::MASKED_SERVER_CARD); | 324 card.set_record_type(CreditCard::MASKED_SERVER_CARD); |
325 std::string type = card.type(); | 325 std::string type = card.type(); |
326 card.SetNumber(card.LastFourDigits()); | 326 card.SetNumber(card.LastFourDigits()); |
327 card.SetTypeForMaskedCard(type.c_str()); | 327 card.SetTypeForMaskedCard(type.c_str()); |
| 328 table->UpdateServerCardMetadata(card); |
328 } | 329 } |
329 table->SetServerCreditCards(as_masked_cards); | 330 table->SetServerCreditCards(as_masked_cards); |
330 | 331 |
331 for (const CreditCard& card : cards) { | 332 for (const CreditCard& card : cards) { |
332 if (card.record_type() != CreditCard::FULL_SERVER_CARD) | 333 if (card.record_type() != CreditCard::FULL_SERVER_CARD) |
333 continue; | 334 continue; |
334 | 335 |
335 table->UnmaskServerCreditCard(card, card.number()); | 336 table->UnmaskServerCreditCard(card, card.number()); |
336 } | 337 } |
337 } | 338 } |
(...skipping 20 matching lines...) Expand all Loading... |
358 const char* control_type) { | 359 const char* control_type) { |
359 field->set_signature(signature); | 360 field->set_signature(signature); |
360 if (name) | 361 if (name) |
361 field->set_name(name); | 362 field->set_name(name); |
362 if (control_type) | 363 if (control_type) |
363 field->set_type(control_type); | 364 field->set_type(control_type); |
364 } | 365 } |
365 | 366 |
366 } // namespace test | 367 } // namespace test |
367 } // namespace autofill | 368 } // namespace autofill |
OLD | NEW |