| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 using testing::Return; | 87 using testing::Return; |
| 88 | 88 |
| 89 namespace syncable { | 89 namespace syncable { |
| 90 class Id; | 90 class Id; |
| 91 } | 91 } |
| 92 | 92 |
| 93 class HistoryService; | 93 class HistoryService; |
| 94 | 94 |
| 95 class AutofillTableMock : public AutofillTable { | 95 class AutofillTableMock : public AutofillTable { |
| 96 public: | 96 public: |
| 97 AutofillTableMock() : AutofillTable(NULL, NULL) {} | 97 AutofillTableMock() : AutofillTable() {} |
| 98 MOCK_METHOD2(RemoveFormElement, | 98 MOCK_METHOD2(RemoveFormElement, |
| 99 bool(const string16& name, const string16& value)); // NOLINT | 99 bool(const string16& name, const string16& value)); // NOLINT |
| 100 MOCK_METHOD1(GetAllAutofillEntries, | 100 MOCK_METHOD1(GetAllAutofillEntries, |
| 101 bool(std::vector<AutofillEntry>* entries)); // NOLINT | 101 bool(std::vector<AutofillEntry>* entries)); // NOLINT |
| 102 MOCK_METHOD3(GetAutofillTimestamps, | 102 MOCK_METHOD3(GetAutofillTimestamps, |
| 103 bool(const string16& name, // NOLINT | 103 bool(const string16& name, // NOLINT |
| 104 const string16& value, | 104 const string16& value, |
| 105 std::vector<base::Time>* timestamps)); | 105 std::vector<base::Time>* timestamps)); |
| 106 MOCK_METHOD1(UpdateAutofillEntries, | 106 MOCK_METHOD1(UpdateAutofillEntries, |
| 107 bool(const std::vector<AutofillEntry>&)); // NOLINT | 107 bool(const std::vector<AutofillEntry>&)); // NOLINT |
| 108 MOCK_METHOD1(GetAutofillProfiles, | 108 MOCK_METHOD1(GetAutofillProfiles, |
| 109 bool(std::vector<AutofillProfile*>*)); // NOLINT | 109 bool(std::vector<AutofillProfile*>*)); // NOLINT |
| 110 MOCK_METHOD1(UpdateAutofillProfileMulti, | 110 MOCK_METHOD1(UpdateAutofillProfileMulti, |
| 111 bool(const AutofillProfile&)); // NOLINT | 111 bool(const AutofillProfile&)); // NOLINT |
| 112 MOCK_METHOD1(AddAutofillProfile, | 112 MOCK_METHOD1(AddAutofillProfile, |
| 113 bool(const AutofillProfile&)); // NOLINT | 113 bool(const AutofillProfile&)); // NOLINT |
| 114 MOCK_METHOD1(RemoveAutofillProfile, | 114 MOCK_METHOD1(RemoveAutofillProfile, |
| 115 bool(const std::string&)); // NOLINT | 115 bool(const std::string&)); // NOLINT |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 MATCHER_P(MatchProfiles, profile, "") { | 118 MATCHER_P(MatchProfiles, profile, "") { |
| 119 return (profile.Compare(arg) == 0); | 119 return (profile.Compare(arg) == 0); |
| 120 } | 120 } |
| 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 |