| Index: sync/internal_api/syncapi_unittest.cc
|
| diff --git a/sync/internal_api/syncapi_unittest.cc b/sync/internal_api/syncapi_unittest.cc
|
| index 3fd67a66c4285c5169002d764f55fed45c15336e..f5eb675e17e30bf054dab6918b9fadbfac026a06 100644
|
| --- a/sync/internal_api/syncapi_unittest.cc
|
| +++ b/sync/internal_api/syncapi_unittest.cc
|
| @@ -109,7 +109,7 @@ void ExpectTimeValue(const base::Time& expected_value,
|
| const DictionaryValue& value, const std::string& key) {
|
| std::string time_str;
|
| EXPECT_TRUE(value.GetString(key, &time_str));
|
| - EXPECT_EQ(syncer::GetTimeDebugString(expected_value), time_str);
|
| + EXPECT_EQ(GetTimeDebugString(expected_value), time_str);
|
| }
|
|
|
| // Makes a non-folder child of the root node. Returns the id of the
|
| @@ -121,9 +121,9 @@ int64 MakeNode(UserShare* share,
|
| ReadNode root_node(&trans);
|
| root_node.InitByRootLookup();
|
| WriteNode node(&trans);
|
| - syncer::WriteNode::InitUniqueByCreationResult result =
|
| + WriteNode::InitUniqueByCreationResult result =
|
| node.InitUniqueByCreation(model_type, root_node, client_tag);
|
| - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
|
| + EXPECT_EQ(WriteNode::INIT_SUCCESS, result);
|
| node.SetIsFolder(false);
|
| return node.GetId();
|
| }
|
| @@ -138,9 +138,9 @@ int64 MakeNodeWithParent(UserShare* share,
|
| ReadNode parent_node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK, parent_node.InitByIdLookup(parent_id));
|
| WriteNode node(&trans);
|
| - syncer::WriteNode::InitUniqueByCreationResult result =
|
| + WriteNode::InitUniqueByCreationResult result =
|
| node.InitUniqueByCreation(model_type, parent_node, client_tag);
|
| - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
|
| + EXPECT_EQ(WriteNode::INIT_SUCCESS, result);
|
| node.SetIsFolder(false);
|
| return node.GetId();
|
| }
|
| @@ -166,11 +166,11 @@ int64 MakeFolderWithParent(UserShare* share,
|
| int64 MakeServerNodeForType(UserShare* share,
|
| ModelType model_type) {
|
| sync_pb::EntitySpecifics specifics;
|
| - syncer::AddDefaultFieldValue(model_type, &specifics);
|
| + AddDefaultFieldValue(model_type, &specifics);
|
| syncable::WriteTransaction trans(
|
| FROM_HERE, syncable::UNITTEST, share->directory.get());
|
| // Attempt to lookup by nigori tag.
|
| - std::string type_tag = syncer::ModelTypeToRootTag(model_type);
|
| + std::string type_tag = ModelTypeToRootTag(model_type);
|
| syncable::Id node_id = syncable::Id::CreateFromServerId(type_tag);
|
| syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM,
|
| node_id);
|
| @@ -197,7 +197,7 @@ int64 MakeServerNode(UserShare* share, ModelType model_type,
|
| syncable::WriteTransaction trans(
|
| FROM_HERE, syncable::UNITTEST, share->directory.get());
|
| syncable::Entry root_entry(&trans, syncable::GET_BY_SERVER_TAG,
|
| - syncer::ModelTypeToRootTag(model_type));
|
| + ModelTypeToRootTag(model_type));
|
| EXPECT_TRUE(root_entry.good());
|
| syncable::Id root_id = root_entry.Get(syncable::ID);
|
| syncable::Id node_id = syncable::Id::CreateFromServerId(client_tag);
|
| @@ -233,7 +233,7 @@ class SyncApiTest : public testing::Test {
|
|
|
| protected:
|
| MessageLoop message_loop_;
|
| - syncer::TestUserShare test_user_share_;
|
| + TestUserShare test_user_share_;
|
| };
|
|
|
| TEST_F(SyncApiTest, SanityCheckTest) {
|
| @@ -263,13 +263,13 @@ TEST_F(SyncApiTest, BasicTagWrite) {
|
| }
|
|
|
| ignore_result(MakeNode(test_user_share_.user_share(),
|
| - syncer::BOOKMARKS, "testtag"));
|
| + BOOKMARKS, "testtag"));
|
|
|
| {
|
| ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
|
| ReadNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, "testtag"));
|
| + node.InitByClientTagLookup(BOOKMARKS, "testtag"));
|
|
|
| ReadNode root_node(&trans);
|
| root_node.InitByRootLookup();
|
| @@ -280,18 +280,18 @@ TEST_F(SyncApiTest, BasicTagWrite) {
|
|
|
| TEST_F(SyncApiTest, GenerateSyncableHash) {
|
| EXPECT_EQ("OyaXV5mEzrPS4wbogmtKvRfekAI=",
|
| - BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, "tag1"));
|
| + BaseNode::GenerateSyncableHash(BOOKMARKS, "tag1"));
|
| EXPECT_EQ("iNFQtRFQb+IZcn1kKUJEZDDkLs4=",
|
| - BaseNode::GenerateSyncableHash(syncer::PREFERENCES, "tag1"));
|
| + BaseNode::GenerateSyncableHash(PREFERENCES, "tag1"));
|
| EXPECT_EQ("gO1cPZQXaM73sHOvSA+tKCKFs58=",
|
| - BaseNode::GenerateSyncableHash(syncer::AUTOFILL, "tag1"));
|
| + BaseNode::GenerateSyncableHash(AUTOFILL, "tag1"));
|
|
|
| EXPECT_EQ("A0eYIHXM1/jVwKDDp12Up20IkKY=",
|
| - BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, "tag2"));
|
| + BaseNode::GenerateSyncableHash(BOOKMARKS, "tag2"));
|
| EXPECT_EQ("XYxkF7bhS4eItStFgiOIAU23swI=",
|
| - BaseNode::GenerateSyncableHash(syncer::PREFERENCES, "tag2"));
|
| + BaseNode::GenerateSyncableHash(PREFERENCES, "tag2"));
|
| EXPECT_EQ("GFiWzo5NGhjLlN+OyCfhy28DJTQ=",
|
| - BaseNode::GenerateSyncableHash(syncer::AUTOFILL, "tag2"));
|
| + BaseNode::GenerateSyncableHash(AUTOFILL, "tag2"));
|
| }
|
|
|
| TEST_F(SyncApiTest, ModelTypesSiloed) {
|
| @@ -303,28 +303,28 @@ TEST_F(SyncApiTest, ModelTypesSiloed) {
|
| }
|
|
|
| ignore_result(MakeNode(test_user_share_.user_share(),
|
| - syncer::BOOKMARKS, "collideme"));
|
| + BOOKMARKS, "collideme"));
|
| ignore_result(MakeNode(test_user_share_.user_share(),
|
| - syncer::PREFERENCES, "collideme"));
|
| + PREFERENCES, "collideme"));
|
| ignore_result(MakeNode(test_user_share_.user_share(),
|
| - syncer::AUTOFILL, "collideme"));
|
| + AUTOFILL, "collideme"));
|
|
|
| {
|
| ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
|
|
|
| ReadNode bookmarknode(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - bookmarknode.InitByClientTagLookup(syncer::BOOKMARKS,
|
| + bookmarknode.InitByClientTagLookup(BOOKMARKS,
|
| "collideme"));
|
|
|
| ReadNode prefnode(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - prefnode.InitByClientTagLookup(syncer::PREFERENCES,
|
| + prefnode.InitByClientTagLookup(PREFERENCES,
|
| "collideme"));
|
|
|
| ReadNode autofillnode(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - autofillnode.InitByClientTagLookup(syncer::AUTOFILL,
|
| + autofillnode.InitByClientTagLookup(AUTOFILL,
|
| "collideme"));
|
|
|
| EXPECT_NE(bookmarknode.GetId(), prefnode.GetId());
|
| @@ -338,14 +338,14 @@ TEST_F(SyncApiTest, ReadMissingTagsFails) {
|
| ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
|
| ReadNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_NOT_GOOD,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS,
|
| + node.InitByClientTagLookup(BOOKMARKS,
|
| "testtag"));
|
| }
|
| {
|
| WriteTransaction trans(FROM_HERE, test_user_share_.user_share());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_NOT_GOOD,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS,
|
| + node.InitByClientTagLookup(BOOKMARKS,
|
| "testtag"));
|
| }
|
| }
|
| @@ -364,14 +364,14 @@ TEST_F(SyncApiTest, TestDeleteBehavior) {
|
|
|
| // we'll use this spare folder later
|
| WriteNode folder_node(&trans);
|
| - EXPECT_TRUE(folder_node.InitByCreation(syncer::BOOKMARKS,
|
| + EXPECT_TRUE(folder_node.InitByCreation(BOOKMARKS,
|
| root_node, NULL));
|
| folder_id = folder_node.GetId();
|
|
|
| WriteNode wnode(&trans);
|
| - syncer::WriteNode::InitUniqueByCreationResult result =
|
| - wnode.InitUniqueByCreation(syncer::BOOKMARKS, root_node, "testtag");
|
| - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
|
| + WriteNode::InitUniqueByCreationResult result =
|
| + wnode.InitUniqueByCreation(BOOKMARKS, root_node, "testtag");
|
| + EXPECT_EQ(WriteNode::INIT_SUCCESS, result);
|
| wnode.SetIsFolder(false);
|
| wnode.SetTitle(UTF8ToWide(test_title));
|
|
|
| @@ -383,7 +383,7 @@ TEST_F(SyncApiTest, TestDeleteBehavior) {
|
| WriteTransaction trans(FROM_HERE, test_user_share_.user_share());
|
| WriteNode wnode(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - wnode.InitByClientTagLookup(syncer::BOOKMARKS,
|
| + wnode.InitByClientTagLookup(BOOKMARKS,
|
| "testtag"));
|
| EXPECT_FALSE(wnode.GetIsFolder());
|
| EXPECT_EQ(wnode.GetTitle(), test_title);
|
| @@ -397,7 +397,7 @@ TEST_F(SyncApiTest, TestDeleteBehavior) {
|
| ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
|
| ReadNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_IS_DEL,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS,
|
| + node.InitByClientTagLookup(BOOKMARKS,
|
| "testtag"));
|
| // Note that for proper function of this API this doesn't need to be
|
| // filled, we're checking just to make sure the DB worked in this test.
|
| @@ -411,9 +411,9 @@ TEST_F(SyncApiTest, TestDeleteBehavior) {
|
|
|
| WriteNode wnode(&trans);
|
| // This will undelete the tag.
|
| - syncer::WriteNode::InitUniqueByCreationResult result =
|
| - wnode.InitUniqueByCreation(syncer::BOOKMARKS, folder_node, "testtag");
|
| - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
|
| + WriteNode::InitUniqueByCreationResult result =
|
| + wnode.InitUniqueByCreation(BOOKMARKS, folder_node, "testtag");
|
| + EXPECT_EQ(WriteNode::INIT_SUCCESS, result);
|
| EXPECT_EQ(wnode.GetIsFolder(), false);
|
| EXPECT_EQ(wnode.GetParentId(), folder_node.GetId());
|
| EXPECT_EQ(wnode.GetId(), node_id);
|
| @@ -426,10 +426,10 @@ TEST_F(SyncApiTest, TestDeleteBehavior) {
|
| ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
|
| ReadNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS,
|
| + node.InitByClientTagLookup(BOOKMARKS,
|
| "testtag"));
|
| EXPECT_EQ(node.GetTitle(), test_title);
|
| - EXPECT_EQ(node.GetModelType(), syncer::BOOKMARKS);
|
| + EXPECT_EQ(node.GetModelType(), BOOKMARKS);
|
| }
|
| }
|
|
|
| @@ -445,10 +445,10 @@ TEST_F(SyncApiTest, WriteAndReadPassword) {
|
| root_node.InitByRootLookup();
|
|
|
| WriteNode password_node(&trans);
|
| - syncer::WriteNode::InitUniqueByCreationResult result =
|
| - password_node.InitUniqueByCreation(syncer::PASSWORDS,
|
| + WriteNode::InitUniqueByCreationResult result =
|
| + password_node.InitUniqueByCreation(PASSWORDS,
|
| root_node, "foo");
|
| - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
|
| + EXPECT_EQ(WriteNode::INIT_SUCCESS, result);
|
| sync_pb::PasswordSpecificsData data;
|
| data.set_password_value("secret");
|
| password_node.SetPasswordSpecifics(data);
|
| @@ -460,8 +460,7 @@ TEST_F(SyncApiTest, WriteAndReadPassword) {
|
|
|
| ReadNode password_node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - password_node.InitByClientTagLookup(syncer::PASSWORDS,
|
| - "foo"));
|
| + password_node.InitByClientTagLookup(PASSWORDS, "foo"));
|
| const sync_pb::PasswordSpecificsData& data =
|
| password_node.GetPasswordSpecifics();
|
| EXPECT_EQ("secret", data.password_value());
|
| @@ -481,16 +480,16 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) {
|
| root_node.InitByRootLookup();
|
|
|
| WriteNode bookmark_node(&trans);
|
| - syncer::WriteNode::InitUniqueByCreationResult result =
|
| - bookmark_node.InitUniqueByCreation(syncer::BOOKMARKS,
|
| + WriteNode::InitUniqueByCreationResult result =
|
| + bookmark_node.InitUniqueByCreation(BOOKMARKS,
|
| root_node, "foo");
|
| - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
|
| + EXPECT_EQ(WriteNode::INIT_SUCCESS, result);
|
| bookmark_node.SetTitle(UTF8ToWide("foo"));
|
|
|
| WriteNode pref_node(&trans);
|
| result =
|
| - pref_node.InitUniqueByCreation(syncer::PREFERENCES, root_node, "bar");
|
| - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
|
| + pref_node.InitUniqueByCreation(PREFERENCES, root_node, "bar");
|
| + EXPECT_EQ(WriteNode::INIT_SUCCESS, result);
|
| pref_node.SetTitle(UTF8ToWide("bar"));
|
| }
|
| {
|
| @@ -500,7 +499,7 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) {
|
|
|
| ReadNode bookmark_node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - bookmark_node.InitByClientTagLookup(syncer::BOOKMARKS,
|
| + bookmark_node.InitByClientTagLookup(BOOKMARKS,
|
| "foo"));
|
| EXPECT_EQ("foo", bookmark_node.GetTitle());
|
| EXPECT_EQ(kEncryptedString,
|
| @@ -508,7 +507,7 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) {
|
|
|
| ReadNode pref_node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - pref_node.InitByClientTagLookup(syncer::PREFERENCES,
|
| + pref_node.InitByClientTagLookup(PREFERENCES,
|
| "bar"));
|
| EXPECT_EQ(kEncryptedString, pref_node.GetTitle());
|
| }
|
| @@ -516,7 +515,7 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) {
|
|
|
| TEST_F(SyncApiTest, BaseNodeSetSpecifics) {
|
| int64 child_id = MakeNode(test_user_share_.user_share(),
|
| - syncer::BOOKMARKS, "testtag");
|
| + BOOKMARKS, "testtag");
|
| WriteTransaction trans(FROM_HERE, test_user_share_.user_share());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(child_id));
|
| @@ -533,7 +532,7 @@ TEST_F(SyncApiTest, BaseNodeSetSpecifics) {
|
|
|
| TEST_F(SyncApiTest, BaseNodeSetSpecificsPreservesUnknownFields) {
|
| int64 child_id = MakeNode(test_user_share_.user_share(),
|
| - syncer::BOOKMARKS, "testtag");
|
| + BOOKMARKS, "testtag");
|
| WriteTransaction trans(FROM_HERE, test_user_share_.user_share());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(child_id));
|
| @@ -565,12 +564,12 @@ void CheckNodeValue(const BaseNode& node, const DictionaryValue& value,
|
| ModelType expected_model_type = node.GetModelType();
|
| std::string type_str;
|
| EXPECT_TRUE(value.GetString("type", &type_str));
|
| - if (expected_model_type >= syncer::FIRST_REAL_MODEL_TYPE) {
|
| - ModelType model_type = syncer::ModelTypeFromString(type_str);
|
| + if (expected_model_type >= FIRST_REAL_MODEL_TYPE) {
|
| + ModelType model_type = ModelTypeFromString(type_str);
|
| EXPECT_EQ(expected_model_type, model_type);
|
| - } else if (expected_model_type == syncer::TOP_LEVEL_FOLDER) {
|
| + } else if (expected_model_type == TOP_LEVEL_FOLDER) {
|
| EXPECT_EQ("Top-level folder", type_str);
|
| - } else if (expected_model_type == syncer::UNSPECIFIED) {
|
| + } else if (expected_model_type == UNSPECIFIED) {
|
| EXPECT_EQ("Unspecified", type_str);
|
| } else {
|
| ADD_FAILURE();
|
| @@ -627,9 +626,9 @@ TEST_F(SyncApiTest, EmptyTags) {
|
| root_node.InitByRootLookup();
|
| WriteNode node(&trans);
|
| std::string empty_tag;
|
| - syncer::WriteNode::InitUniqueByCreationResult result =
|
| - node.InitUniqueByCreation(syncer::TYPED_URLS, root_node, empty_tag);
|
| - EXPECT_NE(syncer::WriteNode::INIT_SUCCESS, result);
|
| + WriteNode::InitUniqueByCreationResult result =
|
| + node.InitUniqueByCreation(TYPED_URLS, root_node, empty_tag);
|
| + EXPECT_NE(WriteNode::INIT_SUCCESS, result);
|
| EXPECT_EQ(BaseNode::INIT_FAILED_PRECONDITION,
|
| node.InitByTagLookup(empty_tag));
|
| }
|
| @@ -681,7 +680,7 @@ class SyncManagerObserverMock : public SyncManager::Observer {
|
| void(const WeakHandle<JsBackend>&, bool)); // NOLINT
|
| MOCK_METHOD1(OnConnectionStatusChange, void(ConnectionStatus)); // NOLINT
|
| MOCK_METHOD2(OnPassphraseRequired,
|
| - void(syncer::PassphraseRequiredReason,
|
| + void(PassphraseRequiredReason,
|
| const sync_pb::EncryptedData&)); // NOLINT
|
| MOCK_METHOD0(OnPassphraseAccepted, void()); // NOLINT
|
| MOCK_METHOD1(OnBootstrapTokenUpdated, void(const std::string&)); // NOLINT
|
| @@ -691,20 +690,20 @@ class SyncManagerObserverMock : public SyncManager::Observer {
|
| void(ModelTypeSet, bool)); // NOLINT
|
| MOCK_METHOD0(OnEncryptionComplete, void()); // NOLINT
|
| MOCK_METHOD1(OnActionableError,
|
| - void(const syncer::SyncProtocolError&)); // NOLINT
|
| + void(const SyncProtocolError&)); // NOLINT
|
| };
|
|
|
| -class SyncNotifierMock : public syncer::SyncNotifier {
|
| +class SyncNotifierMock : public SyncNotifier {
|
| public:
|
| - MOCK_METHOD1(AddObserver, void(syncer::SyncNotifierObserver*));
|
| - MOCK_METHOD1(RemoveObserver, void(syncer::SyncNotifierObserver*));
|
| + MOCK_METHOD1(AddObserver, void(SyncNotifierObserver*));
|
| + MOCK_METHOD1(RemoveObserver, void(SyncNotifierObserver*));
|
| MOCK_METHOD1(SetUniqueId, void(const std::string&));
|
| MOCK_METHOD1(SetStateDeprecated, void(const std::string&));
|
| MOCK_METHOD2(UpdateCredentials,
|
| void(const std::string&, const std::string&));
|
| MOCK_METHOD1(UpdateEnabledTypes,
|
| - void(syncer::ModelTypeSet));
|
| - MOCK_METHOD1(SendNotification, void(syncer::ModelTypeSet));
|
| + void(ModelTypeSet));
|
| + MOCK_METHOD1(SendNotification, void(ModelTypeSet));
|
| };
|
|
|
| } // namespace
|
| @@ -804,29 +803,29 @@ class SyncManagerTest : public testing::Test,
|
| }
|
|
|
| void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) {
|
| - (*out)[syncer::NIGORI] = syncer::GROUP_PASSIVE;
|
| - (*out)[syncer::BOOKMARKS] = syncer::GROUP_PASSIVE;
|
| - (*out)[syncer::THEMES] = syncer::GROUP_PASSIVE;
|
| - (*out)[syncer::SESSIONS] = syncer::GROUP_PASSIVE;
|
| - (*out)[syncer::PASSWORDS] = syncer::GROUP_PASSIVE;
|
| - (*out)[syncer::PREFERENCES] = syncer::GROUP_PASSIVE;
|
| + (*out)[NIGORI] = GROUP_PASSIVE;
|
| + (*out)[BOOKMARKS] = GROUP_PASSIVE;
|
| + (*out)[THEMES] = GROUP_PASSIVE;
|
| + (*out)[SESSIONS] = GROUP_PASSIVE;
|
| + (*out)[PASSWORDS] = GROUP_PASSIVE;
|
| + (*out)[PREFERENCES] = GROUP_PASSIVE;
|
| }
|
|
|
| virtual void OnChangesApplied(
|
| - syncer::ModelType model_type,
|
| + ModelType model_type,
|
| const BaseTransaction* trans,
|
| const ImmutableChangeRecordList& changes) OVERRIDE {}
|
|
|
| - virtual void OnChangesComplete(syncer::ModelType model_type) OVERRIDE {}
|
| + virtual void OnChangesComplete(ModelType model_type) OVERRIDE {}
|
|
|
| // Helper methods.
|
| bool SetUpEncryption(NigoriStatus nigori_status,
|
| EncryptionStatus encryption_status) {
|
| UserShare* share = sync_manager_.GetUserShare();
|
| - share->directory->set_initial_sync_ended_for_type(syncer::NIGORI, true);
|
| + share->directory->set_initial_sync_ended_for_type(NIGORI, true);
|
|
|
| // We need to create the nigori node as if it were an applied server update.
|
| - int64 nigori_id = GetIdForDataType(syncer::NIGORI);
|
| + int64 nigori_id = GetIdForDataType(NIGORI);
|
| if (nigori_id == kInvalidId)
|
| return false;
|
|
|
| @@ -861,21 +860,21 @@ class SyncManagerTest : public testing::Test,
|
| }
|
|
|
| void SyncNotifierAddObserver(
|
| - syncer::SyncNotifierObserver* sync_notifier_observer) {
|
| + SyncNotifierObserver* sync_notifier_observer) {
|
| EXPECT_EQ(NULL, sync_notifier_observer_);
|
| sync_notifier_observer_ = sync_notifier_observer;
|
| }
|
|
|
| void SyncNotifierRemoveObserver(
|
| - syncer::SyncNotifierObserver* sync_notifier_observer) {
|
| + SyncNotifierObserver* sync_notifier_observer) {
|
| EXPECT_EQ(sync_notifier_observer_, sync_notifier_observer);
|
| sync_notifier_observer_ = NULL;
|
| }
|
|
|
| - void SyncNotifierUpdateEnabledTypes(syncer::ModelTypeSet types) {
|
| + void SyncNotifierUpdateEnabledTypes(ModelTypeSet types) {
|
| ModelSafeRoutingInfo routes;
|
| GetModelSafeRoutingInfo(&routes);
|
| - const syncer::ModelTypeSet expected_types = GetRoutingInfoTypes(routes);
|
| + const ModelTypeSet expected_types = GetRoutingInfoTypes(routes);
|
| EXPECT_TRUE(types.Equals(expected_types));
|
| ++update_enabled_types_call_count_;
|
| }
|
| @@ -900,7 +899,7 @@ class SyncManagerTest : public testing::Test,
|
| // Looks up an entry by client tag and resets IS_UNSYNCED value to false.
|
| // Returns true if entry was previously unsynced, false if IS_UNSYNCED was
|
| // already false.
|
| - bool ResetUnsyncedEntry(syncer::ModelType type,
|
| + bool ResetUnsyncedEntry(ModelType type,
|
| const std::string& client_tag) {
|
| UserShare* share = sync_manager_.GetUserShare();
|
| syncable::WriteTransaction trans(
|
| @@ -936,7 +935,7 @@ class SyncManagerTest : public testing::Test,
|
| SyncManagerImpl sync_manager_;
|
| WeakHandle<JsBackend> js_backend_;
|
| StrictMock<SyncManagerObserverMock> observer_;
|
| - syncer::SyncNotifierObserver* sync_notifier_observer_;
|
| + SyncNotifierObserver* sync_notifier_observer_;
|
| int update_enabled_types_call_count_;
|
| };
|
|
|
| @@ -945,7 +944,7 @@ TEST_F(SyncManagerTest, UpdateEnabledTypes) {
|
|
|
| ModelSafeRoutingInfo routes;
|
| GetModelSafeRoutingInfo(&routes);
|
| - const syncer::ModelTypeSet enabled_types = GetRoutingInfoTypes(routes);
|
| + const ModelTypeSet enabled_types = GetRoutingInfoTypes(routes);
|
|
|
| sync_manager_.UpdateEnabledTypes(enabled_types);
|
| EXPECT_EQ(1, update_enabled_types_call_count_);
|
| @@ -1027,7 +1026,7 @@ class SyncManagerGetNodesByIdTest : public SyncManagerTest {
|
| }
|
|
|
| int64 child_id =
|
| - MakeNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, "testtag");
|
| + MakeNode(sync_manager_.GetUserShare(), BOOKMARKS, "testtag");
|
|
|
| StrictMock<MockJsReplyHandler> reply_handler;
|
|
|
| @@ -1258,17 +1257,17 @@ TEST_F(SyncManagerTest, OnNotificationStateChange) {
|
|
|
| sync_manager_.SimulateEnableNotificationsForTest();
|
| sync_manager_.SimulateDisableNotificationsForTest(
|
| - syncer::TRANSIENT_NOTIFICATION_ERROR);
|
| + TRANSIENT_NOTIFICATION_ERROR);
|
|
|
| SetJsEventHandler(event_handler.AsWeakHandle());
|
| sync_manager_.SimulateEnableNotificationsForTest();
|
| sync_manager_.SimulateDisableNotificationsForTest(
|
| - syncer::TRANSIENT_NOTIFICATION_ERROR);
|
| + TRANSIENT_NOTIFICATION_ERROR);
|
| SetJsEventHandler(WeakHandle<JsEventHandler>());
|
|
|
| sync_manager_.SimulateEnableNotificationsForTest();
|
| sync_manager_.SimulateDisableNotificationsForTest(
|
| - syncer::TRANSIENT_NOTIFICATION_ERROR);
|
| + TRANSIENT_NOTIFICATION_ERROR);
|
|
|
| // Should trigger the replies.
|
| PumpLoop();
|
| @@ -1277,9 +1276,9 @@ TEST_F(SyncManagerTest, OnNotificationStateChange) {
|
| TEST_F(SyncManagerTest, OnIncomingNotification) {
|
| StrictMock<MockJsEventHandler> event_handler;
|
|
|
| - const syncer::ModelTypeSet empty_model_types;
|
| - const syncer::ModelTypeSet model_types(
|
| - syncer::BOOKMARKS, syncer::THEMES);
|
| + const ModelTypeSet empty_model_types;
|
| + const ModelTypeSet model_types(
|
| + BOOKMARKS, THEMES);
|
|
|
| // Build expected_args to have a single argument with the string
|
| // equivalents of model_types.
|
| @@ -1288,10 +1287,10 @@ TEST_F(SyncManagerTest, OnIncomingNotification) {
|
| ListValue* model_type_list = new ListValue();
|
| expected_details.SetString("source", "REMOTE_NOTIFICATION");
|
| expected_details.Set("changedTypes", model_type_list);
|
| - for (syncer::ModelTypeSet::Iterator it = model_types.First();
|
| + for (ModelTypeSet::Iterator it = model_types.First();
|
| it.Good(); it.Inc()) {
|
| model_type_list->Append(
|
| - Value::CreateStringValue(syncer::ModelTypeToString(it.Get())));
|
| + Value::CreateStringValue(ModelTypeToString(it.Get())));
|
| }
|
| }
|
|
|
| @@ -1320,15 +1319,15 @@ TEST_F(SyncManagerTest, RefreshEncryptionReady) {
|
| sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing));
|
| PumpLoop();
|
|
|
| - const syncer::ModelTypeSet encrypted_types =
|
| + const ModelTypeSet encrypted_types =
|
| sync_manager_.GetEncryptedDataTypesForTest();
|
| - EXPECT_TRUE(encrypted_types.Has(syncer::PASSWORDS));
|
| + EXPECT_TRUE(encrypted_types.Has(PASSWORDS));
|
| EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest());
|
| {
|
| ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| ReadNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByIdLookup(GetIdForDataType(syncer::NIGORI)));
|
| + node.InitByIdLookup(GetIdForDataType(NIGORI)));
|
| sync_pb::NigoriSpecifics nigori = node.GetNigoriSpecifics();
|
| EXPECT_TRUE(nigori.has_encrypted());
|
| Cryptographer* cryptographer = trans.GetCryptographer();
|
| @@ -1345,9 +1344,9 @@ TEST_F(SyncManagerTest, RefreshEncryptionNotReady) {
|
| sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing));
|
| PumpLoop();
|
|
|
| - const syncer::ModelTypeSet encrypted_types =
|
| + const ModelTypeSet encrypted_types =
|
| sync_manager_.GetEncryptedDataTypesForTest();
|
| - EXPECT_TRUE(encrypted_types.Has(syncer::PASSWORDS)); // Hardcoded.
|
| + EXPECT_TRUE(encrypted_types.Has(PASSWORDS)); // Hardcoded.
|
| EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest());
|
| }
|
|
|
| @@ -1360,15 +1359,15 @@ TEST_F(SyncManagerTest, RefreshEncryptionEmptyNigori) {
|
| sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing));
|
| PumpLoop();
|
|
|
| - const syncer::ModelTypeSet encrypted_types =
|
| + const ModelTypeSet encrypted_types =
|
| sync_manager_.GetEncryptedDataTypesForTest();
|
| - EXPECT_TRUE(encrypted_types.Has(syncer::PASSWORDS)); // Hardcoded.
|
| + EXPECT_TRUE(encrypted_types.Has(PASSWORDS)); // Hardcoded.
|
| EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest());
|
| {
|
| ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| ReadNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByIdLookup(GetIdForDataType(syncer::NIGORI)));
|
| + node.InitByIdLookup(GetIdForDataType(NIGORI)));
|
| sync_pb::NigoriSpecifics nigori = node.GetNigoriSpecifics();
|
| EXPECT_TRUE(nigori.has_encrypted());
|
| Cryptographer* cryptographer = trans.GetCryptographer();
|
| @@ -1381,7 +1380,7 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithNoData) {
|
| EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION));
|
| EXPECT_CALL(observer_,
|
| OnEncryptedTypesChanged(
|
| - HasModelTypes(syncer::ModelTypeSet::All()), true));
|
| + HasModelTypes(ModelTypeSet::All()), true));
|
| EXPECT_CALL(observer_, OnEncryptionComplete());
|
| sync_manager_.EnableEncryptEverything();
|
| EXPECT_TRUE(sync_manager_.EncryptEverythingEnabledForTest());
|
| @@ -1393,26 +1392,26 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) {
|
|
|
| // Create some unencrypted unsynced data.
|
| int64 folder = MakeFolderWithParent(sync_manager_.GetUserShare(),
|
| - syncer::BOOKMARKS,
|
| - GetIdForDataType(syncer::BOOKMARKS),
|
| + BOOKMARKS,
|
| + GetIdForDataType(BOOKMARKS),
|
| NULL);
|
| // First batch_size nodes are children of folder.
|
| size_t i;
|
| for (i = 0; i < batch_size; ++i) {
|
| - MakeNodeWithParent(sync_manager_.GetUserShare(), syncer::BOOKMARKS,
|
| + MakeNodeWithParent(sync_manager_.GetUserShare(), BOOKMARKS,
|
| base::StringPrintf("%"PRIuS"", i), folder);
|
| }
|
| // Next batch_size nodes are a different type and on their own.
|
| for (; i < 2*batch_size; ++i) {
|
| - MakeNodeWithParent(sync_manager_.GetUserShare(), syncer::SESSIONS,
|
| + MakeNodeWithParent(sync_manager_.GetUserShare(), SESSIONS,
|
| base::StringPrintf("%"PRIuS"", i),
|
| - GetIdForDataType(syncer::SESSIONS));
|
| + GetIdForDataType(SESSIONS));
|
| }
|
| // Last batch_size nodes are a third type that will not need encryption.
|
| for (; i < 3*batch_size; ++i) {
|
| - MakeNodeWithParent(sync_manager_.GetUserShare(), syncer::THEMES,
|
| + MakeNodeWithParent(sync_manager_.GetUserShare(), THEMES,
|
| base::StringPrintf("%"PRIuS"", i),
|
| - GetIdForDataType(syncer::THEMES));
|
| + GetIdForDataType(THEMES));
|
| }
|
|
|
| {
|
| @@ -1422,44 +1421,44 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) {
|
| EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
|
| trans.GetWrappedTrans(),
|
| trans.GetCryptographer(),
|
| - syncer::BOOKMARKS,
|
| + BOOKMARKS,
|
| false /* not encrypted */));
|
| EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
|
| trans.GetWrappedTrans(),
|
| trans.GetCryptographer(),
|
| - syncer::SESSIONS,
|
| + SESSIONS,
|
| false /* not encrypted */));
|
| EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
|
| trans.GetWrappedTrans(),
|
| trans.GetCryptographer(),
|
| - syncer::THEMES,
|
| + THEMES,
|
| false /* not encrypted */));
|
| }
|
|
|
| EXPECT_CALL(observer_,
|
| OnEncryptedTypesChanged(
|
| - HasModelTypes(syncer::ModelTypeSet::All()), true));
|
| + HasModelTypes(ModelTypeSet::All()), true));
|
| EXPECT_CALL(observer_, OnEncryptionComplete());
|
| sync_manager_.EnableEncryptEverything();
|
| EXPECT_TRUE(sync_manager_.EncryptEverythingEnabledForTest());
|
| {
|
| ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| EXPECT_TRUE(GetEncryptedTypes(&trans).Equals(
|
| - syncer::ModelTypeSet::All()));
|
| + ModelTypeSet::All()));
|
| EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
|
| trans.GetWrappedTrans(),
|
| trans.GetCryptographer(),
|
| - syncer::BOOKMARKS,
|
| + BOOKMARKS,
|
| true /* is encrypted */));
|
| EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
|
| trans.GetWrappedTrans(),
|
| trans.GetCryptographer(),
|
| - syncer::SESSIONS,
|
| + SESSIONS,
|
| true /* is encrypted */));
|
| EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
|
| trans.GetWrappedTrans(),
|
| trans.GetCryptographer(),
|
| - syncer::THEMES,
|
| + THEMES,
|
| true /* is encrypted */));
|
| }
|
|
|
| @@ -1472,21 +1471,21 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) {
|
| EXPECT_TRUE(sync_manager_.EncryptEverythingEnabledForTest());
|
| {
|
| ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| - EXPECT_TRUE(GetEncryptedTypes(&trans).Equals(syncer::ModelTypeSet::All()));
|
| + EXPECT_TRUE(GetEncryptedTypes(&trans).Equals(ModelTypeSet::All()));
|
| EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
|
| trans.GetWrappedTrans(),
|
| trans.GetCryptographer(),
|
| - syncer::BOOKMARKS,
|
| + BOOKMARKS,
|
| true /* is encrypted */));
|
| EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
|
| trans.GetWrappedTrans(),
|
| trans.GetCryptographer(),
|
| - syncer::SESSIONS,
|
| + SESSIONS,
|
| true /* is encrypted */));
|
| EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
|
| trans.GetWrappedTrans(),
|
| trans.GetCryptographer(),
|
| - syncer::THEMES,
|
| + THEMES,
|
| true /* is encrypted */));
|
| }
|
| // Calling EncryptDataTypes with an empty encrypted types should not trigger
|
| @@ -1567,10 +1566,10 @@ TEST_F(SyncManagerTest, SetPassphraseWithPassword) {
|
| root_node.InitByRootLookup();
|
|
|
| WriteNode password_node(&trans);
|
| - syncer::WriteNode::InitUniqueByCreationResult result =
|
| - password_node.InitUniqueByCreation(syncer::PASSWORDS,
|
| + WriteNode::InitUniqueByCreationResult result =
|
| + password_node.InitUniqueByCreation(PASSWORDS,
|
| root_node, "foo");
|
| - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
|
| + EXPECT_EQ(WriteNode::INIT_SUCCESS, result);
|
| sync_pb::PasswordSpecificsData data;
|
| data.set_password_value("secret");
|
| password_node.SetPasswordSpecifics(data);
|
| @@ -1591,7 +1590,7 @@ TEST_F(SyncManagerTest, SetPassphraseWithPassword) {
|
|
|
| ReadNode password_node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - password_node.InitByClientTagLookup(syncer::PASSWORDS,
|
| + password_node.InitByClientTagLookup(PASSWORDS,
|
| "foo"));
|
| const sync_pb::PasswordSpecificsData& data =
|
| password_node.GetPasswordSpecifics();
|
| @@ -1801,9 +1800,9 @@ TEST_F(SyncManagerTest, SetPassphraseWithEmptyPasswordNode) {
|
| root_node.InitByRootLookup();
|
|
|
| WriteNode password_node(&trans);
|
| - syncer::WriteNode::InitUniqueByCreationResult result =
|
| - password_node.InitUniqueByCreation(syncer::PASSWORDS, root_node, tag);
|
| - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
|
| + WriteNode::InitUniqueByCreationResult result =
|
| + password_node.InitUniqueByCreation(PASSWORDS, root_node, tag);
|
| + EXPECT_EQ(WriteNode::INIT_SUCCESS, result);
|
| node_id = password_node.GetId();
|
| }
|
| EXPECT_CALL(observer_, OnBootstrapTokenUpdated(_));
|
| @@ -1815,7 +1814,7 @@ TEST_F(SyncManagerTest, SetPassphraseWithEmptyPasswordNode) {
|
| ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| ReadNode password_node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_FAILED_DECRYPT_IF_NECESSARY,
|
| - password_node.InitByClientTagLookup(syncer::PASSWORDS,
|
| + password_node.InitByClientTagLookup(PASSWORDS,
|
| tag));
|
| }
|
| {
|
| @@ -1827,15 +1826,15 @@ TEST_F(SyncManagerTest, SetPassphraseWithEmptyPasswordNode) {
|
| }
|
|
|
| TEST_F(SyncManagerTest, NudgeDelayTest) {
|
| - EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncer::BOOKMARKS),
|
| + EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(BOOKMARKS),
|
| base::TimeDelta::FromMilliseconds(
|
| SyncManagerImpl::GetDefaultNudgeDelay()));
|
|
|
| - EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncer::AUTOFILL),
|
| + EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(AUTOFILL),
|
| base::TimeDelta::FromSeconds(
|
| - syncer::kDefaultShortPollIntervalSeconds));
|
| + kDefaultShortPollIntervalSeconds));
|
|
|
| - EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncer::PREFERENCES),
|
| + EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(PREFERENCES),
|
| base::TimeDelta::FromMilliseconds(
|
| SyncManagerImpl::GetPreferencesNudgeDelay()));
|
| }
|
| @@ -1853,10 +1852,10 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) {
|
|
|
| // Create a bookmark using the legacy format.
|
| int64 node_id1 = MakeNode(sync_manager_.GetUserShare(),
|
| - syncer::BOOKMARKS,
|
| + BOOKMARKS,
|
| "testtag");
|
| int64 node_id2 = MakeNode(sync_manager_.GetUserShare(),
|
| - syncer::BOOKMARKS,
|
| + BOOKMARKS,
|
| "testtag2");
|
| {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| @@ -1887,14 +1886,14 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) {
|
| ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| ReadNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(node_id1));
|
| - EXPECT_EQ(syncer::BOOKMARKS, node.GetModelType());
|
| + EXPECT_EQ(BOOKMARKS, node.GetModelType());
|
| EXPECT_EQ(title, node.GetTitle());
|
| EXPECT_EQ(title, node.GetBookmarkSpecifics().title());
|
| EXPECT_EQ(url, node.GetBookmarkSpecifics().url());
|
|
|
| ReadNode node2(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK, node2.InitByIdLookup(node_id2));
|
| - EXPECT_EQ(syncer::BOOKMARKS, node2.GetModelType());
|
| + EXPECT_EQ(BOOKMARKS, node2.GetModelType());
|
| // We should de-canonicalize the title in GetTitle(), but the title in the
|
| // specifics should be stored in the server legal form.
|
| EXPECT_EQ(raw_title2, node2.GetTitle());
|
| @@ -1907,36 +1906,36 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) {
|
| EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
|
| trans.GetWrappedTrans(),
|
| trans.GetCryptographer(),
|
| - syncer::BOOKMARKS,
|
| + BOOKMARKS,
|
| false /* not encrypted */));
|
| }
|
|
|
| EXPECT_CALL(observer_,
|
| OnEncryptedTypesChanged(
|
| - HasModelTypes(syncer::ModelTypeSet::All()), true));
|
| + HasModelTypes(ModelTypeSet::All()), true));
|
| EXPECT_CALL(observer_, OnEncryptionComplete());
|
| sync_manager_.EnableEncryptEverything();
|
| EXPECT_TRUE(sync_manager_.EncryptEverythingEnabledForTest());
|
|
|
| {
|
| ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| - EXPECT_TRUE(GetEncryptedTypes(&trans).Equals(syncer::ModelTypeSet::All()));
|
| + EXPECT_TRUE(GetEncryptedTypes(&trans).Equals(ModelTypeSet::All()));
|
| EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
|
| trans.GetWrappedTrans(),
|
| trans.GetCryptographer(),
|
| - syncer::BOOKMARKS,
|
| + BOOKMARKS,
|
| true /* is encrypted */));
|
|
|
| ReadNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(node_id1));
|
| - EXPECT_EQ(syncer::BOOKMARKS, node.GetModelType());
|
| + EXPECT_EQ(BOOKMARKS, node.GetModelType());
|
| EXPECT_EQ(title, node.GetTitle());
|
| EXPECT_EQ(title, node.GetBookmarkSpecifics().title());
|
| EXPECT_EQ(url, node.GetBookmarkSpecifics().url());
|
|
|
| ReadNode node2(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK, node2.InitByIdLookup(node_id2));
|
| - EXPECT_EQ(syncer::BOOKMARKS, node2.GetModelType());
|
| + EXPECT_EQ(BOOKMARKS, node2.GetModelType());
|
| // We should de-canonicalize the title in GetTitle(), but the title in the
|
| // specifics should be stored in the server legal form.
|
| EXPECT_EQ(raw_title2, node2.GetTitle());
|
| @@ -1956,7 +1955,7 @@ TEST_F(SyncManagerTest, CreateLocalBookmark) {
|
| ReadNode root_node(&trans);
|
| root_node.InitByRootLookup();
|
| WriteNode node(&trans);
|
| - ASSERT_TRUE(node.InitByCreation(syncer::BOOKMARKS, root_node, NULL));
|
| + ASSERT_TRUE(node.InitByCreation(BOOKMARKS, root_node, NULL));
|
| node.SetIsFolder(false);
|
| node.SetTitle(UTF8ToWide(title));
|
| node.SetURL(url);
|
| @@ -1982,26 +1981,26 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
|
| sync_pb::EntitySpecifics entity_specifics;
|
| entity_specifics.mutable_bookmark()->set_url("url");
|
| entity_specifics.mutable_bookmark()->set_title("title");
|
| - MakeServerNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, client_tag,
|
| - BaseNode::GenerateSyncableHash(syncer::BOOKMARKS,
|
| + MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, client_tag,
|
| + BaseNode::GenerateSyncableHash(BOOKMARKS,
|
| client_tag),
|
| entity_specifics);
|
| // New node shouldn't start off unsynced.
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
|
| // Manually change to the same data. Should not set is_unsynced.
|
| {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag));
|
| + node.InitByClientTagLookup(BOOKMARKS, client_tag));
|
| node.SetEntitySpecifics(entity_specifics);
|
| }
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
|
|
|
| // Encrypt the datatatype, should set is_unsynced.
|
| EXPECT_CALL(observer_,
|
| OnEncryptedTypesChanged(
|
| - HasModelTypes(syncer::ModelTypeSet::All()), true));
|
| + HasModelTypes(ModelTypeSet::All()), true));
|
| EXPECT_CALL(observer_, OnEncryptionComplete());
|
| EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, FULL_ENCRYPTION));
|
|
|
| @@ -2011,7 +2010,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
|
| ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| ReadNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag));
|
| + node.InitByClientTagLookup(BOOKMARKS, client_tag));
|
| const syncable::Entry* node_entry = node.GetEntry();
|
| const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
|
| EXPECT_TRUE(specifics.has_encrypted());
|
| @@ -2021,7 +2020,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
|
| EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
|
| specifics.encrypted()));
|
| }
|
| - EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag));
|
| + EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
|
|
|
| // Set a new passphrase. Should set is_unsynced.
|
| testing::Mock::VerifyAndClearExpectations(&observer_);
|
| @@ -2033,7 +2032,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
|
| ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| ReadNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag));
|
| + node.InitByClientTagLookup(BOOKMARKS, client_tag));
|
| const syncable::Entry* node_entry = node.GetEntry();
|
| const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
|
| EXPECT_TRUE(specifics.has_encrypted());
|
| @@ -2043,7 +2042,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
|
| EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
|
| specifics.encrypted()));
|
| }
|
| - EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag));
|
| + EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
|
|
|
| // Force a re-encrypt everything. Should not set is_unsynced.
|
| testing::Mock::VerifyAndClearExpectations(&observer_);
|
| @@ -2056,7 +2055,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
|
| ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| ReadNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag));
|
| + node.InitByClientTagLookup(BOOKMARKS, client_tag));
|
| const syncable::Entry* node_entry = node.GetEntry();
|
| const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
|
| EXPECT_TRUE(specifics.has_encrypted());
|
| @@ -2065,14 +2064,14 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
|
| EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
|
| specifics.encrypted()));
|
| }
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
|
|
|
| // Manually change to the same data. Should not set is_unsynced.
|
| {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag));
|
| + 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);
|
| @@ -2083,7 +2082,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
|
| EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
|
| specifics.encrypted()));
|
| }
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
|
|
|
| // Manually change to different data. Should set is_unsynced.
|
| {
|
| @@ -2092,7 +2091,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag));
|
| + 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);
|
| @@ -2121,12 +2120,12 @@ TEST_F(SyncManagerTest, UpdatePasswordSetEntitySpecificsNoChange) {
|
| entity_specifics.mutable_password()->
|
| mutable_encrypted());
|
| }
|
| - MakeServerNode(sync_manager_.GetUserShare(), syncer::PASSWORDS, client_tag,
|
| - BaseNode::GenerateSyncableHash(syncer::PASSWORDS,
|
| + MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag,
|
| + BaseNode::GenerateSyncableHash(PASSWORDS,
|
| client_tag),
|
| entity_specifics);
|
| // New node shouldn't start off unsynced.
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag));
|
|
|
| // Manually change to the same data via SetEntitySpecifics. Should not set
|
| // is_unsynced.
|
| @@ -2134,10 +2133,10 @@ TEST_F(SyncManagerTest, UpdatePasswordSetEntitySpecificsNoChange) {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::PASSWORDS, client_tag));
|
| + node.InitByClientTagLookup(PASSWORDS, client_tag));
|
| node.SetEntitySpecifics(entity_specifics);
|
| }
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag));
|
| }
|
|
|
| // Passwords have their own handling for encryption. Verify it does not result
|
| @@ -2156,12 +2155,12 @@ TEST_F(SyncManagerTest, UpdatePasswordSetPasswordSpecifics) {
|
| entity_specifics.mutable_password()->
|
| mutable_encrypted());
|
| }
|
| - MakeServerNode(sync_manager_.GetUserShare(), syncer::PASSWORDS, client_tag,
|
| - BaseNode::GenerateSyncableHash(syncer::PASSWORDS,
|
| + MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag,
|
| + BaseNode::GenerateSyncableHash(PASSWORDS,
|
| client_tag),
|
| entity_specifics);
|
| // New node shouldn't start off unsynced.
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag));
|
|
|
| // Manually change to the same data via SetPasswordSpecifics. Should not set
|
| // is_unsynced.
|
| @@ -2169,17 +2168,17 @@ TEST_F(SyncManagerTest, UpdatePasswordSetPasswordSpecifics) {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::PASSWORDS, client_tag));
|
| + node.InitByClientTagLookup(PASSWORDS, client_tag));
|
| node.SetPasswordSpecifics(node.GetPasswordSpecifics());
|
| }
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag));
|
|
|
| // Manually change to different data. Should set is_unsynced.
|
| {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::PASSWORDS, client_tag));
|
| + node.InitByClientTagLookup(PASSWORDS, client_tag));
|
| Cryptographer* cryptographer = trans.GetCryptographer();
|
| sync_pb::PasswordSpecificsData data;
|
| data.set_password_value("secret2");
|
| @@ -2207,12 +2206,12 @@ TEST_F(SyncManagerTest, UpdatePasswordNewPassphrase) {
|
| data,
|
| entity_specifics.mutable_password()->mutable_encrypted());
|
| }
|
| - MakeServerNode(sync_manager_.GetUserShare(), syncer::PASSWORDS, client_tag,
|
| - BaseNode::GenerateSyncableHash(syncer::PASSWORDS,
|
| + MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag,
|
| + BaseNode::GenerateSyncableHash(PASSWORDS,
|
| client_tag),
|
| entity_specifics);
|
| // New node shouldn't start off unsynced.
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag));
|
|
|
| // Set a new passphrase. Should set is_unsynced.
|
| testing::Mock::VerifyAndClearExpectations(&observer_);
|
| @@ -2220,7 +2219,7 @@ TEST_F(SyncManagerTest, UpdatePasswordNewPassphrase) {
|
| EXPECT_CALL(observer_, OnPassphraseAccepted());
|
| EXPECT_CALL(observer_, OnEncryptionComplete());
|
| sync_manager_.SetEncryptionPassphrase("new_passphrase", true);
|
| - EXPECT_TRUE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag));
|
| + EXPECT_TRUE(ResetUnsyncedEntry(PASSWORDS, client_tag));
|
| }
|
|
|
| // Passwords have their own handling for encryption. Verify it does not result
|
| @@ -2238,19 +2237,19 @@ TEST_F(SyncManagerTest, UpdatePasswordReencryptEverything) {
|
| data,
|
| entity_specifics.mutable_password()->mutable_encrypted());
|
| }
|
| - MakeServerNode(sync_manager_.GetUserShare(), syncer::PASSWORDS, client_tag,
|
| - BaseNode::GenerateSyncableHash(syncer::PASSWORDS,
|
| + MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag,
|
| + BaseNode::GenerateSyncableHash(PASSWORDS,
|
| client_tag),
|
| entity_specifics);
|
| // New node shouldn't start off unsynced.
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag));
|
|
|
| // Force a re-encrypt everything. Should not set is_unsynced.
|
| testing::Mock::VerifyAndClearExpectations(&observer_);
|
| EXPECT_CALL(observer_, OnEncryptionComplete());
|
| sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing));
|
| PumpLoop();
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag));
|
| }
|
|
|
| // Verify SetTitle(..) doesn't unnecessarily set IS_UNSYNCED for bookmarks
|
| @@ -2260,32 +2259,32 @@ TEST_F(SyncManagerTest, SetBookmarkTitle) {
|
| sync_pb::EntitySpecifics entity_specifics;
|
| entity_specifics.mutable_bookmark()->set_url("url");
|
| entity_specifics.mutable_bookmark()->set_title("title");
|
| - MakeServerNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, client_tag,
|
| - BaseNode::GenerateSyncableHash(syncer::BOOKMARKS,
|
| + MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, client_tag,
|
| + BaseNode::GenerateSyncableHash(BOOKMARKS,
|
| client_tag),
|
| entity_specifics);
|
| // New node shouldn't start off unsynced.
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
|
|
|
| // Manually change to the same title. Should not set is_unsynced.
|
| {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag));
|
| + node.InitByClientTagLookup(BOOKMARKS, client_tag));
|
| node.SetTitle(UTF8ToWide(client_tag));
|
| }
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
|
|
|
| // Manually change to new title. Should set is_unsynced.
|
| {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag));
|
| + node.InitByClientTagLookup(BOOKMARKS, client_tag));
|
| node.SetTitle(UTF8ToWide("title2"));
|
| }
|
| - EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag));
|
| + EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
|
| }
|
|
|
| // Verify SetTitle(..) doesn't unnecessarily set IS_UNSYNCED for encrypted
|
| @@ -2296,22 +2295,22 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) {
|
| sync_pb::EntitySpecifics entity_specifics;
|
| entity_specifics.mutable_bookmark()->set_url("url");
|
| entity_specifics.mutable_bookmark()->set_title("title");
|
| - MakeServerNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, client_tag,
|
| - BaseNode::GenerateSyncableHash(syncer::BOOKMARKS,
|
| + MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, client_tag,
|
| + BaseNode::GenerateSyncableHash(BOOKMARKS,
|
| client_tag),
|
| entity_specifics);
|
| // New node shouldn't start off unsynced.
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
|
|
|
| // Encrypt the datatatype, should set is_unsynced.
|
| EXPECT_CALL(observer_,
|
| OnEncryptedTypesChanged(
|
| - HasModelTypes(syncer::ModelTypeSet::All()), true));
|
| + HasModelTypes(ModelTypeSet::All()), true));
|
| EXPECT_CALL(observer_, OnEncryptionComplete());
|
| EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, FULL_ENCRYPTION));
|
| sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing));
|
| PumpLoop();
|
| - EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag));
|
| + EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
|
|
|
| // Manually change to the same title. Should not set is_unsynced.
|
| // NON_UNIQUE_NAME should be kEncryptedString.
|
| @@ -2319,14 +2318,14 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag));
|
| + 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);
|
| EXPECT_TRUE(specifics.has_encrypted());
|
| EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
|
| }
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
|
|
|
| // Manually change to new title. Should set is_unsynced. NON_UNIQUE_NAME
|
| // should still be kEncryptedString.
|
| @@ -2334,14 +2333,14 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag));
|
| + 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);
|
| EXPECT_TRUE(specifics.has_encrypted());
|
| EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
|
| }
|
| - EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag));
|
| + EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
|
| }
|
|
|
| // Verify SetTitle(..) doesn't unnecessarily set IS_UNSYNCED for non-bookmarks
|
| @@ -2352,33 +2351,33 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitle) {
|
| entity_specifics.mutable_preference()->set_name("name");
|
| entity_specifics.mutable_preference()->set_value("value");
|
| MakeServerNode(sync_manager_.GetUserShare(),
|
| - syncer::PREFERENCES,
|
| + PREFERENCES,
|
| client_tag,
|
| - BaseNode::GenerateSyncableHash(syncer::PREFERENCES,
|
| + BaseNode::GenerateSyncableHash(PREFERENCES,
|
| client_tag),
|
| entity_specifics);
|
| // New node shouldn't start off unsynced.
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, client_tag));
|
|
|
| // Manually change to the same title. Should not set is_unsynced.
|
| {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::PREFERENCES, client_tag));
|
| + node.InitByClientTagLookup(PREFERENCES, client_tag));
|
| node.SetTitle(UTF8ToWide(client_tag));
|
| }
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, client_tag));
|
|
|
| // Manually change to new title. Should set is_unsynced.
|
| {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::PREFERENCES, client_tag));
|
| + node.InitByClientTagLookup(PREFERENCES, client_tag));
|
| node.SetTitle(UTF8ToWide("title2"));
|
| }
|
| - EXPECT_TRUE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag));
|
| + EXPECT_TRUE(ResetUnsyncedEntry(PREFERENCES, client_tag));
|
| }
|
|
|
| // Verify SetTitle(..) doesn't unnecessarily set IS_UNSYNCED for encrypted
|
| @@ -2390,23 +2389,23 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) {
|
| entity_specifics.mutable_preference()->set_name("name");
|
| entity_specifics.mutable_preference()->set_value("value");
|
| MakeServerNode(sync_manager_.GetUserShare(),
|
| - syncer::PREFERENCES,
|
| + PREFERENCES,
|
| client_tag,
|
| - BaseNode::GenerateSyncableHash(syncer::PREFERENCES,
|
| + BaseNode::GenerateSyncableHash(PREFERENCES,
|
| client_tag),
|
| entity_specifics);
|
| // New node shouldn't start off unsynced.
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, client_tag));
|
|
|
| // Encrypt the datatatype, should set is_unsynced.
|
| EXPECT_CALL(observer_,
|
| OnEncryptedTypesChanged(
|
| - HasModelTypes(syncer::ModelTypeSet::All()), true));
|
| + HasModelTypes(ModelTypeSet::All()), true));
|
| EXPECT_CALL(observer_, OnEncryptionComplete());
|
| EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, FULL_ENCRYPTION));
|
| sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing));
|
| PumpLoop();
|
| - EXPECT_TRUE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag));
|
| + EXPECT_TRUE(ResetUnsyncedEntry(PREFERENCES, client_tag));
|
|
|
| // Manually change to the same title. Should not set is_unsynced.
|
| // NON_UNIQUE_NAME should be kEncryptedString.
|
| @@ -2414,14 +2413,14 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::PREFERENCES, client_tag));
|
| + 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);
|
| EXPECT_TRUE(specifics.has_encrypted());
|
| EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
|
| }
|
| - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag));
|
| + EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, client_tag));
|
|
|
| // Manually change to new title. Should not set is_unsynced because the
|
| // NON_UNIQUE_NAME should still be kEncryptedString.
|
| @@ -2429,7 +2428,7 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::PREFERENCES, client_tag));
|
| + 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);
|
| @@ -2451,17 +2450,17 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) {
|
| EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION));
|
| {
|
| ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| - syncer::Cryptographer* crypto = trans.GetCryptographer();
|
| + Cryptographer* crypto = trans.GetCryptographer();
|
| sync_pb::EntitySpecifics bm_specifics;
|
| bm_specifics.mutable_bookmark()->set_title("title");
|
| bm_specifics.mutable_bookmark()->set_url("url");
|
| sync_pb::EncryptedData encrypted;
|
| crypto->Encrypt(bm_specifics, &encrypted);
|
| entity_specifics.mutable_encrypted()->CopyFrom(encrypted);
|
| - syncer::AddDefaultFieldValue(syncer::BOOKMARKS, &entity_specifics);
|
| + AddDefaultFieldValue(BOOKMARKS, &entity_specifics);
|
| }
|
| - MakeServerNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, client_tag,
|
| - BaseNode::GenerateSyncableHash(syncer::BOOKMARKS,
|
| + MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, client_tag,
|
| + BaseNode::GenerateSyncableHash(BOOKMARKS,
|
| client_tag),
|
| entity_specifics);
|
|
|
| @@ -2470,7 +2469,7 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) {
|
| ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| ReadNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag));
|
| + node.InitByClientTagLookup(BOOKMARKS, client_tag));
|
| EXPECT_EQ(title, node.GetTitle());
|
| EXPECT_EQ(GURL(url), node.GetURL());
|
| }
|
| @@ -2480,7 +2479,7 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) {
|
| WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| WriteNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag));
|
| + node.InitByClientTagLookup(BOOKMARKS, client_tag));
|
| node.SetURL(GURL(url2));
|
| }
|
|
|
| @@ -2489,7 +2488,7 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) {
|
| ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
|
| ReadNode node(&trans);
|
| EXPECT_EQ(BaseNode::INIT_OK,
|
| - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag));
|
| + node.InitByClientTagLookup(BOOKMARKS, client_tag));
|
| EXPECT_EQ(title, node.GetTitle());
|
| EXPECT_EQ(GURL(url2), node.GetURL());
|
| const syncable::Entry* node_entry = node.GetEntry();
|
| @@ -2538,9 +2537,8 @@ class SyncManagerTestWithMockScheduler : public SyncManagerTest {
|
| // ScheduleConfigure. No callback should be invoked.
|
| TEST_F(SyncManagerTestWithMockScheduler, BasicConfiguration) {
|
| ConfigureReason reason = CONFIGURE_REASON_RECONFIGURATION;
|
| - syncer::ModelTypeSet types_to_download(syncer::BOOKMARKS,
|
| - syncer::PREFERENCES);
|
| - syncer::ModelSafeRoutingInfo new_routing_info;
|
| + ModelTypeSet types_to_download(BOOKMARKS, PREFERENCES);
|
| + ModelSafeRoutingInfo new_routing_info;
|
| GetModelSafeRoutingInfo(&new_routing_info);
|
|
|
| ConfigurationParams params;
|
| @@ -2568,9 +2566,8 @@ TEST_F(SyncManagerTestWithMockScheduler, BasicConfiguration) {
|
| // Test that the retry callback is invoked on configuration failure.
|
| TEST_F(SyncManagerTestWithMockScheduler, ConfigurationRetry) {
|
| ConfigureReason reason = CONFIGURE_REASON_RECONFIGURATION;
|
| - syncer::ModelTypeSet types_to_download(syncer::BOOKMARKS,
|
| - syncer::PREFERENCES);
|
| - syncer::ModelSafeRoutingInfo new_routing_info;
|
| + ModelTypeSet types_to_download(BOOKMARKS, PREFERENCES);
|
| + ModelSafeRoutingInfo new_routing_info;
|
| GetModelSafeRoutingInfo(&new_routing_info);
|
|
|
| ConfigurationParams params;
|
|
|