summaryrefslogtreecommitdiffstats
path: root/sync/engine
diff options
context:
space:
mode:
authorjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-11 15:51:40 +0000
committerjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-11 15:51:40 +0000
commit88f6351cd9da0846003bd1d79840bf9436d6b886 (patch)
tree497bec530ea31d19b05488a3bf119f1cc533cb59 /sync/engine
parenta6ee41bcba06dba2212bba3fe1df6fc71a4e8f5f (diff)
downloadchromium_src-88f6351cd9da0846003bd1d79840bf9436d6b886.zip
chromium_src-88f6351cd9da0846003bd1d79840bf9436d6b886.tar.gz
chromium_src-88f6351cd9da0846003bd1d79840bf9436d6b886.tar.bz2
Revert 176340
> sync: Initialize entries with a valid model type > > This change modifies two important sync functions. > > The first is MutableEntry's CREATE constructor. It now requires that > the ModelType of the entry to be specified when the entry is create. > This doesn't quite eliminate the existence of nodes without a valid > model type (the CREATE_NEW_UPDATE_ITEM can still make them), but it > helps. > > This paves the way for the upcoming UniquePosition change. Part of that > change is that bookmarks must be granted a unique tag on creation. To > support this, we must know at creation time the type of a new entry, so > we can take the appropriate bookmark-specific steps if necessary. > > The second function to get a new signature is WriteNode's > InitByCreation(), which has been renamed to > WriteNode::InitBookmarkByCreation(). The function can only be used to > create bookmarks, so the new name describes its function more precisely. > > Updates to the call-sites of MutableEntry's constructor make up the > majority of this change. This change also includes some minor updates > to test functions that create entries to make them compatible with the > stricter assertions or to make them more closely reflect real world > behaviour. > > BUG=145412,126505 > > > Review URL: https://chromiumcodereview.appspot.com/11817010 TBR=rlarocque@chromium.org Review URL: https://codereview.chromium.org/11863011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176352 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/engine')
-rw-r--r--sync/engine/apply_updates_and_resolve_conflicts_command_unittest.cc29
-rw-r--r--sync/engine/process_commit_response_command_unittest.cc183
-rw-r--r--sync/engine/syncer_unittest.cc173
3 files changed, 201 insertions, 184 deletions
diff --git a/sync/engine/apply_updates_and_resolve_conflicts_command_unittest.cc b/sync/engine/apply_updates_and_resolve_conflicts_command_unittest.cc
index c341e8f..97d4c33 100644
--- a/sync/engine/apply_updates_and_resolve_conflicts_command_unittest.cc
+++ b/sync/engine/apply_updates_and_resolve_conflicts_command_unittest.cc
@@ -71,10 +71,12 @@ class ApplyUpdatesAndResolveConflictsCommandTest : public SyncerCommandTest {
TEST_F(ApplyUpdatesAndResolveConflictsCommandTest, Simple) {
string root_server_id = syncable::GetNullId().GetServerId();
- entry_factory_->CreateUnappliedNewBookmarkItemWithParent(
- "parent", DefaultBookmarkSpecifics(), root_server_id);
- entry_factory_->CreateUnappliedNewBookmarkItemWithParent(
- "child", DefaultBookmarkSpecifics(), "parent");
+ entry_factory_->CreateUnappliedNewItemWithParent("parent",
+ DefaultBookmarkSpecifics(),
+ root_server_id);
+ entry_factory_->CreateUnappliedNewItemWithParent("child",
+ DefaultBookmarkSpecifics(),
+ "parent");
ExpectGroupToChange(apply_updates_command_, GROUP_UI);
apply_updates_command_.ExecuteImpl(session());
@@ -93,15 +95,15 @@ TEST_F(ApplyUpdatesAndResolveConflictsCommandTest,
// Set a bunch of updates which are difficult to apply in the order
// they're received due to dependencies on other unseen items.
string root_server_id = syncable::GetNullId().GetServerId();
- entry_factory_->CreateUnappliedNewBookmarkItemWithParent(
+ entry_factory_->CreateUnappliedNewItemWithParent(
"a_child_created_first", DefaultBookmarkSpecifics(), "parent");
- entry_factory_->CreateUnappliedNewBookmarkItemWithParent(
+ entry_factory_->CreateUnappliedNewItemWithParent(
"x_child_created_first", DefaultBookmarkSpecifics(), "parent");
- entry_factory_->CreateUnappliedNewBookmarkItemWithParent(
+ entry_factory_->CreateUnappliedNewItemWithParent(
"parent", DefaultBookmarkSpecifics(), root_server_id);
- entry_factory_->CreateUnappliedNewBookmarkItemWithParent(
+ entry_factory_->CreateUnappliedNewItemWithParent(
"a_child_created_second", DefaultBookmarkSpecifics(), "parent");
- entry_factory_->CreateUnappliedNewBookmarkItemWithParent(
+ entry_factory_->CreateUnappliedNewItemWithParent(
"x_child_created_second", DefaultBookmarkSpecifics(), "parent");
ExpectGroupToChange(apply_updates_command_, GROUP_UI);
@@ -117,7 +119,7 @@ TEST_F(ApplyUpdatesAndResolveConflictsCommandTest,
// expect the command to detect that this update can't be applied because it is
// in a CONFLICT state.
TEST_F(ApplyUpdatesAndResolveConflictsCommandTest, SimpleConflict) {
- entry_factory_->CreateUnappliedAndUnsyncedBookmarkItem("item");
+ entry_factory_->CreateUnappliedAndUnsyncedItem("item", BOOKMARKS);
ExpectGroupToChange(apply_updates_command_, GROUP_UI);
apply_updates_command_.ExecuteImpl(session());
@@ -137,8 +139,8 @@ TEST_F(ApplyUpdatesAndResolveConflictsCommandTest, SimpleConflict) {
// CONFLICT_HIERARCHY state.
TEST_F(ApplyUpdatesAndResolveConflictsCommandTest, HierarchyAndSimpleConflict) {
// Create a simply-conflicting item. It will start with valid parent ids.
- int64 handle = entry_factory_->CreateUnappliedAndUnsyncedBookmarkItem(
- "orphaned_by_server");
+ int64 handle = entry_factory_->CreateUnappliedAndUnsyncedItem(
+ "orphaned_by_server", BOOKMARKS);
{
// Manually set the SERVER_PARENT_ID to bad value.
// A bad parent indicates a hierarchy conflict.
@@ -240,7 +242,8 @@ TEST_F(ApplyUpdatesAndResolveConflictsCommandTest,
// Create a server-deleted directory.
{
// Create it as a child of root node.
- int64 handle = entry_factory_->CreateSyncedItem("parent", BOOKMARKS, true);
+ int64 handle =
+ entry_factory_->CreateSyncedItem("parent", BOOKMARKS, true);
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
MutableEntry entry(&trans, syncable::GET_BY_HANDLE, handle);
diff --git a/sync/engine/process_commit_response_command_unittest.cc b/sync/engine/process_commit_response_command_unittest.cc
index 40bd61b..f96ea5e 100644
--- a/sync/engine/process_commit_response_command_unittest.cc
+++ b/sync/engine/process_commit_response_command_unittest.cc
@@ -8,7 +8,6 @@
#include "base/location.h"
#include "base/stringprintf.h"
-#include "sync/internal_api/public/test/test_entry_factory.h"
#include "sync/protocol/bookmark_specifics.pb.h"
#include "sync/protocol/sync.pb.h"
#include "sync/sessions/sync_session.h"
@@ -56,14 +55,13 @@ class ProcessCommitResponseCommandTest : public SyncerCommandTest {
(*mutable_routing_info())[AUTOFILL] = GROUP_DB;
SyncerCommandTest::SetUp();
-
- test_entry_factory_.reset(new TestEntryFactory(directory()));
}
protected:
ProcessCommitResponseCommandTest()
- : next_new_revision_(4000),
+ : next_old_revision_(1),
+ next_new_revision_(4000),
next_server_position_(10000) {
}
@@ -77,22 +75,59 @@ class ProcessCommitResponseCommandTest : public SyncerCommandTest {
<< "Item should have a valid (positive) server base revision";
}
- // Create a new unsynced item in the database, and synthesize a commit record
- // and a commit response for it in the syncer session. If item_id is a local
- // ID, the item will be a create operation. Otherwise, it will be an edit.
- // Returns the metahandle of the newly created item.
- int CreateUnprocessedCommitResult(
+ // Create an unsynced item in the database. If item_id is a local ID, it
+ // will be treated as a create-new. Otherwise, if it's a server ID, we'll
+ // fake the server data so that it looks like it exists on the server.
+ // Returns the methandle of the created item in |metahandle_out| if not NULL.
+ void CreateUnsyncedItem(const Id& item_id,
+ const Id& parent_id,
+ const string& name,
+ bool is_folder,
+ ModelType model_type,
+ int64* metahandle_out) {
+ WriteTransaction trans(FROM_HERE, UNITTEST, directory());
+ Id predecessor_id;
+ ASSERT_TRUE(
+ directory()->GetLastChildIdForTest(&trans, parent_id, &predecessor_id));
+ MutableEntry entry(&trans, syncable::CREATE, parent_id, name);
+ ASSERT_TRUE(entry.good());
+ entry.Put(syncable::ID, item_id);
+ entry.Put(syncable::BASE_VERSION,
+ item_id.ServerKnows() ? next_old_revision_++ : 0);
+ entry.Put(syncable::IS_UNSYNCED, true);
+ entry.Put(syncable::IS_DIR, is_folder);
+ entry.Put(syncable::IS_DEL, false);
+ entry.Put(syncable::PARENT_ID, parent_id);
+ entry.PutPredecessor(predecessor_id);
+ sync_pb::EntitySpecifics default_specifics;
+ AddDefaultFieldValue(model_type, &default_specifics);
+ entry.Put(syncable::SPECIFICS, default_specifics);
+ if (item_id.ServerKnows()) {
+ entry.Put(syncable::SERVER_SPECIFICS, default_specifics);
+ entry.Put(syncable::SERVER_IS_DIR, is_folder);
+ entry.Put(syncable::SERVER_PARENT_ID, parent_id);
+ entry.Put(syncable::SERVER_IS_DEL, false);
+ }
+ if (metahandle_out)
+ *metahandle_out = entry.Get(syncable::META_HANDLE);
+ }
+
+ // Create a new unsynced item in the database, and synthesize a commit
+ // record and a commit response for it in the syncer session. If item_id
+ // is a local ID, the item will be a create operation. Otherwise, it
+ // will be an edit.
+ void CreateUnprocessedCommitResult(
const Id& item_id,
const Id& parent_id,
const string& name,
- bool is_folder,
ModelType model_type,
sessions::OrderedCommitSet *commit_set,
sync_pb::ClientToServerMessage *commit,
sync_pb::ClientToServerResponse *response) {
+ bool is_folder = true;
int64 metahandle = 0;
- test_entry_factory_->CreateUnsyncedItem(item_id, parent_id, name,
- is_folder, model_type, &metahandle);
+ CreateUnsyncedItem(item_id, parent_id, name, is_folder, model_type,
+ &metahandle);
// ProcessCommitResponseCommand consumes commit_ids from the session
// state, so we need to update that. O(n^2) because it's a test.
@@ -100,26 +135,19 @@ class ProcessCommitResponseCommandTest : public SyncerCommandTest {
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
MutableEntry entry(&trans, syncable::GET_BY_ID, item_id);
- EXPECT_TRUE(entry.good());
+ ASSERT_TRUE(entry.good());
entry.Put(syncable::SYNCING, true);
// Add to the commit message.
- // TODO(sync): Use the real commit-building code to construct this.
commit->set_message_contents(ClientToServerMessage::COMMIT);
sync_pb::SyncEntity* entity = commit->mutable_commit()->add_entries();
- entity->set_non_unique_name(entry.Get(syncable::NON_UNIQUE_NAME));
- entity->set_folder(entry.Get(syncable::IS_DIR));
- entity->set_parent_id_string(
- SyncableIdToProto(entry.Get(syncable::PARENT_ID)));
+ entity->set_non_unique_name(name);
+ entity->set_folder(is_folder);
+ entity->set_parent_id_string(SyncableIdToProto(parent_id));
entity->set_version(entry.Get(syncable::BASE_VERSION));
entity->mutable_specifics()->CopyFrom(entry.Get(syncable::SPECIFICS));
entity->set_id_string(SyncableIdToProto(item_id));
- if (!entry.Get(syncable::UNIQUE_CLIENT_TAG).empty()) {
- entity->set_client_defined_unique_tag(
- entry.Get(syncable::UNIQUE_CLIENT_TAG));
- }
-
// Add to the response message.
response->set_error_code(sync_pb::SyncEnums::SUCCESS);
sync_pb::CommitResponse_EntryResponse* entry_response =
@@ -145,8 +173,6 @@ class ProcessCommitResponseCommandTest : public SyncerCommandTest {
response->commit().entryresponse(i).id_string());
}
}
-
- return metahandle;
}
void SetLastErrorCode(sync_pb::CommitResponse::ResponseType error_code,
@@ -158,8 +184,8 @@ class ProcessCommitResponseCommandTest : public SyncerCommandTest {
}
TestIdFactory id_factory_;
- scoped_ptr<TestEntryFactory> test_entry_factory_;
private:
+ int64 next_old_revision_;
int64 next_new_revision_;
int64 next_server_position_;
DISALLOW_COPY_AND_ASSIGN(ProcessCommitResponseCommandTest);
@@ -171,63 +197,69 @@ TEST_F(ProcessCommitResponseCommandTest, MultipleCommitIdProjections) {
sync_pb::ClientToServerResponse response;
Id bookmark_folder_id = id_factory_.NewLocalId();
- int bookmark_folder_handle = CreateUnprocessedCommitResult(
- bookmark_folder_id, id_factory_.root(), "A bookmark folder", true,
- BOOKMARKS, &commit_set, &request, &response);
- int bookmark1_handle = CreateUnprocessedCommitResult(
- id_factory_.NewLocalId(), bookmark_folder_id, "bookmark 1", false,
- BOOKMARKS, &commit_set, &request, &response);
- int bookmark2_handle = CreateUnprocessedCommitResult(
- id_factory_.NewLocalId(), bookmark_folder_id, "bookmark 2", false,
- BOOKMARKS, &commit_set, &request, &response);
- int pref1_handle = CreateUnprocessedCommitResult(
- id_factory_.NewLocalId(), id_factory_.root(), "Pref 1", false,
- PREFERENCES, &commit_set, &request, &response);
- int pref2_handle = CreateUnprocessedCommitResult(
- id_factory_.NewLocalId(), id_factory_.root(), "Pref 2", false,
- PREFERENCES, &commit_set, &request, &response);
- int autofill1_handle = CreateUnprocessedCommitResult(
- id_factory_.NewLocalId(), id_factory_.root(), "Autofill 1", false,
- AUTOFILL, &commit_set, &request, &response);
- int autofill2_handle = CreateUnprocessedCommitResult(
- id_factory_.NewLocalId(), id_factory_.root(), "Autofill 2", false,
- AUTOFILL, &commit_set, &request, &response);
+ Id bookmark_id1 = id_factory_.NewLocalId();
+ Id bookmark_id2 = id_factory_.NewLocalId();
+ Id pref_id1 = id_factory_.NewLocalId(), pref_id2 = id_factory_.NewLocalId();
+ Id autofill_id1 = id_factory_.NewLocalId();
+ Id autofill_id2 = id_factory_.NewLocalId();
+ CreateUnprocessedCommitResult(bookmark_folder_id, id_factory_.root(),
+ "A bookmark folder", BOOKMARKS,
+ &commit_set, &request, &response);
+ CreateUnprocessedCommitResult(bookmark_id1, bookmark_folder_id,
+ "bookmark 1", BOOKMARKS,
+ &commit_set, &request, &response);
+ CreateUnprocessedCommitResult(bookmark_id2, bookmark_folder_id,
+ "bookmark 2", BOOKMARKS,
+ &commit_set, &request, &response);
+ CreateUnprocessedCommitResult(pref_id1, id_factory_.root(),
+ "Pref 1", PREFERENCES,
+ &commit_set, &request, &response);
+ CreateUnprocessedCommitResult(pref_id2, id_factory_.root(),
+ "Pref 2", PREFERENCES,
+ &commit_set, &request, &response);
+ CreateUnprocessedCommitResult(autofill_id1, id_factory_.root(),
+ "Autofill 1", AUTOFILL,
+ &commit_set, &request, &response);
+ CreateUnprocessedCommitResult(autofill_id2, id_factory_.root(),
+ "Autofill 2", AUTOFILL,
+ &commit_set, &request, &response);
ProcessCommitResponseCommand command(commit_set, request, response);
ExpectGroupsToChange(command, GROUP_UI, GROUP_DB);
command.ExecuteImpl(session());
syncable::ReadTransaction trans(FROM_HERE, directory());
-
- Entry b_folder(&trans, syncable::GET_BY_HANDLE, bookmark_folder_handle);
- ASSERT_TRUE(b_folder.good());
-
- Id new_fid = b_folder.Get(syncable::ID);
+ Id new_fid;
+ ASSERT_TRUE(directory()->GetFirstChildId(
+ &trans, id_factory_.root(), &new_fid));
ASSERT_FALSE(new_fid.IsRoot());
EXPECT_TRUE(new_fid.ServerKnows());
EXPECT_FALSE(bookmark_folder_id.ServerKnows());
EXPECT_FALSE(new_fid == bookmark_folder_id);
-
+ Entry b_folder(&trans, syncable::GET_BY_ID, new_fid);
+ ASSERT_TRUE(b_folder.good());
ASSERT_EQ("A bookmark folder", b_folder.Get(NON_UNIQUE_NAME))
<< "Name of bookmark folder should not change.";
ASSERT_LT(0, b_folder.Get(BASE_VERSION))
<< "Bookmark folder should have a valid (positive) server base revision";
// Look at the two bookmarks in bookmark_folder.
- Entry b1(&trans, syncable::GET_BY_HANDLE, bookmark1_handle);
- Entry b2(&trans, syncable::GET_BY_HANDLE, bookmark2_handle);
+ Id cid;
+ ASSERT_TRUE(directory()->GetFirstChildId(&trans, new_fid, &cid));
+ Entry b1(&trans, syncable::GET_BY_ID, cid);
+ Entry b2(&trans, syncable::GET_BY_ID, b1.GetSuccessorId());
CheckEntry(&b1, "bookmark 1", BOOKMARKS, new_fid);
CheckEntry(&b2, "bookmark 2", BOOKMARKS, new_fid);
ASSERT_TRUE(b2.GetSuccessorId().IsRoot());
// Look at the prefs and autofill items.
- Entry p1(&trans, syncable::GET_BY_HANDLE, pref1_handle);
- Entry p2(&trans, syncable::GET_BY_HANDLE, pref2_handle);
+ Entry p1(&trans, syncable::GET_BY_ID, b_folder.GetSuccessorId());
+ Entry p2(&trans, syncable::GET_BY_ID, p1.GetSuccessorId());
CheckEntry(&p1, "Pref 1", PREFERENCES, id_factory_.root());
CheckEntry(&p2, "Pref 2", PREFERENCES, id_factory_.root());
- Entry a1(&trans, syncable::GET_BY_HANDLE, autofill1_handle);
- Entry a2(&trans, syncable::GET_BY_HANDLE, autofill2_handle);
+ Entry a1(&trans, syncable::GET_BY_ID, p2.GetSuccessorId());
+ Entry a2(&trans, syncable::GET_BY_ID, a1.GetSuccessorId());
CheckEntry(&a1, "Autofill 1", AUTOFILL, id_factory_.root());
CheckEntry(&a2, "Autofill 2", AUTOFILL, id_factory_.root());
ASSERT_TRUE(a2.GetSuccessorId().IsRoot());
@@ -250,18 +282,16 @@ TEST_F(ProcessCommitResponseCommandTest, NewFolderCommitKeepsChildOrder) {
// Create the parent folder, a new item whose ID will change on commit.
Id folder_id = id_factory_.NewLocalId();
- CreateUnprocessedCommitResult(folder_id, id_factory_.root(),
- "A", true, BOOKMARKS,
+ CreateUnprocessedCommitResult(folder_id, id_factory_.root(), "A",
+ BOOKMARKS,
&commit_set, &request, &response);
// Verify that the item is reachable.
{
- Id child_id;
syncable::ReadTransaction trans(FROM_HERE, directory());
- syncable::Entry root(&trans, syncable::GET_BY_ID, id_factory_.root());
- ASSERT_TRUE(root.good());
+ Id child_id;
ASSERT_TRUE(directory()->GetFirstChildId(
- &trans, id_factory_.root(), &child_id));
+ &trans, id_factory_.root(), &child_id));
ASSERT_EQ(folder_id, child_id);
}
@@ -273,8 +303,8 @@ TEST_F(ProcessCommitResponseCommandTest, NewFolderCommitKeepsChildOrder) {
// Alternate between new and old child items, just for kicks.
Id id = (i % 4 < 2) ? id_factory_.NewLocalId() : id_factory_.NewServerId();
CreateUnprocessedCommitResult(
- id, folder_id, base::StringPrintf("Item %d", i), false,
- BOOKMARKS, &commit_set, &request, &response);
+ id, folder_id, base::StringPrintf("Item %d", i), BOOKMARKS,
+ &commit_set, &request, &response);
}
// The second 25 children will be unsynced items but NOT part of the commit
// batch. When the ID of the parent folder changes during the commit,
@@ -283,9 +313,8 @@ TEST_F(ProcessCommitResponseCommandTest, NewFolderCommitKeepsChildOrder) {
for (; i < 2*batch_size; ++i) {
// Alternate between new and old child items, just for kicks.
Id id = (i % 4 < 2) ? id_factory_.NewLocalId() : id_factory_.NewServerId();
- test_entry_factory_->CreateUnsyncedItem(
- id, folder_id, base::StringPrintf("Item %d", i),
- false, BOOKMARKS, NULL);
+ CreateUnsyncedItem(id, folder_id, base::StringPrintf("Item %d", i),
+ false, BOOKMARKS, NULL);
}
// Process the commit response for the parent folder and the first
@@ -384,17 +413,15 @@ TEST_P(MixedResult, ExtensionActivity) {
<< "To not be lame, this test requires more than one active group.";
// Bookmark item setup.
- CreateUnprocessedCommitResult(
- id_factory_.NewServerId(),
- id_factory_.root(), "Some bookmark", false,
- BOOKMARKS, &commit_set, &request, &response);
+ CreateUnprocessedCommitResult(id_factory_.NewServerId(),
+ id_factory_.root(), "Some bookmark", BOOKMARKS,
+ &commit_set, &request, &response);
if (ShouldFailBookmarkCommit())
SetLastErrorCode(CommitResponse::TRANSIENT_ERROR, &response);
// Autofill item setup.
- CreateUnprocessedCommitResult(
- id_factory_.NewServerId(),
- id_factory_.root(), "Some autofill", false,
- AUTOFILL, &commit_set, &request, &response);
+ CreateUnprocessedCommitResult(id_factory_.NewServerId(),
+ id_factory_.root(), "Some autofill", AUTOFILL,
+ &commit_set, &request, &response);
if (ShouldFailAutofillCommit())
SetLastErrorCode(CommitResponse::TRANSIENT_ERROR, &response);
diff --git a/sync/engine/syncer_unittest.cc b/sync/engine/syncer_unittest.cc
index 669bda2..7fef4f4 100644
--- a/sync/engine/syncer_unittest.cc
+++ b/sync/engine/syncer_unittest.cc
@@ -355,7 +355,7 @@ class SyncerTest : public testing::Test,
}
string utf8_name = test->id.GetServerId();
string name(utf8_name.begin(), utf8_name.end());
- MutableEntry entry(&trans, CREATE, BOOKMARKS, test->parent_id, name);
+ MutableEntry entry(&trans, CREATE, test->parent_id, name);
entry.Put(syncable::ID, test->id);
if (test->id.ServerKnows()) {
@@ -458,8 +458,8 @@ class SyncerTest : public testing::Test,
int64 CreateUnsyncedDirectory(const string& entry_name,
const syncable::Id& id) {
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry entry(
- &wtrans, CREATE, BOOKMARKS, wtrans.root_id(), entry_name);
+ MutableEntry entry(&wtrans, syncable::CREATE, wtrans.root_id(),
+ entry_name);
EXPECT_TRUE(entry.good());
entry.Put(syncable::IS_UNSYNCED, true);
entry.Put(syncable::IS_DIR, true);
@@ -987,14 +987,15 @@ TEST_F(SyncerTest, EncryptionAwareConflicts) {
TEST_F(SyncerTest, TestGetUnsyncedAndSimpleCommit) {
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent(&wtrans, CREATE, BOOKMARKS, wtrans.root_id(), "Pete");
+ MutableEntry parent(&wtrans, syncable::CREATE, wtrans.root_id(),
+ "Pete");
ASSERT_TRUE(parent.good());
parent.Put(syncable::IS_UNSYNCED, true);
parent.Put(syncable::IS_DIR, true);
parent.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
parent.Put(syncable::BASE_VERSION, 1);
parent.Put(syncable::ID, parent_id_);
- MutableEntry child(&wtrans, CREATE, BOOKMARKS, parent_id_, "Pete");
+ MutableEntry child(&wtrans, syncable::CREATE, parent_id_, "Pete");
ASSERT_TRUE(child.good());
child.Put(syncable::ID, child_id_);
child.Put(syncable::BASE_VERSION, 1);
@@ -1019,20 +1020,20 @@ TEST_F(SyncerTest, TestPurgeWhileUnsynced) {
syncable::Id pref_node_id = TestIdFactory::MakeServer("Tim");
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent(&wtrans, CREATE, BOOKMARKS, wtrans.root_id(), "Pete");
+ MutableEntry parent(&wtrans, syncable::CREATE, wtrans.root_id(), "Pete");
ASSERT_TRUE(parent.good());
parent.Put(syncable::IS_UNSYNCED, true);
parent.Put(syncable::IS_DIR, true);
parent.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
parent.Put(syncable::BASE_VERSION, 1);
parent.Put(syncable::ID, parent_id_);
- MutableEntry child(&wtrans, CREATE, BOOKMARKS, parent_id_, "Pete");
+ MutableEntry child(&wtrans, syncable::CREATE, parent_id_, "Pete");
ASSERT_TRUE(child.good());
child.Put(syncable::ID, child_id_);
child.Put(syncable::BASE_VERSION, 1);
WriteTestDataToEntry(&wtrans, &child);
- MutableEntry parent2(&wtrans, CREATE, BOOKMARKS, wtrans.root_id(), "Tim");
+ MutableEntry parent2(&wtrans, syncable::CREATE, wtrans.root_id(), "Tim");
ASSERT_TRUE(parent2.good());
parent2.Put(syncable::IS_UNSYNCED, true);
parent2.Put(syncable::IS_DIR, true);
@@ -1066,7 +1067,7 @@ TEST_F(SyncerTest, TestPurgeWhileUnapplied) {
// Similar to above, but for unapplied items. Bug 49278.
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent(&wtrans, CREATE, BOOKMARKS, wtrans.root_id(), "Pete");
+ MutableEntry parent(&wtrans, syncable::CREATE, wtrans.root_id(), "Pete");
ASSERT_TRUE(parent.good());
parent.Put(syncable::IS_UNAPPLIED_UPDATE, true);
parent.Put(syncable::IS_DIR, true);
@@ -1221,23 +1222,24 @@ TEST_F(SyncerTest, TestCommitListOrderingWithNesting) {
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
{
- MutableEntry parent(&wtrans, CREATE, BOOKMARKS, wtrans.root_id(), "Bob");
+ MutableEntry parent(&wtrans, syncable::CREATE, wtrans.root_id(),
+ "Bob");
ASSERT_TRUE(parent.good());
parent.Put(syncable::IS_UNSYNCED, true);
parent.Put(syncable::IS_DIR, true);
parent.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
parent.Put(syncable::ID, ids_.FromNumber(100));
parent.Put(syncable::BASE_VERSION, 1);
- MutableEntry child(
- &wtrans, CREATE, BOOKMARKS, ids_.FromNumber(100), "Bob");
+ MutableEntry child(&wtrans, syncable::CREATE, ids_.FromNumber(100),
+ "Bob");
ASSERT_TRUE(child.good());
child.Put(syncable::IS_UNSYNCED, true);
child.Put(syncable::IS_DIR, true);
child.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
child.Put(syncable::ID, ids_.FromNumber(101));
child.Put(syncable::BASE_VERSION, 1);
- MutableEntry grandchild(
- &wtrans, CREATE, BOOKMARKS, ids_.FromNumber(101), "Bob");
+ MutableEntry grandchild(&wtrans, syncable::CREATE, ids_.FromNumber(101),
+ "Bob");
ASSERT_TRUE(grandchild.good());
grandchild.Put(syncable::ID, ids_.FromNumber(102));
grandchild.Put(syncable::IS_UNSYNCED, true);
@@ -1247,7 +1249,8 @@ TEST_F(SyncerTest, TestCommitListOrderingWithNesting) {
{
// Create three deleted items which deletions we expect to be sent to the
// server.
- MutableEntry parent(&wtrans, CREATE, BOOKMARKS, wtrans.root_id(), "Pete");
+ MutableEntry parent(&wtrans, syncable::CREATE, wtrans.root_id(),
+ "Pete");
ASSERT_TRUE(parent.good());
parent.Put(syncable::ID, ids_.FromNumber(103));
parent.Put(syncable::IS_UNSYNCED, true);
@@ -1256,8 +1259,8 @@ TEST_F(SyncerTest, TestCommitListOrderingWithNesting) {
parent.Put(syncable::IS_DEL, true);
parent.Put(syncable::BASE_VERSION, 1);
parent.Put(syncable::MTIME, now_minus_2h);
- MutableEntry child(
- &wtrans, CREATE, BOOKMARKS, ids_.FromNumber(103), "Pete");
+ MutableEntry child(&wtrans, syncable::CREATE, ids_.FromNumber(103),
+ "Pete");
ASSERT_TRUE(child.good());
child.Put(syncable::ID, ids_.FromNumber(104));
child.Put(syncable::IS_UNSYNCED, true);
@@ -1266,8 +1269,8 @@ TEST_F(SyncerTest, TestCommitListOrderingWithNesting) {
child.Put(syncable::IS_DEL, true);
child.Put(syncable::BASE_VERSION, 1);
child.Put(syncable::MTIME, now_minus_2h);
- MutableEntry grandchild(
- &wtrans, CREATE, BOOKMARKS, ids_.FromNumber(104), "Pete");
+ MutableEntry grandchild(&wtrans, syncable::CREATE, ids_.FromNumber(104),
+ "Pete");
ASSERT_TRUE(grandchild.good());
grandchild.Put(syncable::ID, ids_.FromNumber(105));
grandchild.Put(syncable::IS_UNSYNCED, true);
@@ -1296,35 +1299,32 @@ TEST_F(SyncerTest, TestCommitListOrderingWithNesting) {
}
TEST_F(SyncerTest, TestCommitListOrderingWithNewItems) {
- syncable::Id parent1_id = ids_.MakeServer("p1");
- syncable::Id parent2_id = ids_.MakeServer("p2");
-
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent(&wtrans, CREATE, BOOKMARKS, wtrans.root_id(), "1");
+ MutableEntry parent(&wtrans, syncable::CREATE, wtrans.root_id(), "1");
ASSERT_TRUE(parent.good());
parent.Put(syncable::IS_UNSYNCED, true);
parent.Put(syncable::IS_DIR, true);
parent.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
- parent.Put(syncable::ID, parent1_id);
- MutableEntry child(&wtrans, CREATE, BOOKMARKS, wtrans.root_id(), "2");
+ parent.Put(syncable::ID, parent_id_);
+ MutableEntry child(&wtrans, syncable::CREATE, wtrans.root_id(), "2");
ASSERT_TRUE(child.good());
child.Put(syncable::IS_UNSYNCED, true);
child.Put(syncable::IS_DIR, true);
child.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
- child.Put(syncable::ID, parent2_id);
+ child.Put(syncable::ID, child_id_);
parent.Put(syncable::BASE_VERSION, 1);
child.Put(syncable::BASE_VERSION, 1);
}
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent(&wtrans, CREATE, BOOKMARKS, parent1_id, "A");
+ MutableEntry parent(&wtrans, syncable::CREATE, parent_id_, "A");
ASSERT_TRUE(parent.good());
parent.Put(syncable::IS_UNSYNCED, true);
parent.Put(syncable::IS_DIR, true);
parent.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
parent.Put(syncable::ID, ids_.FromNumber(102));
- MutableEntry child(&wtrans, CREATE, BOOKMARKS, parent1_id, "B");
+ MutableEntry child(&wtrans, syncable::CREATE, parent_id_, "B");
ASSERT_TRUE(child.good());
child.Put(syncable::IS_UNSYNCED, true);
child.Put(syncable::IS_DIR, true);
@@ -1334,13 +1334,13 @@ TEST_F(SyncerTest, TestCommitListOrderingWithNewItems) {
}
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent(&wtrans, CREATE, BOOKMARKS, parent2_id, "A");
+ MutableEntry parent(&wtrans, syncable::CREATE, child_id_, "A");
ASSERT_TRUE(parent.good());
parent.Put(syncable::IS_UNSYNCED, true);
parent.Put(syncable::IS_DIR, true);
parent.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
parent.Put(syncable::ID, ids_.FromNumber(-104));
- MutableEntry child(&wtrans, CREATE, BOOKMARKS, parent2_id, "B");
+ MutableEntry child(&wtrans, syncable::CREATE, child_id_, "B");
ASSERT_TRUE(child.good());
child.Put(syncable::IS_UNSYNCED, true);
child.Put(syncable::IS_DIR, true);
@@ -1352,8 +1352,8 @@ TEST_F(SyncerTest, TestCommitListOrderingWithNewItems) {
SyncShareNudge();
ASSERT_EQ(6u, mock_server_->committed_ids().size());
// If this test starts failing, be aware other sort orders could be valid.
- EXPECT_TRUE(parent1_id == mock_server_->committed_ids()[0]);
- EXPECT_TRUE(parent2_id == mock_server_->committed_ids()[1]);
+ EXPECT_TRUE(parent_id_ == mock_server_->committed_ids()[0]);
+ EXPECT_TRUE(child_id_ == mock_server_->committed_ids()[1]);
EXPECT_TRUE(ids_.FromNumber(102) == mock_server_->committed_ids()[2]);
EXPECT_TRUE(ids_.FromNumber(-103) == mock_server_->committed_ids()[3]);
EXPECT_TRUE(ids_.FromNumber(-104) == mock_server_->committed_ids()[4]);
@@ -1365,18 +1365,18 @@ TEST_F(SyncerTest, TestCommitListOrderingCounterexample) {
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent(&wtrans, CREATE, BOOKMARKS, wtrans.root_id(), "P");
+ MutableEntry parent(&wtrans, syncable::CREATE, wtrans.root_id(), "P");
ASSERT_TRUE(parent.good());
parent.Put(syncable::IS_UNSYNCED, true);
parent.Put(syncable::IS_DIR, true);
parent.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
parent.Put(syncable::ID, parent_id_);
- MutableEntry child1(&wtrans, CREATE, BOOKMARKS, parent_id_, "1");
+ MutableEntry child1(&wtrans, syncable::CREATE, parent_id_, "1");
ASSERT_TRUE(child1.good());
child1.Put(syncable::IS_UNSYNCED, true);
child1.Put(syncable::ID, child_id_);
child1.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
- MutableEntry child2(&wtrans, CREATE, BOOKMARKS, parent_id_, "2");
+ MutableEntry child2(&wtrans, syncable::CREATE, parent_id_, "2");
ASSERT_TRUE(child2.good());
child2.Put(syncable::IS_UNSYNCED, true);
child2.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
@@ -1402,7 +1402,7 @@ TEST_F(SyncerTest, TestCommitListOrderingAndNewParent) {
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent(&wtrans, CREATE, BOOKMARKS, wtrans.root_id(),
+ MutableEntry parent(&wtrans, syncable::CREATE, wtrans.root_id(),
parent1_name);
ASSERT_TRUE(parent.good());
parent.Put(syncable::IS_UNSYNCED, true);
@@ -1416,16 +1416,14 @@ TEST_F(SyncerTest, TestCommitListOrderingAndNewParent) {
syncable::Id child_id = ids_.NewServerId();
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent2(
- &wtrans, CREATE, BOOKMARKS, parent_id_, parent2_name);
+ MutableEntry parent2(&wtrans, syncable::CREATE, parent_id_, parent2_name);
ASSERT_TRUE(parent2.good());
parent2.Put(syncable::IS_UNSYNCED, true);
parent2.Put(syncable::IS_DIR, true);
parent2.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
parent2.Put(syncable::ID, parent2_id);
- MutableEntry child(
- &wtrans, CREATE, BOOKMARKS, parent2_id, child_name);
+ MutableEntry child(&wtrans, syncable::CREATE, parent2_id, child_name);
ASSERT_TRUE(child.good());
child.Put(syncable::IS_UNSYNCED, true);
child.Put(syncable::IS_DIR, true);
@@ -1472,7 +1470,7 @@ TEST_F(SyncerTest, TestCommitListOrderingAndNewParentAndChild) {
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
MutableEntry parent(&wtrans,
- CREATE, BOOKMARKS,
+ syncable::CREATE,
wtrans.root_id(),
parent_name);
ASSERT_TRUE(parent.good());
@@ -1488,15 +1486,14 @@ TEST_F(SyncerTest, TestCommitListOrderingAndNewParentAndChild) {
const Id child_local_id = ids_.NewLocalId();
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent2(&wtrans, CREATE, BOOKMARKS, parent_id_, parent2_name);
+ MutableEntry parent2(&wtrans, syncable::CREATE, parent_id_, parent2_name);
ASSERT_TRUE(parent2.good());
parent2.Put(syncable::IS_UNSYNCED, true);
parent2.Put(syncable::IS_DIR, true);
parent2.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
parent2.Put(syncable::ID, parent2_local_id);
- MutableEntry child(
- &wtrans, CREATE, BOOKMARKS, parent2_local_id, child_name);
+ MutableEntry child(&wtrans, syncable::CREATE, parent2_local_id, child_name);
ASSERT_TRUE(child.good());
child.Put(syncable::IS_UNSYNCED, true);
child.Put(syncable::IS_DIR, true);
@@ -1714,14 +1711,14 @@ TEST_F(SyncerTest, CommitTimeRename) {
// Create a folder and an entry.
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent(&trans, CREATE, BOOKMARKS, root_id_, "Folder");
+ MutableEntry parent(&trans, CREATE, root_id_, "Folder");
ASSERT_TRUE(parent.good());
parent.Put(IS_DIR, true);
parent.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
parent.Put(IS_UNSYNCED, true);
metahandle_folder = parent.Get(META_HANDLE);
- MutableEntry entry(&trans, CREATE, BOOKMARKS, parent.Get(ID), "new_entry");
+ MutableEntry entry(&trans, CREATE, parent.Get(ID), "new_entry");
ASSERT_TRUE(entry.good());
metahandle_new_entry = entry.Get(META_HANDLE);
WriteTestDataToEntry(&trans, &entry);
@@ -1762,7 +1759,7 @@ TEST_F(SyncerTest, CommitTimeRenameI18N) {
// Create a folder, expect a commit time rename.
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent(&trans, CREATE, BOOKMARKS, root_id_, "Folder");
+ MutableEntry parent(&trans, CREATE, root_id_, "Folder");
ASSERT_TRUE(parent.good());
parent.Put(IS_DIR, true);
parent.Put(SPECIFICS, DefaultBookmarkSpecifics());
@@ -1793,8 +1790,7 @@ TEST_F(SyncerTest, CommitReuniteUpdateAdjustsChildren) {
int64 metahandle_folder;
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry entry(
- &trans, CREATE, BOOKMARKS, trans.root_id(), "new_folder");
+ MutableEntry entry(&trans, CREATE, trans.root_id(), "new_folder");
ASSERT_TRUE(entry.good());
entry.Put(IS_DIR, true);
entry.Put(SPECIFICS, DefaultBookmarkSpecifics());
@@ -1816,7 +1812,7 @@ TEST_F(SyncerTest, CommitReuniteUpdateAdjustsChildren) {
// Create an entry in the newly created folder.
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry entry(&trans, CREATE, BOOKMARKS, folder_id, "new_entry");
+ MutableEntry entry(&trans, CREATE, folder_id, "new_entry");
ASSERT_TRUE(entry.good());
metahandle_entry = entry.Get(META_HANDLE);
WriteTestDataToEntry(&trans, &entry);
@@ -1885,7 +1881,7 @@ TEST_F(SyncerTest, CommitReuniteUpdate) {
int64 entry_metahandle;
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry entry(&trans, CREATE, BOOKMARKS, trans.root_id(), "new_entry");
+ MutableEntry entry(&trans, CREATE, trans.root_id(), "new_entry");
ASSERT_TRUE(entry.good());
entry_metahandle = entry.Get(META_HANDLE);
WriteTestDataToEntry(&trans, &entry);
@@ -1939,7 +1935,7 @@ TEST_F(SyncerTest, CommitReuniteUpdateDoesNotChokeOnDeletedLocalEntry) {
int64 entry_metahandle;
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry entry(&trans, CREATE, BOOKMARKS, trans.root_id(), "new_entry");
+ MutableEntry entry(&trans, CREATE, trans.root_id(), "new_entry");
ASSERT_TRUE(entry.good());
entry_metahandle = entry.Get(META_HANDLE);
WriteTestDataToEntry(&trans, &entry);
@@ -2103,8 +2099,8 @@ class EntryCreatedInNewFolderTest : public SyncerTest {
"bob"));
CHECK(bob.good());
- MutableEntry entry2(
- &trans, CREATE, BOOKMARKS, bob.Get(syncable::ID), "bob");
+ MutableEntry entry2(&trans, syncable::CREATE, bob.Get(syncable::ID),
+ "bob");
CHECK(entry2.good());
entry2.Put(syncable::IS_DIR, true);
entry2.Put(syncable::IS_UNSYNCED, true);
@@ -2115,7 +2111,8 @@ class EntryCreatedInNewFolderTest : public SyncerTest {
TEST_F(EntryCreatedInNewFolderTest, EntryCreatedInNewFolderMidSync) {
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry entry(&trans, CREATE, BOOKMARKS, trans.root_id(), "bob");
+ MutableEntry entry(&trans, syncable::CREATE, trans.root_id(),
+ "bob");
ASSERT_TRUE(entry.good());
entry.Put(syncable::IS_DIR, true);
entry.Put(syncable::IS_UNSYNCED, true);
@@ -2153,7 +2150,7 @@ TEST_F(SyncerTest, UnappliedUpdateOnCreatedItemItemDoesNotCrash) {
{
// Create an item.
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry fred_match(&trans, CREATE, BOOKMARKS, trans.root_id(),
+ MutableEntry fred_match(&trans, CREATE, trans.root_id(),
"fred_match");
ASSERT_TRUE(fred_match.good());
metahandle_fred = fred_match.Get(META_HANDLE);
@@ -2189,13 +2186,13 @@ TEST_F(SyncerTest, UnappliedUpdateOnCreatedItemItemDoesNotCrash) {
TEST_F(SyncerTest, DoublyChangedWithResolver) {
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent(&wtrans, CREATE, BOOKMARKS, root_id_, "Folder");
+ MutableEntry parent(&wtrans, syncable::CREATE, root_id_, "Folder");
ASSERT_TRUE(parent.good());
parent.Put(syncable::IS_DIR, true);
parent.Put(syncable::ID, parent_id_);
parent.Put(syncable::BASE_VERSION, 5);
parent.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics());
- MutableEntry child(&wtrans, CREATE, BOOKMARKS, parent_id_, "Pete.htm");
+ MutableEntry child(&wtrans, syncable::CREATE, parent_id_, "Pete.htm");
ASSERT_TRUE(child.good());
child.Put(syncable::ID, child_id_);
child.Put(syncable::BASE_VERSION, 10);
@@ -2230,7 +2227,7 @@ TEST_F(SyncerTest, CommitsUpdateDoesntAlterEntry) {
int64 entry_metahandle;
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry entry(&wtrans, CREATE, BOOKMARKS, root_id_, "Pete");
+ MutableEntry entry(&wtrans, syncable::CREATE, root_id_, "Pete");
ASSERT_TRUE(entry.good());
EXPECT_FALSE(entry.Get(ID).ServerKnows());
entry.Put(syncable::IS_DIR, true);
@@ -2276,7 +2273,7 @@ TEST_F(SyncerTest, ParentAndChildBothMatch) {
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent(&wtrans, CREATE, BOOKMARKS, root_id_, "Folder");
+ MutableEntry parent(&wtrans, CREATE, root_id_, "Folder");
ASSERT_TRUE(parent.good());
parent.Put(IS_DIR, true);
parent.Put(IS_UNSYNCED, true);
@@ -2284,7 +2281,7 @@ TEST_F(SyncerTest, ParentAndChildBothMatch) {
parent.Put(BASE_VERSION, 1);
parent.Put(SPECIFICS, DefaultBookmarkSpecifics());
- MutableEntry child(&wtrans, CREATE, BOOKMARKS, parent.Get(ID), "test.htm");
+ MutableEntry child(&wtrans, CREATE, parent.Get(ID), "test.htm");
ASSERT_TRUE(child.good());
child.Put(ID, child_id);
child.Put(BASE_VERSION, 1);
@@ -2317,7 +2314,7 @@ TEST_F(SyncerTest, ParentAndChildBothMatch) {
TEST_F(SyncerTest, CommittingNewDeleted) {
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry entry(&trans, CREATE, BOOKMARKS, trans.root_id(), "bob");
+ MutableEntry entry(&trans, CREATE, trans.root_id(), "bob");
entry.Put(IS_UNSYNCED, true);
entry.Put(IS_DEL, true);
}
@@ -2338,7 +2335,7 @@ TEST_F(SyncerTest, UnappliedUpdateDuringCommit) {
// This test is a little fake.
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry entry(&trans, CREATE, BOOKMARKS, trans.root_id(), "bob");
+ MutableEntry entry(&trans, CREATE, trans.root_id(), "bob");
entry.Put(ID, ids_.FromNumber(20));
entry.Put(BASE_VERSION, 1);
entry.Put(SERVER_VERSION, 1);
@@ -2370,7 +2367,7 @@ TEST_F(SyncerTest, DeletingEntryInFolder) {
int64 existing_metahandle;
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry entry(&trans, CREATE, BOOKMARKS, trans.root_id(), "existing");
+ MutableEntry entry(&trans, CREATE, trans.root_id(), "existing");
ASSERT_TRUE(entry.good());
entry.Put(IS_DIR, true);
entry.Put(SPECIFICS, DefaultBookmarkSpecifics());
@@ -2380,7 +2377,7 @@ TEST_F(SyncerTest, DeletingEntryInFolder) {
syncer_->SyncShare(session_.get(), SYNCER_BEGIN, SYNCER_END);
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry newfolder(&trans, CREATE, BOOKMARKS, trans.root_id(), "new");
+ MutableEntry newfolder(&trans, CREATE, trans.root_id(), "new");
ASSERT_TRUE(newfolder.good());
newfolder.Put(IS_DIR, true);
newfolder.Put(SPECIFICS, DefaultBookmarkSpecifics());
@@ -2406,8 +2403,7 @@ TEST_F(SyncerTest, DeletingEntryWithLocalEdits) {
SyncShareNudge();
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry newfolder(
- &trans, CREATE, BOOKMARKS, ids_.FromNumber(1), "local");
+ MutableEntry newfolder(&trans, CREATE, ids_.FromNumber(1), "local");
ASSERT_TRUE(newfolder.good());
newfolder.Put(IS_UNSYNCED, true);
newfolder.Put(IS_DIR, true);
@@ -2498,7 +2494,7 @@ TEST_F(SyncerTest, CommitManyItemsInOneGo_Success) {
for (uint32 i = 0; i < items_to_commit; i++) {
string nameutf8 = base::StringPrintf("%d", i);
string name(nameutf8.begin(), nameutf8.end());
- MutableEntry e(&trans, CREATE, BOOKMARKS, trans.root_id(), name);
+ MutableEntry e(&trans, CREATE, trans.root_id(), name);
e.Put(IS_UNSYNCED, true);
e.Put(IS_DIR, true);
e.Put(SPECIFICS, DefaultBookmarkSpecifics());
@@ -2521,7 +2517,7 @@ TEST_F(SyncerTest, CommitManyItemsInOneGo_PostBufferFail) {
for (uint32 i = 0; i < items_to_commit; i++) {
string nameutf8 = base::StringPrintf("%d", i);
string name(nameutf8.begin(), nameutf8.end());
- MutableEntry e(&trans, CREATE, BOOKMARKS, trans.root_id(), name);
+ MutableEntry e(&trans, CREATE, trans.root_id(), name);
e.Put(IS_UNSYNCED, true);
e.Put(IS_DIR, true);
e.Put(SPECIFICS, DefaultBookmarkSpecifics());
@@ -2551,7 +2547,7 @@ TEST_F(SyncerTest, CommitManyItemsInOneGo_CommitConflict) {
for (uint32 i = 0; i < items_to_commit; i++) {
string nameutf8 = base::StringPrintf("%d", i);
string name(nameutf8.begin(), nameutf8.end());
- MutableEntry e(&trans, CREATE, BOOKMARKS, trans.root_id(), name);
+ MutableEntry e(&trans, CREATE, trans.root_id(), name);
e.Put(IS_UNSYNCED, true);
e.Put(IS_DIR, true);
e.Put(SPECIFICS, DefaultBookmarkSpecifics());
@@ -2649,8 +2645,7 @@ TEST_F(SyncerTest, NewEntryAndAlteredServerEntrySharePath) {
syncable::Id local_folder_id;
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry new_entry(
- &wtrans, CREATE, BOOKMARKS, wtrans.root_id(), "Bar.htm");
+ MutableEntry new_entry(&wtrans, CREATE, wtrans.root_id(), "Bar.htm");
ASSERT_TRUE(new_entry.good());
local_folder_id = new_entry.Get(ID);
local_folder_handle = new_entry.Get(META_HANDLE);
@@ -2716,8 +2711,7 @@ TEST_F(SyncerTest, NewEntryAndAlteredServerEntrySharePath_OldBookmarksProto) {
syncable::Id local_folder_id;
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry new_entry(
- &wtrans, CREATE, BOOKMARKS, wtrans.root_id(), "Bar.htm");
+ MutableEntry new_entry(&wtrans, CREATE, wtrans.root_id(), "Bar.htm");
ASSERT_TRUE(new_entry.good());
local_folder_id = new_entry.Get(ID);
local_folder_handle = new_entry.Get(META_HANDLE);
@@ -2889,12 +2883,12 @@ TEST_F(SyncerTest, ResolveWeWroteTheyDeleted) {
TEST_F(SyncerTest, DuplicateIDReturn) {
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry folder(&trans, CREATE, BOOKMARKS, trans.root_id(), "bob");
+ MutableEntry folder(&trans, CREATE, trans.root_id(), "bob");
ASSERT_TRUE(folder.good());
folder.Put(IS_UNSYNCED, true);
folder.Put(IS_DIR, true);
folder.Put(SPECIFICS, DefaultBookmarkSpecifics());
- MutableEntry folder2(&trans, CREATE, BOOKMARKS, trans.root_id(), "fred");
+ MutableEntry folder2(&trans, CREATE, trans.root_id(), "fred");
ASSERT_TRUE(folder2.good());
folder2.Put(IS_UNSYNCED, false);
folder2.Put(IS_DIR, true);
@@ -2933,8 +2927,7 @@ TEST_F(SyncerTest, ConflictResolverMergesLocalDeleteAndServerUpdate) {
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry local_deleted(
- &trans, CREATE, BOOKMARKS, trans.root_id(), "name");
+ MutableEntry local_deleted(&trans, CREATE, trans.root_id(), "name");
local_deleted.Put(ID, ids_.FromNumber(1));
local_deleted.Put(BASE_VERSION, 1);
local_deleted.Put(IS_DEL, true);
@@ -2967,8 +2960,7 @@ TEST_F(SyncerTest, UpdateFlipsTheFolderBit) {
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry local_deleted(
- &trans, CREATE, BOOKMARKS, trans.root_id(), "name");
+ MutableEntry local_deleted(&trans, CREATE, trans.root_id(), "name");
local_deleted.Put(ID, ids_.FromNumber(1));
local_deleted.Put(BASE_VERSION, 1);
local_deleted.Put(IS_DEL, true);
@@ -3006,8 +2998,7 @@ TEST_F(SyncerTest, MergingExistingItems) {
SyncShareNudge();
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry entry(
- &trans, CREATE, BOOKMARKS, trans.root_id(), "Copy of base");
+ MutableEntry entry(&trans, CREATE, trans.root_id(), "Copy of base");
WriteTestDataToEntry(&trans, &entry);
}
mock_server_->AddUpdateBookmark(1, 0, "Copy of base", 50, 50);
@@ -3197,7 +3188,7 @@ TEST_F(SyncerTest, DirectoryCommitTest) {
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry parent(&wtrans, CREATE, BOOKMARKS, root_id_, "foo");
+ MutableEntry parent(&wtrans, syncable::CREATE, root_id_, "foo");
ASSERT_TRUE(parent.good());
parent.Put(syncable::IS_UNSYNCED, true);
parent.Put(syncable::IS_DIR, true);
@@ -3205,7 +3196,7 @@ TEST_F(SyncerTest, DirectoryCommitTest) {
in_root_id = parent.Get(syncable::ID);
foo_metahandle = parent.Get(META_HANDLE);
- MutableEntry child(&wtrans, CREATE, BOOKMARKS, parent.Get(ID), "bar");
+ MutableEntry child(&wtrans, syncable::CREATE, parent.Get(ID), "bar");
ASSERT_TRUE(child.good());
child.Put(syncable::IS_UNSYNCED, true);
child.Put(syncable::IS_DIR, true);
@@ -3317,8 +3308,7 @@ TEST_F(SyncerTest, EnsureWeSendUpOldParent) {
entry.Put(PARENT_ID, folder_two_id);
entry.Put(IS_UNSYNCED, true);
// A new entry should send no "old parent."
- MutableEntry create(
- &trans, CREATE, BOOKMARKS, trans.root_id(), "new_folder");
+ MutableEntry create(&trans, CREATE, trans.root_id(), "new_folder");
create.Put(IS_UNSYNCED, true);
create.Put(SPECIFICS, DefaultBookmarkSpecifics());
}
@@ -3338,7 +3328,7 @@ TEST_F(SyncerTest, Test64BitVersionSupport) {
// Try writing max int64 to the version fields of a meta entry.
{
WriteTransaction wtrans(FROM_HERE, UNITTEST, directory());
- MutableEntry entry(&wtrans, CREATE, BOOKMARKS, wtrans.root_id(), name);
+ MutableEntry entry(&wtrans, syncable::CREATE, wtrans.root_id(), name);
ASSERT_TRUE(entry.good());
entry.Put(syncable::BASE_VERSION, really_big_int);
entry.Put(syncable::SERVER_VERSION, really_big_int);
@@ -3549,8 +3539,7 @@ TEST_F(SyncerTest, ClientTagUncommittedTagMatchesUpdate) {
{
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry perm_folder(
- &trans, CREATE, BOOKMARKS, ids_.root(), "clientname");
+ MutableEntry perm_folder(&trans, CREATE, ids_.root(), "clientname");
ASSERT_TRUE(perm_folder.good());
perm_folder.Put(UNIQUE_CLIENT_TAG, "clientperm");
perm_folder.Put(SPECIFICS, local_bookmark);
@@ -3615,8 +3604,7 @@ TEST_F(SyncerTest, ClientTagConflictWithDeletedLocalEntry) {
{
// Create a deleted local entry with a unique client tag.
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry perm_folder(
- &trans, CREATE, BOOKMARKS, ids_.root(), "clientname");
+ MutableEntry perm_folder(&trans, CREATE, ids_.root(), "clientname");
ASSERT_TRUE(perm_folder.good());
ASSERT_FALSE(perm_folder.Get(ID).ServerKnows());
perm_folder.Put(UNIQUE_CLIENT_TAG, "clientperm");
@@ -4078,8 +4066,7 @@ class SyncerUndeletionTest : public SyncerTest {
void Create() {
WriteTransaction trans(FROM_HERE, UNITTEST, directory());
- MutableEntry perm_folder(
- &trans, CREATE, BOOKMARKS, ids_.root(), "clientname");
+ MutableEntry perm_folder(&trans, CREATE, ids_.root(), "clientname");
ASSERT_TRUE(perm_folder.good());
perm_folder.Put(UNIQUE_CLIENT_TAG, client_tag_);
perm_folder.Put(IS_UNSYNCED, true);