| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 using base::WaitableEvent; | 65 using base::WaitableEvent; |
| 66 using browser_sync::AutofillDataTypeController; | 66 using browser_sync::AutofillDataTypeController; |
| 67 using browser_sync::AutofillProfileDataTypeController; | 67 using browser_sync::AutofillProfileDataTypeController; |
| 68 using browser_sync::DataTypeController; | 68 using browser_sync::DataTypeController; |
| 69 using browser_sync::GenericChangeProcessor; | 69 using browser_sync::GenericChangeProcessor; |
| 70 using browser_sync::SharedChangeProcessor; | 70 using browser_sync::SharedChangeProcessor; |
| 71 using content::BrowserThread; | 71 using content::BrowserThread; |
| 72 using syncer::AUTOFILL; | 72 using syncer::AUTOFILL; |
| 73 using syncer::BaseNode; | 73 using syncer::BaseNode; |
| 74 using syncer::syncable::BASE_VERSION; | 74 using syncer::syncable::BASE_VERSION; |
| 75 using syncer::syncable::CREATE; | 75 using syncer::syncable::CREATE_UNIQUE; |
| 76 using syncer::syncable::GET_BY_SERVER_TAG; | 76 using syncer::syncable::GET_BY_SERVER_TAG; |
| 77 using syncer::syncable::MutableEntry; | 77 using syncer::syncable::MutableEntry; |
| 78 using syncer::syncable::SERVER_SPECIFICS; | 78 using syncer::syncable::SERVER_SPECIFICS; |
| 79 using syncer::syncable::SPECIFICS; | 79 using syncer::syncable::SPECIFICS; |
| 80 using syncer::syncable::UNITTEST; | 80 using syncer::syncable::UNITTEST; |
| 81 using syncer::syncable::WriterTag; | 81 using syncer::syncable::WriterTag; |
| 82 using syncer::syncable::WriteTransaction; | 82 using syncer::syncable::WriteTransaction; |
| 83 using testing::_; | 83 using testing::_; |
| 84 using testing::DoAll; | 84 using testing::DoAll; |
| 85 using testing::ElementsAre; | 85 using testing::ElementsAre; |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 (*wait_for_start_)->Signal(); | 734 (*wait_for_start_)->Signal(); |
| 735 | 735 |
| 736 // Create write transaction. | 736 // Create write transaction. |
| 737 WriteTransactionTest trans(FROM_HERE, UNITTEST, directory, | 737 WriteTransactionTest trans(FROM_HERE, UNITTEST, directory, |
| 738 wait_for_syncapi_); | 738 wait_for_syncapi_); |
| 739 | 739 |
| 740 // Create actual entry based on autofill protobuf information. | 740 // Create actual entry based on autofill protobuf information. |
| 741 // Simulates effects of UpdateLocalDataFromServerData | 741 // Simulates effects of UpdateLocalDataFromServerData |
| 742 MutableEntry parent(&trans, GET_BY_SERVER_TAG, | 742 MutableEntry parent(&trans, GET_BY_SERVER_TAG, |
| 743 syncer::ModelTypeToRootTag(syncer::AUTOFILL)); | 743 syncer::ModelTypeToRootTag(syncer::AUTOFILL)); |
| 744 MutableEntry item(&trans, CREATE, parent.Get(syncer::syncable::ID), tag); | 744 MutableEntry item(&trans, CREATE_UNIQUE, syncer::AUTOFILL, |
| 745 parent.Get(syncer::syncable::ID), tag); |
| 745 ASSERT_TRUE(item.good()); | 746 ASSERT_TRUE(item.good()); |
| 746 item.Put(SPECIFICS, entity_specifics); | 747 item.Put(SPECIFICS, entity_specifics); |
| 747 item.Put(SERVER_SPECIFICS, entity_specifics); | 748 item.Put(SERVER_SPECIFICS, entity_specifics); |
| 748 item.Put(BASE_VERSION, 1); | 749 item.Put(BASE_VERSION, 1); |
| 749 syncer::syncable::Id server_item_id = | 750 syncer::syncable::Id server_item_id = |
| 750 service_->id_factory()->NewServerId(); | 751 service_->id_factory()->NewServerId(); |
| 751 item.Put(syncer::syncable::ID, server_item_id); | 752 item.Put(syncer::syncable::ID, server_item_id); |
| 752 syncer::syncable::Id new_predecessor; | 753 syncer::syncable::Id new_predecessor; |
| 753 ASSERT_TRUE(item.PutPredecessor(new_predecessor)); | 754 ASSERT_TRUE(item.PutPredecessor(new_predecessor)); |
| 754 } | 755 } |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 std::vector<AutofillEntry> sync_entries; | 1297 std::vector<AutofillEntry> sync_entries; |
| 1297 std::vector<AutofillProfile> sync_profiles; | 1298 std::vector<AutofillProfile> sync_profiles; |
| 1298 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); | 1299 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); |
| 1299 EXPECT_EQ(3U, sync_entries.size()); | 1300 EXPECT_EQ(3U, sync_entries.size()); |
| 1300 EXPECT_EQ(0U, sync_profiles.size()); | 1301 EXPECT_EQ(0U, sync_profiles.size()); |
| 1301 for (size_t i = 0; i < sync_entries.size(); i++) { | 1302 for (size_t i = 0; i < sync_entries.size(); i++) { |
| 1302 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() | 1303 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() |
| 1303 << ", " << sync_entries[i].key().value(); | 1304 << ", " << sync_entries[i].key().value(); |
| 1304 } | 1305 } |
| 1305 } | 1306 } |
| OLD | NEW |