Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Unified Diff: sync/engine/directory_update_handler_unittest.cc

Issue 805633004: Enable Null Syncable ID which is different than Root ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed some dependencies on SERVER_PARENT_ID Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sync/engine/directory_update_handler_unittest.cc
diff --git a/sync/engine/directory_update_handler_unittest.cc b/sync/engine/directory_update_handler_unittest.cc
index e7518ff6b9ff13673a071eda1269294b07e73a7a..8691a6a53709f60ef104d0a9375b42a0f70bcfc0 100644
--- a/sync/engine/directory_update_handler_unittest.cc
+++ b/sync/engine/directory_update_handler_unittest.cc
@@ -29,6 +29,7 @@
namespace syncer {
+using syncable::Id;
pavely 2014/12/22 21:38:09 nit: There are plenty of places in this file with
stanisc 2014/12/22 22:44:19 Done.
using syncable::UNITTEST;
static const int64 kDefaultVersion = 1000;
@@ -136,7 +137,7 @@ TEST_F(DirectoryUpdateHandlerProcessUpdateTest, NewBookmarkTag) {
sessions::StatusController status;
// Add a bookmark item to the update message.
- std::string root = syncable::GetNullId().GetServerId();
+ std::string root = Id::GetRoot().GetServerId();
syncable::Id server_id = syncable::Id::CreateFromServerId("b1");
scoped_ptr<sync_pb::SyncEntity> e =
CreateUpdate(SyncableIdToProto(server_id), root, BOOKMARKS);
@@ -176,7 +177,7 @@ TEST_F(DirectoryUpdateHandlerProcessUpdateTest,
// Create an update that mimics the bookmark root.
syncable::Id server_id = syncable::Id::CreateFromServerId("xyz");
- std::string root = syncable::GetNullId().GetServerId();
+ std::string root = Id::GetRoot().GetServerId();
scoped_ptr<sync_pb::SyncEntity> e =
CreateUpdate(SyncableIdToProto(server_id), root, BOOKMARKS);
e->set_server_defined_unique_tag("google_chrome_bookmarks");
@@ -209,7 +210,7 @@ TEST_F(DirectoryUpdateHandlerProcessUpdateTest, ReceiveNonBookmarkItem) {
sync_pb::GetUpdatesResponse gu_response;
sessions::StatusController status;
- std::string root = syncable::GetNullId().GetServerId();
+ std::string root = Id::GetRoot().GetServerId();
syncable::Id server_id = syncable::Id::CreateFromServerId("xyz");
scoped_ptr<sync_pb::SyncEntity> e =
CreateUpdate(SyncableIdToProto(server_id), root, AUTOFILL);
@@ -272,8 +273,7 @@ TEST_F(DirectoryUpdateHandlerProcessUpdateTest, GarbageCollectionByVersion) {
scoped_ptr<sync_pb::SyncEntity> type_root =
CreateUpdate(SyncableIdToProto(syncable::Id::CreateFromServerId("root")),
- syncable::GetNullId().GetServerId(),
- SYNCED_NOTIFICATIONS);
+ Id::GetRoot().GetServerId(), SYNCED_NOTIFICATIONS);
type_root->set_server_defined_unique_tag(
ModelTypeToRootTag(SYNCED_NOTIFICATIONS));
type_root->set_folder(true);
@@ -336,8 +336,7 @@ TEST_F(DirectoryUpdateHandlerProcessUpdateTest, ContextVersion) {
scoped_ptr<sync_pb::SyncEntity> type_root =
CreateUpdate(SyncableIdToProto(syncable::Id::CreateFromServerId("root")),
- syncable::GetNullId().GetServerId(),
- SYNCED_NOTIFICATIONS);
+ Id::GetRoot().GetServerId(), SYNCED_NOTIFICATIONS);
type_root->set_server_defined_unique_tag(
ModelTypeToRootTag(SYNCED_NOTIFICATIONS));
type_root->set_folder(true);
@@ -417,8 +416,7 @@ TEST_F(DirectoryUpdateHandlerProcessUpdateTest,
scoped_ptr<sync_pb::SyncEntity> type_root =
CreateUpdate(SyncableIdToProto(syncable::Id::CreateFromServerId("root")),
- syncable::GetNullId().GetServerId(),
- ARTICLES);
+ Id::GetRoot().GetServerId(), ARTICLES);
type_root->set_server_defined_unique_tag(ModelTypeToRootTag(ARTICLES));
type_root->set_folder(true);
@@ -575,7 +573,7 @@ sync_pb::EntitySpecifics DefaultBookmarkSpecifics() {
TEST_F(DirectoryUpdateHandlerApplyUpdateTest, SimpleBookmark) {
sessions::StatusController status;
- std::string root_server_id = syncable::GetNullId().GetServerId();
+ std::string root_server_id = Id::GetRoot().GetServerId();
int64 parent_handle =
entry_factory()->CreateUnappliedNewBookmarkItemWithParent(
"parent", DefaultBookmarkSpecifics(), root_server_id);
@@ -613,7 +611,7 @@ TEST_F(DirectoryUpdateHandlerApplyUpdateTest, SimpleBookmark) {
TEST_F(DirectoryUpdateHandlerApplyUpdateTest,
BookmarkChildrenBeforeParent) {
// Start with some bookmarks whose parents are unknown.
- std::string root_server_id = syncable::GetNullId().GetServerId();
+ std::string root_server_id = Id::GetRoot().GetServerId();
int64 a_handle = entry_factory()->CreateUnappliedNewBookmarkItemWithParent(
"a_child_created_first", DefaultBookmarkSpecifics(), "parent");
int64 x_handle = entry_factory()->CreateUnappliedNewBookmarkItemWithParent(
@@ -903,7 +901,7 @@ TEST_F(DirectoryUpdateHandlerApplyUpdateTest,
// fail due to hierarchy conflicts. Others should succeed.
TEST_F(DirectoryUpdateHandlerApplyUpdateTest, ItemsBothKnownAndUnknown) {
// See what happens when there's a mixture of good and bad updates.
- std::string root_server_id = syncable::GetNullId().GetServerId();
+ std::string root_server_id = Id::GetRoot().GetServerId();
int64 u1_handle = entry_factory()->CreateUnappliedNewItemWithParent(
"first_unknown_item", DefaultBookmarkSpecifics(), "unknown_parent");
int64 k1_handle = entry_factory()->CreateUnappliedNewItemWithParent(
@@ -994,7 +992,7 @@ TEST_F(DirectoryUpdateHandlerApplyUpdateTest, UndecryptableData) {
sync_pb::EntitySpecifics encrypted_bookmark;
encrypted_bookmark.mutable_encrypted();
AddDefaultFieldValue(BOOKMARKS, &encrypted_bookmark);
- std::string root_server_id = syncable::GetNullId().GetServerId();
+ std::string root_server_id = Id::GetRoot().GetServerId();
int64 folder_handle = entry_factory()->CreateUnappliedNewItemWithParent(
"folder",
encrypted_bookmark,

Powered by Google App Engine
This is Rietveld 408576698