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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "sync/internal_api/public/write_transaction.h" | 56 #include "sync/internal_api/public/write_transaction.h" |
57 #include "sync/protocol/autofill_specifics.pb.h" | 57 #include "sync/protocol/autofill_specifics.pb.h" |
58 #include "sync/syncable/mutable_entry.h" | 58 #include "sync/syncable/mutable_entry.h" |
59 #include "sync/syncable/syncable_write_transaction.h" | 59 #include "sync/syncable/syncable_write_transaction.h" |
60 #include "sync/test/engine/test_id_factory.h" | 60 #include "sync/test/engine/test_id_factory.h" |
61 #include "testing/gmock/include/gmock/gmock.h" | 61 #include "testing/gmock/include/gmock/gmock.h" |
62 | 62 |
63 using autofill::AutofillChange; | 63 using autofill::AutofillChange; |
64 using autofill::AutofillChangeList; | 64 using autofill::AutofillChangeList; |
65 using autofill::AutofillEntry; | 65 using autofill::AutofillEntry; |
66 using autofill::AutofillFieldType; | 66 using autofill::ServerFieldType; |
67 using autofill::AutofillKey; | 67 using autofill::AutofillKey; |
68 using autofill::AutofillProfile; | 68 using autofill::AutofillProfile; |
69 using autofill::AutofillProfileChange; | 69 using autofill::AutofillProfileChange; |
70 using autofill::AutofillTable; | 70 using autofill::AutofillTable; |
71 using autofill::AutofillWebDataService; | 71 using autofill::AutofillWebDataService; |
72 using autofill::PersonalDataManager; | 72 using autofill::PersonalDataManager; |
73 using base::Time; | 73 using base::Time; |
74 using base::TimeDelta; | 74 using base::TimeDelta; |
75 using base::WaitableEvent; | 75 using base::WaitableEvent; |
76 using browser_sync::AutofillDataTypeController; | 76 using browser_sync::AutofillDataTypeController; |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 WaitableEvent is_finished_; | 916 WaitableEvent is_finished_; |
917 syncer::syncable::Id parent_id_; | 917 syncer::syncable::Id parent_id_; |
918 }; | 918 }; |
919 | 919 |
920 namespace { | 920 namespace { |
921 | 921 |
922 // Checks if the field of type |field_type| in |profile1| includes all values | 922 // Checks if the field of type |field_type| in |profile1| includes all values |
923 // of the field in |profile2|. | 923 // of the field in |profile2|. |
924 bool IncludesField(const AutofillProfile& profile1, | 924 bool IncludesField(const AutofillProfile& profile1, |
925 const AutofillProfile& profile2, | 925 const AutofillProfile& profile2, |
926 AutofillFieldType field_type) { | 926 ServerFieldType field_type) { |
927 std::vector<string16> values1; | 927 std::vector<string16> values1; |
928 profile1.GetRawMultiInfo(field_type, &values1); | 928 profile1.GetRawMultiInfo(field_type, &values1); |
929 std::vector<string16> values2; | 929 std::vector<string16> values2; |
930 profile2.GetRawMultiInfo(field_type, &values2); | 930 profile2.GetRawMultiInfo(field_type, &values2); |
931 | 931 |
932 std::set<string16> values_set; | 932 std::set<string16> values_set; |
933 for (size_t i = 0; i < values1.size(); ++i) | 933 for (size_t i = 0; i < values1.size(); ++i) |
934 values_set.insert(values1[i]); | 934 values_set.insert(values1[i]); |
935 for (size_t i = 0; i < values2.size(); ++i) | 935 for (size_t i = 0; i < values2.size(); ++i) |
936 if (values_set.find(values2[i]) == values_set.end()) | 936 if (values_set.find(values2[i]) == values_set.end()) |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1405 std::vector<AutofillEntry> sync_entries; | 1405 std::vector<AutofillEntry> sync_entries; |
1406 std::vector<AutofillProfile> sync_profiles; | 1406 std::vector<AutofillProfile> sync_profiles; |
1407 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); | 1407 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); |
1408 EXPECT_EQ(3U, sync_entries.size()); | 1408 EXPECT_EQ(3U, sync_entries.size()); |
1409 EXPECT_EQ(0U, sync_profiles.size()); | 1409 EXPECT_EQ(0U, sync_profiles.size()); |
1410 for (size_t i = 0; i < sync_entries.size(); i++) { | 1410 for (size_t i = 0; i < sync_entries.size(); i++) { |
1411 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() | 1411 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() |
1412 << ", " << sync_entries[i].key().value(); | 1412 << ", " << sync_entries[i].key().value(); |
1413 } | 1413 } |
1414 } | 1414 } |
OLD | NEW |