summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/sync_manager_impl_unittest.cc
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-13 20:26:31 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-13 20:26:31 +0000
commit65824a157879e0ec148964e8194b86ce1b60c1c0 (patch)
treef1c6b6b6e47cfe35915eefd4f5b175b00a5d6843 /sync/internal_api/sync_manager_impl_unittest.cc
parent68bddb4f0ee93b59868b19a31827148dbb6403ab (diff)
downloadchromium_src-65824a157879e0ec148964e8194b86ce1b60c1c0.zip
chromium_src-65824a157879e0ec148964e8194b86ce1b60c1c0.tar.gz
chromium_src-65824a157879e0ec148964e8194b86ce1b60c1c0.tar.bz2
sync: Add getters and setters to Entry classes
Replace the Entry and MutableEntry classes' Get(X) and Put(X, V) members with GetX() and PutX(V) style members. There are many good reasons for performing this refactor. The main reason to implement it now is that we'd like to have more fine-grained control over the visibility of the getters and setters for certain fields, and it's really hard to implement that control when several different fields use the same accessor functions. Once this refactor is complete, we can modify the inheritance hierarchy for Entry and MutableEntry to introduce a new, semi-MutableEntry that provides only the setters whose changes are not "visible" to the underlying model. We can also build on this work to simplify the implementation of MutableEntry. The interface changes are the most notable part of this CL, but there are a few smaller changes here too, including: - Some small formatting cleanups. - In cases where Put() functions had signatures that returned bool but never returned anything other than 'true', those return values have been changed to void. - Some dead code in syncer_proto_util.cc has been removed. BUG=284672 Review URL: https://chromiumcodereview.appspot.com/23484035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/sync_manager_impl_unittest.cc')
-rw-r--r--sync/internal_api/sync_manager_impl_unittest.cc262
1 files changed, 131 insertions, 131 deletions
diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/sync/internal_api/sync_manager_impl_unittest.cc
index ff03890..614a914 100644
--- a/sync/internal_api/sync_manager_impl_unittest.cc
+++ b/sync/internal_api/sync_manager_impl_unittest.cc
@@ -172,18 +172,18 @@ int64 MakeServerNodeForType(UserShare* share,
syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM,
node_id);
EXPECT_TRUE(entry.good());
- entry.Put(syncable::BASE_VERSION, 1);
- entry.Put(syncable::SERVER_VERSION, 1);
- entry.Put(syncable::IS_UNAPPLIED_UPDATE, false);
- entry.Put(syncable::SERVER_PARENT_ID, syncable::GetNullId());
- entry.Put(syncable::SERVER_IS_DIR, true);
- entry.Put(syncable::IS_DIR, true);
- entry.Put(syncable::SERVER_SPECIFICS, specifics);
- entry.Put(syncable::UNIQUE_SERVER_TAG, type_tag);
- entry.Put(syncable::NON_UNIQUE_NAME, type_tag);
- entry.Put(syncable::IS_DEL, false);
- entry.Put(syncable::SPECIFICS, specifics);
- return entry.Get(syncable::META_HANDLE);
+ entry.PutBaseVersion(1);
+ entry.PutServerVersion(1);
+ entry.PutIsUnappliedUpdate(false);
+ entry.PutServerParentId(syncable::GetNullId());
+ entry.PutServerIsDir(true);
+ entry.PutIsDir(true);
+ entry.PutServerSpecifics(specifics);
+ entry.PutUniqueServerTag(type_tag);
+ entry.PutNonUniqueName(type_tag);
+ entry.PutIsDel(false);
+ entry.PutSpecifics(specifics);
+ return entry.GetMetahandle();
}
// Simulates creating a "synced" node as a child of the root datatype node.
@@ -196,24 +196,24 @@ int64 MakeServerNode(UserShare* share, ModelType model_type,
syncable::Entry root_entry(&trans, syncable::GET_BY_SERVER_TAG,
ModelTypeToRootTag(model_type));
EXPECT_TRUE(root_entry.good());
- syncable::Id root_id = root_entry.Get(syncable::ID);
+ syncable::Id root_id = root_entry.GetId();
syncable::Id node_id = syncable::Id::CreateFromServerId(client_tag);
syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM,
node_id);
EXPECT_TRUE(entry.good());
- entry.Put(syncable::BASE_VERSION, 1);
- entry.Put(syncable::SERVER_VERSION, 1);
- entry.Put(syncable::IS_UNAPPLIED_UPDATE, false);
- entry.Put(syncable::SERVER_PARENT_ID, root_id);
- entry.Put(syncable::PARENT_ID, root_id);
- entry.Put(syncable::SERVER_IS_DIR, false);
- entry.Put(syncable::IS_DIR, false);
- entry.Put(syncable::SERVER_SPECIFICS, specifics);
- entry.Put(syncable::NON_UNIQUE_NAME, client_tag);
- entry.Put(syncable::UNIQUE_CLIENT_TAG, hashed_tag);
- entry.Put(syncable::IS_DEL, false);
- entry.Put(syncable::SPECIFICS, specifics);
- return entry.Get(syncable::META_HANDLE);
+ entry.PutBaseVersion(1);
+ entry.PutServerVersion(1);
+ entry.PutIsUnappliedUpdate(false);
+ entry.PutServerParentId(root_id);
+ entry.PutParentId(root_id);
+ entry.PutServerIsDir(false);
+ entry.PutIsDir(false);
+ entry.PutServerSpecifics(specifics);
+ entry.PutNonUniqueName(client_tag);
+ entry.PutUniqueClientTag(hashed_tag);
+ entry.PutIsDel(false);
+ entry.PutSpecifics(specifics);
+ return entry.GetMetahandle();
}
} // namespace
@@ -480,7 +480,7 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) {
ASSERT_EQ(BaseNode::INIT_OK, bookmark_node.InitByIdLookup(bookmark_id));
EXPECT_EQ("foo", bookmark_node.GetTitle());
EXPECT_EQ(kEncryptedString,
- bookmark_node.GetEntry()->Get(syncable::NON_UNIQUE_NAME));
+ bookmark_node.GetEntry()->GetNonUniqueName());
ReadNode pref_node(&trans);
ASSERT_EQ(BaseNode::INIT_OK,
@@ -948,9 +948,9 @@ class SyncManagerTest : public testing::Test,
syncable::MutableEntry entry(&trans, syncable::GET_BY_CLIENT_TAG,
hash);
EXPECT_TRUE(entry.good());
- if (!entry.Get(IS_UNSYNCED))
+ if (!entry.GetIsUnsynced())
return false;
- entry.Put(IS_UNSYNCED, false);
+ entry.PutIsUnsynced(false);
return true;
}
@@ -2025,7 +2025,7 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) {
// Set the old style title.
syncable::MutableEntry* node_entry = node.entry_;
- node_entry->Put(syncable::NON_UNIQUE_NAME, title);
+ node_entry->PutNonUniqueName(title);
WriteNode node2(&trans);
EXPECT_EQ(BaseNode::INIT_OK, node2.InitByIdLookup(node_id2));
@@ -2036,7 +2036,7 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) {
// Set the old style title.
syncable::MutableEntry* node_entry2 = node2.entry_;
- node_entry2->Put(syncable::NON_UNIQUE_NAME, title2);
+ node_entry2->PutNonUniqueName(title2);
}
{
@@ -2175,9 +2175,9 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
EXPECT_EQ(BaseNode::INIT_OK,
node.InitByClientTagLookup(BOOKMARKS, client_tag));
const syncable::Entry* node_entry = node.GetEntry();
- const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
+ const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics();
EXPECT_TRUE(specifics.has_encrypted());
- EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
+ EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
Cryptographer* cryptographer = trans.GetCryptographer();
EXPECT_TRUE(cryptographer->is_ready());
EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
@@ -2203,9 +2203,9 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
EXPECT_EQ(BaseNode::INIT_OK,
node.InitByClientTagLookup(BOOKMARKS, client_tag));
const syncable::Entry* node_entry = node.GetEntry();
- const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
+ const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics();
EXPECT_TRUE(specifics.has_encrypted());
- EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
+ EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
Cryptographer* cryptographer = trans.GetCryptographer();
EXPECT_TRUE(cryptographer->is_ready());
EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
@@ -2228,9 +2228,9 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
EXPECT_EQ(BaseNode::INIT_OK,
node.InitByClientTagLookup(BOOKMARKS, client_tag));
const syncable::Entry* node_entry = node.GetEntry();
- const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
+ const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics();
EXPECT_TRUE(specifics.has_encrypted());
- EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
+ EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
Cryptographer* cryptographer = trans.GetCryptographer();
EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
specifics.encrypted()));
@@ -2245,10 +2245,10 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
node.InitByClientTagLookup(BOOKMARKS, client_tag));
node.SetEntitySpecifics(entity_specifics);
const syncable::Entry* node_entry = node.GetEntry();
- const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
+ const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics();
EXPECT_TRUE(specifics.has_encrypted());
- EXPECT_FALSE(node_entry->Get(IS_UNSYNCED));
- EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
+ EXPECT_FALSE(node_entry->GetIsUnsynced());
+ EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
Cryptographer* cryptographer = trans.GetCryptographer();
EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
specifics.encrypted()));
@@ -2265,10 +2265,10 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
node.InitByClientTagLookup(BOOKMARKS, client_tag));
node.SetEntitySpecifics(entity_specifics);
const syncable::Entry* node_entry = node.GetEntry();
- const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
+ const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics();
EXPECT_TRUE(specifics.has_encrypted());
- EXPECT_TRUE(node_entry->Get(IS_UNSYNCED));
- EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
+ EXPECT_TRUE(node_entry->GetIsUnsynced());
+ EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
Cryptographer* cryptographer = trans.GetCryptographer();
EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
specifics.encrypted()));
@@ -2358,7 +2358,7 @@ TEST_F(SyncManagerTest, UpdatePasswordSetPasswordSpecifics) {
entity_specifics.mutable_password()->mutable_encrypted());
node.SetPasswordSpecifics(data);
const syncable::Entry* node_entry = node.GetEntry();
- EXPECT_TRUE(node_entry->Get(IS_UNSYNCED));
+ EXPECT_TRUE(node_entry->GetIsUnsynced());
}
}
@@ -2504,9 +2504,9 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) {
node.InitByClientTagLookup(BOOKMARKS, client_tag));
node.SetTitle(UTF8ToWide(client_tag));
const syncable::Entry* node_entry = node.GetEntry();
- const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
+ const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics();
EXPECT_TRUE(specifics.has_encrypted());
- EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
+ EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
}
EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
@@ -2519,9 +2519,9 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) {
node.InitByClientTagLookup(BOOKMARKS, client_tag));
node.SetTitle(UTF8ToWide("title2"));
const syncable::Entry* node_entry = node.GetEntry();
- const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
+ const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics();
EXPECT_TRUE(specifics.has_encrypted());
- EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
+ EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
}
EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
}
@@ -2601,9 +2601,9 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) {
node.InitByClientTagLookup(PREFERENCES, client_tag));
node.SetTitle(UTF8ToWide(client_tag));
const syncable::Entry* node_entry = node.GetEntry();
- const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
+ const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics();
EXPECT_TRUE(specifics.has_encrypted());
- EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
+ EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
}
EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, client_tag));
@@ -2616,10 +2616,10 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) {
node.InitByClientTagLookup(PREFERENCES, client_tag));
node.SetTitle(UTF8ToWide("title2"));
const syncable::Entry* node_entry = node.GetEntry();
- const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
+ const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics();
EXPECT_TRUE(specifics.has_encrypted());
- EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
- EXPECT_FALSE(node_entry->Get(IS_UNSYNCED));
+ EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
+ EXPECT_FALSE(node_entry->GetIsUnsynced());
}
}
@@ -2731,8 +2731,8 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) {
EXPECT_EQ(title, node.GetTitle());
EXPECT_EQ(url2, node.GetBookmarkSpecifics().url());
const syncable::Entry* node_entry = node.GetEntry();
- EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
- const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
+ EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
+ const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics();
EXPECT_TRUE(specifics.has_encrypted());
}
}
@@ -3129,18 +3129,18 @@ TEST_F(SyncManagerTest, PurgeUnappliedTypes) {
// Pref's 1 and 2 are already set up properly.
// Locally delete pref 3.
syncable::MutableEntry pref3(&trans, GET_BY_HANDLE, pref3_meta);
- pref3.Put(IS_DEL, true);
- pref3.Put(IS_UNSYNCED, true);
+ pref3.PutIsDel(true);
+ pref3.PutIsUnsynced(true);
// Delete pref 4 at the server.
syncable::MutableEntry pref4(&trans, GET_BY_HANDLE, pref4_meta);
- pref4.Put(syncable::SERVER_IS_DEL, true);
- pref4.Put(syncable::IS_UNAPPLIED_UPDATE, true);
- pref4.Put(syncable::SERVER_VERSION, 2);
+ pref4.PutServerIsDel(true);
+ pref4.PutIsUnappliedUpdate(true);
+ pref4.PutServerVersion(2);
// Pref 5 is an new unapplied update.
syncable::MutableEntry pref5(&trans, GET_BY_HANDLE, pref5_meta);
- pref5.Put(syncable::IS_UNAPPLIED_UPDATE, true);
- pref5.Put(syncable::IS_DEL, true);
- pref5.Put(syncable::BASE_VERSION, -1);
+ pref5.PutIsUnappliedUpdate(true);
+ pref5.PutIsDel(true);
+ pref5.PutBaseVersion(-1);
// Bookmark is already set up properly
}
@@ -3166,59 +3166,59 @@ TEST_F(SyncManagerTest, PurgeUnappliedTypes) {
syncable::Entry pref_node(&trans, GET_BY_HANDLE, pref1_meta);
ASSERT_TRUE(pref_node.good());
EXPECT_TRUE(pref_node.GetKernelCopy().is_dirty());
- EXPECT_FALSE(pref_node.Get(syncable::IS_UNSYNCED));
- EXPECT_TRUE(pref_node.Get(syncable::IS_UNAPPLIED_UPDATE));
- EXPECT_TRUE(pref_node.Get(IS_DEL));
- EXPECT_GT(pref_node.Get(syncable::SERVER_VERSION), 0);
- EXPECT_EQ(pref_node.Get(syncable::BASE_VERSION), -1);
+ EXPECT_FALSE(pref_node.GetIsUnsynced());
+ EXPECT_TRUE(pref_node.GetIsUnappliedUpdate());
+ EXPECT_TRUE(pref_node.GetIsDel());
+ EXPECT_GT(pref_node.GetServerVersion(), 0);
+ EXPECT_EQ(pref_node.GetBaseVersion(), -1);
// Pref 2 should just be locally deleted.
syncable::Entry pref2_node(&trans, GET_BY_HANDLE, pref2_meta);
ASSERT_TRUE(pref2_node.good());
EXPECT_TRUE(pref2_node.GetKernelCopy().is_dirty());
- EXPECT_FALSE(pref2_node.Get(syncable::IS_UNSYNCED));
- EXPECT_TRUE(pref2_node.Get(syncable::IS_DEL));
- EXPECT_FALSE(pref2_node.Get(syncable::IS_UNAPPLIED_UPDATE));
- EXPECT_TRUE(pref2_node.Get(IS_DEL));
- EXPECT_EQ(pref2_node.Get(syncable::SERVER_VERSION), 0);
- EXPECT_EQ(pref2_node.Get(syncable::BASE_VERSION), -1);
+ EXPECT_FALSE(pref2_node.GetIsUnsynced());
+ EXPECT_TRUE(pref2_node.GetIsDel());
+ EXPECT_FALSE(pref2_node.GetIsUnappliedUpdate());
+ EXPECT_TRUE(pref2_node.GetIsDel());
+ EXPECT_EQ(pref2_node.GetServerVersion(), 0);
+ EXPECT_EQ(pref2_node.GetBaseVersion(), -1);
syncable::Entry pref3_node(&trans, GET_BY_HANDLE, pref3_meta);
ASSERT_TRUE(pref3_node.good());
EXPECT_TRUE(pref3_node.GetKernelCopy().is_dirty());
- EXPECT_FALSE(pref3_node.Get(syncable::IS_UNSYNCED));
- EXPECT_TRUE(pref3_node.Get(syncable::IS_UNAPPLIED_UPDATE));
- EXPECT_TRUE(pref3_node.Get(IS_DEL));
- EXPECT_GT(pref3_node.Get(syncable::SERVER_VERSION), 0);
- EXPECT_EQ(pref3_node.Get(syncable::BASE_VERSION), -1);
+ EXPECT_FALSE(pref3_node.GetIsUnsynced());
+ EXPECT_TRUE(pref3_node.GetIsUnappliedUpdate());
+ EXPECT_TRUE(pref3_node.GetIsDel());
+ EXPECT_GT(pref3_node.GetServerVersion(), 0);
+ EXPECT_EQ(pref3_node.GetBaseVersion(), -1);
syncable::Entry pref4_node(&trans, GET_BY_HANDLE, pref4_meta);
ASSERT_TRUE(pref4_node.good());
EXPECT_TRUE(pref4_node.GetKernelCopy().is_dirty());
- EXPECT_FALSE(pref4_node.Get(syncable::IS_UNSYNCED));
- EXPECT_TRUE(pref4_node.Get(syncable::IS_UNAPPLIED_UPDATE));
- EXPECT_TRUE(pref4_node.Get(IS_DEL));
- EXPECT_GT(pref4_node.Get(syncable::SERVER_VERSION), 0);
- EXPECT_EQ(pref4_node.Get(syncable::BASE_VERSION), -1);
+ EXPECT_FALSE(pref4_node.GetIsUnsynced());
+ EXPECT_TRUE(pref4_node.GetIsUnappliedUpdate());
+ EXPECT_TRUE(pref4_node.GetIsDel());
+ EXPECT_GT(pref4_node.GetServerVersion(), 0);
+ EXPECT_EQ(pref4_node.GetBaseVersion(), -1);
// Pref 5 should remain untouched.
syncable::Entry pref5_node(&trans, GET_BY_HANDLE, pref5_meta);
ASSERT_TRUE(pref5_node.good());
EXPECT_FALSE(pref5_node.GetKernelCopy().is_dirty());
- EXPECT_FALSE(pref5_node.Get(syncable::IS_UNSYNCED));
- EXPECT_TRUE(pref5_node.Get(syncable::IS_UNAPPLIED_UPDATE));
- EXPECT_TRUE(pref5_node.Get(IS_DEL));
- EXPECT_GT(pref5_node.Get(syncable::SERVER_VERSION), 0);
- EXPECT_EQ(pref5_node.Get(syncable::BASE_VERSION), -1);
+ EXPECT_FALSE(pref5_node.GetIsUnsynced());
+ EXPECT_TRUE(pref5_node.GetIsUnappliedUpdate());
+ EXPECT_TRUE(pref5_node.GetIsDel());
+ EXPECT_GT(pref5_node.GetServerVersion(), 0);
+ EXPECT_EQ(pref5_node.GetBaseVersion(), -1);
syncable::Entry bookmark_node(&trans, GET_BY_HANDLE, bookmark_meta);
ASSERT_TRUE(bookmark_node.good());
EXPECT_TRUE(bookmark_node.GetKernelCopy().is_dirty());
- EXPECT_FALSE(bookmark_node.Get(syncable::IS_UNSYNCED));
- EXPECT_TRUE(bookmark_node.Get(syncable::IS_UNAPPLIED_UPDATE));
- EXPECT_TRUE(bookmark_node.Get(IS_DEL));
- EXPECT_GT(bookmark_node.Get(syncable::SERVER_VERSION), 0);
- EXPECT_EQ(bookmark_node.Get(syncable::BASE_VERSION), -1);
+ EXPECT_FALSE(bookmark_node.GetIsUnsynced());
+ EXPECT_TRUE(bookmark_node.GetIsUnappliedUpdate());
+ EXPECT_TRUE(bookmark_node.GetIsDel());
+ EXPECT_GT(bookmark_node.GetServerVersion(), 0);
+ EXPECT_EQ(bookmark_node.GetBaseVersion(), -1);
}
}
@@ -3251,9 +3251,9 @@ class SyncManagerChangeProcessingTest : public SyncManagerTest {
// It's never going to be truly accurate, since we're squashing update
// receipt, processing and application into a single transaction.
void SetNodeProperties(syncable::MutableEntry *entry) {
- entry->Put(syncable::ID, id_factory_.NewServerId());
- entry->Put(syncable::BASE_VERSION, 10);
- entry->Put(syncable::SERVER_VERSION, 10);
+ entry->PutId(id_factory_.NewServerId());
+ entry->PutBaseVersion(10);
+ entry->PutServerVersion(10);
}
// Looks for the given change in the list. Returns the index at which it was
@@ -3298,17 +3298,17 @@ TEST_F(SyncManagerChangeProcessingTest, AddBookmarks) {
ASSERT_TRUE(root.good());
syncable::MutableEntry folder(&trans, syncable::CREATE,
- BOOKMARKS, root.Get(syncable::ID), "folder");
+ BOOKMARKS, root.GetId(), "folder");
ASSERT_TRUE(folder.good());
SetNodeProperties(&folder);
- folder.Put(syncable::IS_DIR, true);
- folder_id = folder.Get(syncable::META_HANDLE);
+ folder.PutIsDir(true);
+ folder_id = folder.GetMetahandle();
syncable::MutableEntry child(&trans, syncable::CREATE,
- BOOKMARKS, folder.Get(syncable::ID), "child");
+ BOOKMARKS, folder.GetId(), "child");
ASSERT_TRUE(child.good());
SetNodeProperties(&child);
- child_id = child.Get(syncable::META_HANDLE);
+ child_id = child.GetMetahandle();
}
// The closing of the above scope will delete the transaction. Its processed
@@ -3340,24 +3340,24 @@ TEST_F(SyncManagerChangeProcessingTest, MoveBookmarkIntoEmptyFolder) {
ASSERT_TRUE(root.good());
syncable::MutableEntry folder_a(&trans, syncable::CREATE,
- BOOKMARKS, root.Get(syncable::ID), "folderA");
+ BOOKMARKS, root.GetId(), "folderA");
ASSERT_TRUE(folder_a.good());
SetNodeProperties(&folder_a);
- folder_a.Put(syncable::IS_DIR, true);
+ folder_a.PutIsDir(true);
syncable::MutableEntry folder_b(&trans, syncable::CREATE,
- BOOKMARKS, root.Get(syncable::ID), "folderB");
+ BOOKMARKS, root.GetId(), "folderB");
ASSERT_TRUE(folder_b.good());
SetNodeProperties(&folder_b);
- folder_b.Put(syncable::IS_DIR, true);
- folder_b_id = folder_b.Get(syncable::META_HANDLE);
+ folder_b.PutIsDir(true);
+ folder_b_id = folder_b.GetMetahandle();
syncable::MutableEntry child(&trans, syncable::CREATE,
- BOOKMARKS, folder_a.Get(syncable::ID),
+ BOOKMARKS, folder_a.GetId(),
"child");
ASSERT_TRUE(child.good());
SetNodeProperties(&child);
- child_id = child.Get(syncable::META_HANDLE);
+ child_id = child.GetMetahandle();
}
// Close that transaction. The above was to setup the initial scenario. The
@@ -3371,7 +3371,7 @@ TEST_F(SyncManagerChangeProcessingTest, MoveBookmarkIntoEmptyFolder) {
syncable::Entry folder_b(&trans, syncable::GET_BY_HANDLE, folder_b_id);
syncable::MutableEntry child(&trans, syncable::GET_BY_HANDLE, child_id);
- child.Put(syncable::PARENT_ID, folder_b.Get(syncable::ID));
+ child.PutParentId(folder_b.GetId());
}
EXPECT_EQ(1UL, GetChangeListSize());
@@ -3397,29 +3397,29 @@ TEST_F(SyncManagerChangeProcessingTest, MoveIntoPopulatedFolder) {
ASSERT_TRUE(root.good());
syncable::MutableEntry folder_a(&trans, syncable::CREATE,
- BOOKMARKS, root.Get(syncable::ID), "folderA");
+ BOOKMARKS, root.GetId(), "folderA");
ASSERT_TRUE(folder_a.good());
SetNodeProperties(&folder_a);
- folder_a.Put(syncable::IS_DIR, true);
+ folder_a.PutIsDir(true);
syncable::MutableEntry folder_b(&trans, syncable::CREATE,
- BOOKMARKS, root.Get(syncable::ID), "folderB");
+ BOOKMARKS, root.GetId(), "folderB");
ASSERT_TRUE(folder_b.good());
SetNodeProperties(&folder_b);
- folder_b.Put(syncable::IS_DIR, true);
+ folder_b.PutIsDir(true);
syncable::MutableEntry child_a(&trans, syncable::CREATE,
- BOOKMARKS, folder_a.Get(syncable::ID),
+ BOOKMARKS, folder_a.GetId(),
"childA");
ASSERT_TRUE(child_a.good());
SetNodeProperties(&child_a);
- child_a_id = child_a.Get(syncable::META_HANDLE);
+ child_a_id = child_a.GetMetahandle();
syncable::MutableEntry child_b(&trans, syncable::CREATE,
- BOOKMARKS, folder_b.Get(syncable::ID),
+ BOOKMARKS, folder_b.GetId(),
"childB");
SetNodeProperties(&child_b);
- child_b_id = child_b.Get(syncable::META_HANDLE);
+ child_b_id = child_b.GetMetahandle();
}
@@ -3434,8 +3434,8 @@ TEST_F(SyncManagerChangeProcessingTest, MoveIntoPopulatedFolder) {
syncable::MutableEntry child_b(&trans, syncable::GET_BY_HANDLE, child_b_id);
// Move child A from folder A to folder B and update its position.
- child_a.Put(syncable::PARENT_ID, child_b.Get(syncable::PARENT_ID));
- child_a.PutPredecessor(child_b.Get(syncable::ID));
+ child_a.PutParentId(child_b.GetParentId());
+ child_a.PutPredecessor(child_b.GetId());
}
EXPECT_EQ(1UL, GetChangeListSize());
@@ -3460,25 +3460,25 @@ TEST_F(SyncManagerChangeProcessingTest, DeletionsAndChanges) {
ASSERT_TRUE(root.good());
syncable::MutableEntry folder_a(&trans, syncable::CREATE,
- BOOKMARKS, root.Get(syncable::ID), "folderA");
+ BOOKMARKS, root.GetId(), "folderA");
ASSERT_TRUE(folder_a.good());
SetNodeProperties(&folder_a);
- folder_a.Put(syncable::IS_DIR, true);
- folder_a_id = folder_a.Get(syncable::META_HANDLE);
+ folder_a.PutIsDir(true);
+ folder_a_id = folder_a.GetMetahandle();
syncable::MutableEntry folder_b(&trans, syncable::CREATE,
- BOOKMARKS, root.Get(syncable::ID), "folderB");
+ BOOKMARKS, root.GetId(), "folderB");
ASSERT_TRUE(folder_b.good());
SetNodeProperties(&folder_b);
- folder_b.Put(syncable::IS_DIR, true);
- folder_b_id = folder_b.Get(syncable::META_HANDLE);
+ folder_b.PutIsDir(true);
+ folder_b_id = folder_b.GetMetahandle();
syncable::MutableEntry child(&trans, syncable::CREATE,
- BOOKMARKS, folder_a.Get(syncable::ID),
+ BOOKMARKS, folder_a.GetId(),
"child");
ASSERT_TRUE(child.good());
SetNodeProperties(&child);
- child_id = child.Get(syncable::META_HANDLE);
+ child_id = child.GetMetahandle();
}
// Close that transaction. The above was to setup the initial scenario. The
@@ -3495,11 +3495,11 @@ TEST_F(SyncManagerChangeProcessingTest, DeletionsAndChanges) {
syncable::MutableEntry child(&trans, syncable::GET_BY_HANDLE, child_id);
// Delete folder B and its child.
- child.Put(syncable::IS_DEL, true);
- folder_b.Put(syncable::IS_DEL, true);
+ child.PutIsDel(true);
+ folder_b.PutIsDel(true);
// Make an unrelated change to folder A.
- folder_a.Put(syncable::NON_UNIQUE_NAME, "NewNameA");
+ folder_a.PutNonUniqueName("NewNameA");
}
EXPECT_EQ(3UL, GetChangeListSize());