Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: components/autofill/core/browser/webdata/autofill_table_unittest.cc

Issue 969103003: Don't save duplicates of wallet addresses to local Autofill. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make test work Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 5 #include <utility>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 EXPECT_EQ(ASCIIToUTF16("1111"), outputs[0]->GetRawInfo(CREDIT_CARD_NUMBER)); 1761 EXPECT_EQ(ASCIIToUTF16("1111"), outputs[0]->GetRawInfo(CREDIT_CARD_NUMBER));
1762 1762
1763 STLDeleteContainerPointers(outputs.begin(), outputs.end()); 1763 STLDeleteContainerPointers(outputs.begin(), outputs.end());
1764 outputs.clear(); 1764 outputs.clear();
1765 } 1765 }
1766 1766
1767 TEST_F(AutofillTableTest, SetServerProfile) { 1767 TEST_F(AutofillTableTest, SetServerProfile) {
1768 AutofillProfile one(AutofillProfile::SERVER_PROFILE, "a123"); 1768 AutofillProfile one(AutofillProfile::SERVER_PROFILE, "a123");
1769 std::vector<AutofillProfile> inputs; 1769 std::vector<AutofillProfile> inputs;
1770 inputs.push_back(one); 1770 inputs.push_back(one);
1771 table_->SetAutofillServerProfiles(inputs); 1771 table_->SetServerProfiles(inputs);
1772 1772
1773 std::vector<AutofillProfile*> outputs; 1773 std::vector<AutofillProfile*> outputs;
1774 table_->GetAutofillServerProfiles(&outputs); 1774 table_->GetServerProfiles(&outputs);
1775 ASSERT_EQ(1u, outputs.size()); 1775 ASSERT_EQ(1u, outputs.size());
1776 EXPECT_EQ(one.server_id(), outputs[0]->server_id()); 1776 EXPECT_EQ(one.server_id(), outputs[0]->server_id());
1777 1777
1778 STLDeleteContainerPointers(outputs.begin(), outputs.end()); 1778 STLDeleteContainerPointers(outputs.begin(), outputs.end());
1779 outputs.clear(); 1779 outputs.clear();
1780 1780
1781 // Set a different profile. 1781 // Set a different profile.
1782 AutofillProfile two(AutofillProfile::SERVER_PROFILE, "b456"); 1782 AutofillProfile two(AutofillProfile::SERVER_PROFILE, "b456");
1783 inputs[0] = two; 1783 inputs[0] = two;
1784 table_->SetAutofillServerProfiles(inputs); 1784 table_->SetServerProfiles(inputs);
1785 1785
1786 // The original one should have been replaced. 1786 // The original one should have been replaced.
1787 table_->GetAutofillServerProfiles(&outputs); 1787 table_->GetServerProfiles(&outputs);
1788 ASSERT_EQ(1u, outputs.size()); 1788 ASSERT_EQ(1u, outputs.size());
1789 EXPECT_EQ(two.server_id(), outputs[0]->server_id()); 1789 EXPECT_EQ(two.server_id(), outputs[0]->server_id());
1790 1790
1791 STLDeleteContainerPointers(outputs.begin(), outputs.end()); 1791 STLDeleteContainerPointers(outputs.begin(), outputs.end());
1792 outputs.clear(); 1792 outputs.clear();
1793 } 1793 }
1794 1794
1795 } // namespace autofill 1795 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698