| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "chrome/browser/sync/engine/apply_updates_command.h" | 10 #include "chrome/browser/sync/engine/apply_updates_command.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // Returns the methandle of the created item in |metahandle_out| if not NULL. | 106 // Returns the methandle of the created item in |metahandle_out| if not NULL. |
| 107 void CreateUnsyncedItem(const Id& item_id, | 107 void CreateUnsyncedItem(const Id& item_id, |
| 108 const Id& parent_id, | 108 const Id& parent_id, |
| 109 const string& name, | 109 const string& name, |
| 110 bool is_folder, | 110 bool is_folder, |
| 111 syncable::ModelType model_type, | 111 syncable::ModelType model_type, |
| 112 int64* metahandle_out) { | 112 int64* metahandle_out) { |
| 113 ScopedDirLookup dir(syncdb()->manager(), syncdb()->name()); | 113 ScopedDirLookup dir(syncdb()->manager(), syncdb()->name()); |
| 114 ASSERT_TRUE(dir.good()); | 114 ASSERT_TRUE(dir.good()); |
| 115 WriteTransaction trans(FROM_HERE, UNITTEST, dir); | 115 WriteTransaction trans(FROM_HERE, UNITTEST, dir); |
| 116 Id predecessor_id = dir->GetLastChildId(&trans, parent_id); | 116 Id predecessor_id; |
| 117 ASSERT_TRUE( |
| 118 dir->GetLastChildIdForTest(&trans, parent_id, &predecessor_id)); |
| 117 MutableEntry entry(&trans, syncable::CREATE, parent_id, name); | 119 MutableEntry entry(&trans, syncable::CREATE, parent_id, name); |
| 118 ASSERT_TRUE(entry.good()); | 120 ASSERT_TRUE(entry.good()); |
| 119 entry.Put(syncable::ID, item_id); | 121 entry.Put(syncable::ID, item_id); |
| 120 entry.Put(syncable::BASE_VERSION, | 122 entry.Put(syncable::BASE_VERSION, |
| 121 item_id.ServerKnows() ? next_revision_++ : 0); | 123 item_id.ServerKnows() ? next_revision_++ : 0); |
| 122 entry.Put(syncable::IS_UNSYNCED, true); | 124 entry.Put(syncable::IS_UNSYNCED, true); |
| 123 entry.Put(syncable::IS_DIR, is_folder); | 125 entry.Put(syncable::IS_DIR, is_folder); |
| 124 entry.Put(syncable::IS_DEL, false); | 126 entry.Put(syncable::IS_DEL, false); |
| 125 entry.Put(syncable::PARENT_ID, parent_id); | 127 entry.Put(syncable::PARENT_ID, parent_id); |
| 126 CHECK(entry.PutPredecessor(predecessor_id)); | 128 CHECK(entry.PutPredecessor(predecessor_id)); |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 encrypted_types.insert(syncable::BOOKMARKS); | 678 encrypted_types.insert(syncable::BOOKMARKS); |
| 677 EXPECT_EQ(GetAllRealModelTypes(), cryptographer->GetEncryptedTypes()); | 679 EXPECT_EQ(GetAllRealModelTypes(), cryptographer->GetEncryptedTypes()); |
| 678 | 680 |
| 679 Syncer::UnsyncedMetaHandles handles; | 681 Syncer::UnsyncedMetaHandles handles; |
| 680 SyncerUtil::GetUnsyncedEntries(&trans, &handles); | 682 SyncerUtil::GetUnsyncedEntries(&trans, &handles); |
| 681 EXPECT_EQ(2*batch_s+1, handles.size()); | 683 EXPECT_EQ(2*batch_s+1, handles.size()); |
| 682 } | 684 } |
| 683 } | 685 } |
| 684 | 686 |
| 685 } // namespace browser_sync | 687 } // namespace browser_sync |
| OLD | NEW |