| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 using testing::Return; | 88 using testing::Return; |
| 89 | 89 |
| 90 namespace syncable { | 90 namespace syncable { |
| 91 class Id; | 91 class Id; |
| 92 } | 92 } |
| 93 | 93 |
| 94 class HistoryService; | 94 class HistoryService; |
| 95 | 95 |
| 96 class AutofillTableMock : public AutofillTable { | 96 class AutofillTableMock : public AutofillTable { |
| 97 public: | 97 public: |
| 98 AutofillTableMock() : AutofillTable(NULL, NULL) {} | 98 AutofillTableMock() : AutofillTable() {} |
| 99 MOCK_METHOD2(RemoveFormElement, | 99 MOCK_METHOD2(RemoveFormElement, |
| 100 bool(const string16& name, const string16& value)); // NOLINT | 100 bool(const string16& name, const string16& value)); // NOLINT |
| 101 MOCK_METHOD1(GetAllAutofillEntries, | 101 MOCK_METHOD1(GetAllAutofillEntries, |
| 102 bool(std::vector<AutofillEntry>* entries)); // NOLINT | 102 bool(std::vector<AutofillEntry>* entries)); // NOLINT |
| 103 MOCK_METHOD3(GetAutofillTimestamps, | 103 MOCK_METHOD3(GetAutofillTimestamps, |
| 104 bool(const string16& name, // NOLINT | 104 bool(const string16& name, // NOLINT |
| 105 const string16& value, | 105 const string16& value, |
| 106 std::vector<base::Time>* timestamps)); | 106 std::vector<base::Time>* timestamps)); |
| 107 MOCK_METHOD1(UpdateAutofillEntries, | 107 MOCK_METHOD1(UpdateAutofillEntries, |
| 108 bool(const std::vector<AutofillEntry>&)); // NOLINT | 108 bool(const std::vector<AutofillEntry>&)); // NOLINT |
| 109 MOCK_METHOD1(GetAutofillProfiles, | 109 MOCK_METHOD1(GetAutofillProfiles, |
| 110 bool(std::vector<AutofillProfile*>*)); // NOLINT | 110 bool(std::vector<AutofillProfile*>*)); // NOLINT |
| 111 MOCK_METHOD1(UpdateAutofillProfileMulti, | 111 MOCK_METHOD1(UpdateAutofillProfileMulti, |
| 112 bool(const AutofillProfile&)); // NOLINT | 112 bool(const AutofillProfile&)); // NOLINT |
| 113 MOCK_METHOD1(AddAutofillProfile, | 113 MOCK_METHOD1(AddAutofillProfile, |
| 114 bool(const AutofillProfile&)); // NOLINT | 114 bool(const AutofillProfile&)); // NOLINT |
| 115 MOCK_METHOD1(RemoveAutofillProfile, | 115 MOCK_METHOD1(RemoveAutofillProfile, |
| 116 bool(const std::string&)); // NOLINT | 116 bool(const std::string&)); // NOLINT |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 MATCHER_P(MatchProfiles, profile, "") { | 119 MATCHER_P(MatchProfiles, profile, "") { |
| 120 return (profile.Compare(arg) == 0); | 120 return (profile.Compare(arg) == 0); |
| 121 } | 121 } |
| 122 | 122 |
| 123 class WebDatabaseFake : public WebDatabase { | 123 class WebDatabaseFake : public WebDatabase { |
| 124 public: | 124 public: |
| 125 explicit WebDatabaseFake(AutofillTable* autofill_table) | 125 explicit WebDatabaseFake(AutofillTable* autofill_table) { |
| 126 : autofill_table_(autofill_table) {} | 126 AddTable(autofill_table); |
| 127 | |
| 128 virtual AutofillTable* GetAutofillTable() OVERRIDE { | |
| 129 return autofill_table_; | |
| 130 } | 127 } |
| 131 | |
| 132 private: | |
| 133 AutofillTable* autofill_table_; | |
| 134 }; | 128 }; |
| 135 | 129 |
| 136 class ProfileSyncServiceAutofillTest; | 130 class ProfileSyncServiceAutofillTest; |
| 137 | 131 |
| 138 template<class AutofillProfile> | 132 template<class AutofillProfile> |
| 139 syncer::ModelType GetModelType() { | 133 syncer::ModelType GetModelType() { |
| 140 return syncer::UNSPECIFIED; | 134 return syncer::UNSPECIFIED; |
| 141 } | 135 } |
| 142 | 136 |
| 143 template<> | 137 template<> |
| (...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 std::vector<AutofillEntry> sync_entries; | 1313 std::vector<AutofillEntry> sync_entries; |
| 1320 std::vector<AutofillProfile> sync_profiles; | 1314 std::vector<AutofillProfile> sync_profiles; |
| 1321 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); | 1315 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); |
| 1322 EXPECT_EQ(3U, sync_entries.size()); | 1316 EXPECT_EQ(3U, sync_entries.size()); |
| 1323 EXPECT_EQ(0U, sync_profiles.size()); | 1317 EXPECT_EQ(0U, sync_profiles.size()); |
| 1324 for (size_t i = 0; i < sync_entries.size(); i++) { | 1318 for (size_t i = 0; i < sync_entries.size(); i++) { |
| 1325 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() | 1319 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() |
| 1326 << ", " << sync_entries[i].key().value(); | 1320 << ", " << sync_entries[i].key().value(); |
| 1327 } | 1321 } |
| 1328 } | 1322 } |
| OLD | NEW |