| Index: sync/engine/apply_updates_command_unittest.cc
|
| diff --git a/sync/engine/apply_updates_command_unittest.cc b/sync/engine/apply_updates_command_unittest.cc
|
| index e185b8e673139b62fbe4ffdfa74d5abba677593f..8f76afddec043a88a7fc992490cb0c23bdfe9fc8 100644
|
| --- a/sync/engine/apply_updates_command_unittest.cc
|
| +++ b/sync/engine/apply_updates_command_unittest.cc
|
| @@ -39,7 +39,7 @@ using syncable::WriteTransaction;
|
| namespace {
|
| sync_pb::EntitySpecifics DefaultBookmarkSpecifics() {
|
| sync_pb::EntitySpecifics result;
|
| - AddDefaultFieldValue(syncable::BOOKMARKS, &result);
|
| + AddDefaultFieldValue(syncer::BOOKMARKS, &result);
|
| return result;
|
| }
|
| } // namespace
|
| @@ -58,9 +58,9 @@ class ApplyUpdatesCommandTest : public SyncerCommandTest {
|
| make_scoped_refptr(new FakeModelWorker(GROUP_UI)));
|
| workers()->push_back(
|
| make_scoped_refptr(new FakeModelWorker(GROUP_PASSWORD)));
|
| - (*mutable_routing_info())[syncable::BOOKMARKS] = GROUP_UI;
|
| - (*mutable_routing_info())[syncable::PASSWORDS] = GROUP_PASSWORD;
|
| - (*mutable_routing_info())[syncable::NIGORI] = GROUP_PASSIVE;
|
| + (*mutable_routing_info())[syncer::BOOKMARKS] = GROUP_UI;
|
| + (*mutable_routing_info())[syncer::PASSWORDS] = GROUP_PASSWORD;
|
| + (*mutable_routing_info())[syncer::NIGORI] = GROUP_PASSIVE;
|
| SyncerCommandTest::SetUp();
|
| entry_factory_.reset(new TestEntryFactory(directory()));
|
| ExpectNoGroupsToChange(apply_updates_command_);
|
| @@ -138,8 +138,7 @@ TEST_F(ApplyUpdatesCommandTest, UpdateWithChildrenBeforeParents) {
|
| // to detect that this update can't be applied because it is in a CONFLICT
|
| // state.
|
| TEST_F(ApplyUpdatesCommandTest, SimpleConflict) {
|
| - entry_factory_->CreateUnappliedAndUnsyncedItem(
|
| - "item", syncable::BOOKMARKS);
|
| + entry_factory_->CreateUnappliedAndUnsyncedItem("item", syncer::BOOKMARKS);
|
|
|
| ExpectGroupToChange(apply_updates_command_, GROUP_UI);
|
| apply_updates_command_.ExecuteImpl(session());
|
| @@ -159,7 +158,7 @@ TEST_F(ApplyUpdatesCommandTest, SimpleConflict) {
|
| TEST_F(ApplyUpdatesCommandTest, HierarchyAndSimpleConflict) {
|
| // Create a simply-conflicting item. It will start with valid parent ids.
|
| int64 handle = entry_factory_->CreateUnappliedAndUnsyncedItem(
|
| - "orphaned_by_server", syncable::BOOKMARKS);
|
| + "orphaned_by_server", syncer::BOOKMARKS);
|
| {
|
| // Manually set the SERVER_PARENT_ID to bad value.
|
| // A bad parent indicates a hierarchy conflict.
|
| @@ -197,7 +196,7 @@ TEST_F(ApplyUpdatesCommandTest, HierarchyConflictDirectoryLoop) {
|
| {
|
| // Create it as a child of root node.
|
| int64 handle = entry_factory_->CreateSyncedItem(
|
| - "X", syncable::BOOKMARKS, true);
|
| + "X", syncer::BOOKMARKS, true);
|
|
|
| WriteTransaction trans(FROM_HERE, UNITTEST, directory());
|
| MutableEntry entry(&trans, syncable::GET_BY_HANDLE, handle);
|
| @@ -212,7 +211,7 @@ TEST_F(ApplyUpdatesCommandTest, HierarchyConflictDirectoryLoop) {
|
| // Item 'Y' is child of 'X'.
|
| entry_factory_->CreateUnsyncedItem(
|
| id_factory_.MakeServer("Y"), id_factory_.MakeServer("X"), "Y", true,
|
| - syncable::BOOKMARKS, NULL);
|
| + syncer::BOOKMARKS, NULL);
|
|
|
| // If the server's update were applied, we would have X be a child of Y, and Y
|
| // as a child of X. That's a directory loop. The UpdateApplicator should
|
| @@ -242,7 +241,7 @@ TEST_F(ApplyUpdatesCommandTest, HierarchyConflictDeletedParent) {
|
| int64 parent_handle;
|
| entry_factory_->CreateUnsyncedItem(
|
| Id::CreateFromServerId("parent"), id_factory_.root(),
|
| - "parent", true, syncable::BOOKMARKS, &parent_handle);
|
| + "parent", true, syncer::BOOKMARKS, &parent_handle);
|
| {
|
| WriteTransaction trans(FROM_HERE, UNITTEST, directory());
|
| MutableEntry entry(&trans, syncable::GET_BY_HANDLE, parent_handle);
|
| @@ -278,7 +277,7 @@ TEST_F(ApplyUpdatesCommandTest, HierarchyConflictDeleteNonEmptyDirectory) {
|
| {
|
| // Create it as a child of root node.
|
| int64 handle = entry_factory_->CreateSyncedItem(
|
| - "parent", syncable::BOOKMARKS, true);
|
| + "parent", syncer::BOOKMARKS, true);
|
|
|
| WriteTransaction trans(FROM_HERE, UNITTEST, directory());
|
| MutableEntry entry(&trans, syncable::GET_BY_HANDLE, handle);
|
| @@ -294,7 +293,7 @@ TEST_F(ApplyUpdatesCommandTest, HierarchyConflictDeleteNonEmptyDirectory) {
|
| // Create a local child of the server-deleted directory.
|
| entry_factory_->CreateUnsyncedItem(
|
| id_factory_.MakeServer("child"), id_factory_.MakeServer("parent"),
|
| - "child", false, syncable::BOOKMARKS, NULL);
|
| + "child", false, syncer::BOOKMARKS, NULL);
|
|
|
| // The server's request to delete the directory must be ignored, otherwise our
|
| // unsynced new child would be orphaned. This is a hierarchy conflict.
|
| @@ -410,7 +409,7 @@ TEST_F(ApplyUpdatesCommandTest, UndecryptableData) {
|
| // Undecryptable updates should not be applied.
|
| sync_pb::EntitySpecifics encrypted_bookmark;
|
| encrypted_bookmark.mutable_encrypted();
|
| - AddDefaultFieldValue(syncable::BOOKMARKS, &encrypted_bookmark);
|
| + AddDefaultFieldValue(syncer::BOOKMARKS, &encrypted_bookmark);
|
| string root_server_id = syncable::GetNullId().GetServerId();
|
| entry_factory_->CreateUnappliedNewItemWithParent(
|
| "folder", encrypted_bookmark, root_server_id);
|
| @@ -519,9 +518,9 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) {
|
| // Storing the cryptographer separately is bad, but for this test we
|
| // know it's safe.
|
| Cryptographer* cryptographer;
|
| - syncable::ModelTypeSet encrypted_types;
|
| - encrypted_types.Put(syncable::PASSWORDS);
|
| - encrypted_types.Put(syncable::NIGORI);
|
| + syncer::ModelTypeSet encrypted_types;
|
| + encrypted_types.Put(syncer::PASSWORDS);
|
| + encrypted_types.Put(syncer::NIGORI);
|
| {
|
| syncable::ReadTransaction trans(FROM_HERE, directory());
|
| cryptographer = directory()->GetCryptographer(&trans);
|
| @@ -537,9 +536,9 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) {
|
| sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
|
| other_cryptographer.GetKeys(nigori->mutable_encrypted());
|
| nigori->set_encrypt_bookmarks(true);
|
| - encrypted_types.Put(syncable::BOOKMARKS);
|
| + encrypted_types.Put(syncer::BOOKMARKS);
|
| entry_factory_->CreateUnappliedNewItem(
|
| - syncable::ModelTypeToRootTag(syncable::NIGORI), specifics, true);
|
| + syncer::ModelTypeToRootTag(syncer::NIGORI), specifics, true);
|
| EXPECT_FALSE(cryptographer->has_pending_keys());
|
|
|
| ExpectGroupToChange(apply_updates_command_, GROUP_PASSIVE);
|
| @@ -559,17 +558,16 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) {
|
| EXPECT_FALSE(cryptographer->is_ready());
|
| EXPECT_TRUE(cryptographer->has_pending_keys());
|
| EXPECT_TRUE(
|
| - cryptographer->GetEncryptedTypes()
|
| - .Equals(syncable::ModelTypeSet::All()));
|
| + cryptographer->GetEncryptedTypes().Equals(syncer::ModelTypeSet::All()));
|
| }
|
|
|
| TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) {
|
| // Storing the cryptographer separately is bad, but for this test we
|
| // know it's safe.
|
| Cryptographer* cryptographer;
|
| - syncable::ModelTypeSet encrypted_types;
|
| - encrypted_types.Put(syncable::PASSWORDS);
|
| - encrypted_types.Put(syncable::NIGORI);
|
| + syncer::ModelTypeSet encrypted_types;
|
| + encrypted_types.Put(syncer::PASSWORDS);
|
| + encrypted_types.Put(syncer::NIGORI);
|
| {
|
| syncable::ReadTransaction trans(FROM_HERE, directory());
|
| cryptographer = directory()->GetCryptographer(&trans);
|
| @@ -586,10 +584,10 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) {
|
| other_cryptographer.GetKeys(nigori->mutable_encrypted());
|
| nigori->set_encrypt_sessions(true);
|
| nigori->set_encrypt_themes(true);
|
| - encrypted_types.Put(syncable::SESSIONS);
|
| - encrypted_types.Put(syncable::THEMES);
|
| + encrypted_types.Put(syncer::SESSIONS);
|
| + encrypted_types.Put(syncer::THEMES);
|
| entry_factory_->CreateUnappliedNewItem(
|
| - syncable::ModelTypeToRootTag(syncable::NIGORI), specifics, true);
|
| + syncer::ModelTypeToRootTag(syncer::NIGORI), specifics, true);
|
| EXPECT_FALSE(cryptographer->has_pending_keys());
|
|
|
| ExpectGroupToChange(apply_updates_command_, GROUP_PASSIVE);
|
| @@ -609,8 +607,7 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) {
|
| EXPECT_FALSE(cryptographer->is_ready());
|
| EXPECT_TRUE(cryptographer->has_pending_keys());
|
| EXPECT_TRUE(
|
| - cryptographer->GetEncryptedTypes()
|
| - .Equals(syncable::ModelTypeSet::All()));
|
| + cryptographer->GetEncryptedTypes().Equals(syncer::ModelTypeSet::All()));
|
| }
|
|
|
| // Create some local unsynced and unencrypted data. Apply a nigori update that
|
| @@ -622,9 +619,9 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) {
|
| // Storing the cryptographer separately is bad, but for this test we
|
| // know it's safe.
|
| Cryptographer* cryptographer;
|
| - syncable::ModelTypeSet encrypted_types;
|
| - encrypted_types.Put(syncable::PASSWORDS);
|
| - encrypted_types.Put(syncable::NIGORI);
|
| + syncer::ModelTypeSet encrypted_types;
|
| + encrypted_types.Put(syncer::PASSWORDS);
|
| + encrypted_types.Put(syncer::NIGORI);
|
| {
|
| syncable::ReadTransaction trans(FROM_HERE, directory());
|
| cryptographer = directory()->GetCryptographer(&trans);
|
| @@ -642,21 +639,21 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) {
|
| // First item is a folder
|
| Id folder_id = id_factory_.NewLocalId();
|
| entry_factory_->CreateUnsyncedItem(folder_id, id_factory_.root(), "folder",
|
| - true, syncable::BOOKMARKS, NULL);
|
| + true, syncer::BOOKMARKS, NULL);
|
| // Next five items are children of the folder
|
| size_t i;
|
| size_t batch_s = 5;
|
| for (i = 0; i < batch_s; ++i) {
|
| entry_factory_->CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id,
|
| base::StringPrintf("Item %"PRIuS"", i),
|
| - false, syncable::BOOKMARKS, NULL);
|
| + false, syncer::BOOKMARKS, NULL);
|
| }
|
| // Next five items are children of the root.
|
| for (; i < 2*batch_s; ++i) {
|
| entry_factory_->CreateUnsyncedItem(
|
| id_factory_.NewLocalId(), id_factory_.root(),
|
| base::StringPrintf("Item %"PRIuS"", i), false,
|
| - syncable::BOOKMARKS, NULL);
|
| + syncer::BOOKMARKS, NULL);
|
| }
|
|
|
| KeyParams params = {"localhost", "dummy", "foobar"};
|
| @@ -665,9 +662,9 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) {
|
| sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
|
| cryptographer->GetKeys(nigori->mutable_encrypted());
|
| nigori->set_encrypt_bookmarks(true);
|
| - encrypted_types.Put(syncable::BOOKMARKS);
|
| + encrypted_types.Put(syncer::BOOKMARKS);
|
| entry_factory_->CreateUnappliedNewItem(
|
| - syncable::ModelTypeToRootTag(syncable::NIGORI), specifics, true);
|
| + syncer::ModelTypeToRootTag(syncer::NIGORI), specifics, true);
|
| EXPECT_FALSE(cryptographer->has_pending_keys());
|
| EXPECT_TRUE(cryptographer->is_ready());
|
|
|
| @@ -705,8 +702,8 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) {
|
|
|
| // If ProcessUnsyncedChangesForEncryption worked, all our unsynced changes
|
| // should be encrypted now.
|
| - EXPECT_TRUE(syncable::ModelTypeSet::All().Equals(
|
| - cryptographer->GetEncryptedTypes()));
|
| + EXPECT_TRUE(syncer::ModelTypeSet::All().Equals(
|
| + cryptographer->GetEncryptedTypes()));
|
| EXPECT_TRUE(VerifyUnsyncedChangesAreEncrypted(&trans, encrypted_types));
|
|
|
| Syncer::UnsyncedMetaHandles handles;
|
| @@ -718,7 +715,7 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) {
|
| {
|
| WriteTransaction trans(FROM_HERE, UNITTEST, directory());
|
| MutableEntry entry(&trans, syncable::GET_BY_SERVER_TAG,
|
| - syncable::ModelTypeToRootTag(syncable::NIGORI));
|
| + syncer::ModelTypeToRootTag(syncer::NIGORI));
|
| ASSERT_TRUE(entry.good());
|
| entry.Put(syncable::SERVER_VERSION, entry_factory_->GetNextRevision());
|
| entry.Put(syncable::IS_UNAPPLIED_UPDATE, true);
|
| @@ -745,7 +742,7 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) {
|
| syncable::ReadTransaction trans(FROM_HERE, directory());
|
|
|
| // All our changes should still be encrypted.
|
| - EXPECT_TRUE(syncable::ModelTypeSet::All().Equals(
|
| + EXPECT_TRUE(syncer::ModelTypeSet::All().Equals(
|
| cryptographer->GetEncryptedTypes()));
|
| EXPECT_TRUE(VerifyUnsyncedChangesAreEncrypted(&trans, encrypted_types));
|
|
|
| @@ -759,9 +756,9 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) {
|
| // Storing the cryptographer separately is bad, but for this test we
|
| // know it's safe.
|
| Cryptographer* cryptographer;
|
| - syncable::ModelTypeSet encrypted_types;
|
| - encrypted_types.Put(syncable::PASSWORDS);
|
| - encrypted_types.Put(syncable::NIGORI);
|
| + syncer::ModelTypeSet encrypted_types;
|
| + encrypted_types.Put(syncer::PASSWORDS);
|
| + encrypted_types.Put(syncer::NIGORI);
|
| {
|
| syncable::ReadTransaction trans(FROM_HERE, directory());
|
| cryptographer = directory()->GetCryptographer(&trans);
|
| @@ -780,21 +777,21 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) {
|
| Id folder_id = id_factory_.NewLocalId();
|
| entry_factory_->CreateUnsyncedItem(
|
| folder_id, id_factory_.root(), "folder", true,
|
| - syncable::BOOKMARKS, NULL);
|
| + syncer::BOOKMARKS, NULL);
|
| // Next five items are children of the folder
|
| size_t i;
|
| size_t batch_s = 5;
|
| for (i = 0; i < batch_s; ++i) {
|
| entry_factory_->CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id,
|
| base::StringPrintf("Item %"PRIuS"", i),
|
| - false, syncable::BOOKMARKS, NULL);
|
| + false, syncer::BOOKMARKS, NULL);
|
| }
|
| // Next five items are children of the root.
|
| for (; i < 2*batch_s; ++i) {
|
| entry_factory_->CreateUnsyncedItem(
|
| id_factory_.NewLocalId(), id_factory_.root(),
|
| base::StringPrintf("Item %"PRIuS"", i), false,
|
| - syncable::BOOKMARKS, NULL);
|
| + syncer::BOOKMARKS, NULL);
|
| }
|
|
|
| // We encrypt with new keys, triggering the local cryptographer to be unready
|
| @@ -806,9 +803,9 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) {
|
| sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
|
| other_cryptographer.GetKeys(nigori->mutable_encrypted());
|
| nigori->set_encrypt_bookmarks(true);
|
| - encrypted_types.Put(syncable::BOOKMARKS);
|
| + encrypted_types.Put(syncer::BOOKMARKS);
|
| entry_factory_->CreateUnappliedNewItem(
|
| - syncable::ModelTypeToRootTag(syncable::NIGORI), specifics, true);
|
| + syncer::ModelTypeToRootTag(syncer::NIGORI), specifics, true);
|
| EXPECT_FALSE(cryptographer->has_pending_keys());
|
|
|
| {
|
| @@ -846,7 +843,7 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) {
|
| // cryptographer should be updated.
|
| EXPECT_FALSE(VerifyUnsyncedChangesAreEncrypted(&trans, encrypted_types));
|
| EXPECT_TRUE(cryptographer->GetEncryptedTypes().Equals(
|
| - syncable::ModelTypeSet().All()));
|
| + syncer::ModelTypeSet().All()));
|
| EXPECT_FALSE(cryptographer->is_ready());
|
| EXPECT_TRUE(cryptographer->has_pending_keys());
|
|
|
|
|