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

Unified Diff: components/sync/core_impl/sync_manager_impl_unittest.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/sync/core_impl/sync_manager_impl.cc ('k') | components/sync/core_impl/syncapi_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/core_impl/sync_manager_impl_unittest.cc
diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/components/sync/core_impl/sync_manager_impl_unittest.cc
similarity index 87%
rename from sync/internal_api/sync_manager_impl_unittest.cc
rename to components/sync/core_impl/sync_manager_impl_unittest.cc
index 644ff895a7c4a4942e2d497ae6cd5651f88279f5..689e310413c1518ec5d487b15d1ff9dba8f7c669 100644
--- a/sync/internal_api/sync_manager_impl_unittest.cc
+++ b/components/sync/core_impl/sync_manager_impl_unittest.cc
@@ -6,7 +6,7 @@
// functionality is provided by the Syncable layer, which has its own
// unit tests. We'll test SyncApi specific things in this harness.
-#include "sync/internal_api/sync_manager_impl.h"
+#include "components/sync/core_impl/sync_manager_impl.h"
#include <stdint.h>
@@ -26,54 +26,54 @@
#include "base/strings/utf_string_conversions.h"
#include "base/test/values_test_util.h"
#include "base/values.h"
+#include "components/sync/base/attachment_id_proto.h"
+#include "components/sync/base/cancelation_signal.h"
+#include "components/sync/base/cryptographer.h"
+#include "components/sync/base/extensions_activity.h"
+#include "components/sync/base/mock_unrecoverable_error_handler.h"
+#include "components/sync/base/model_type_test_util.h"
+#include "components/sync/base/time.h"
+#include "components/sync/core/change_record.h"
+#include "components/sync/core/http_post_provider_factory.h"
+#include "components/sync/core/http_post_provider_interface.h"
+#include "components/sync/core/read_node.h"
+#include "components/sync/core/read_transaction.h"
+#include "components/sync/core/test/test_entry_factory.h"
+#include "components/sync/core/test/test_internal_components_factory.h"
+#include "components/sync/core/test/test_user_share.h"
+#include "components/sync/core/write_node.h"
+#include "components/sync/core/write_transaction.h"
+#include "components/sync/core_impl/sync_encryption_handler_impl.h"
+#include "components/sync/core_impl/syncapi_internal.h"
+#include "components/sync/engine/events/protocol_event.h"
+#include "components/sync/engine/model_safe_worker.h"
+#include "components/sync/engine/polling_constants.h"
+#include "components/sync/engine_impl/sync_scheduler.h"
+#include "components/sync/js/js_backend.h"
+#include "components/sync/js/js_event_handler.h"
+#include "components/sync/js/js_test_util.h"
+#include "components/sync/protocol/bookmark_specifics.pb.h"
+#include "components/sync/protocol/encryption.pb.h"
+#include "components/sync/protocol/extension_specifics.pb.h"
+#include "components/sync/protocol/password_specifics.pb.h"
+#include "components/sync/protocol/preference_specifics.pb.h"
+#include "components/sync/protocol/proto_value_conversions.h"
+#include "components/sync/protocol/sync.pb.h"
+#include "components/sync/sessions_impl/sync_session.h"
+#include "components/sync/syncable/directory.h"
+#include "components/sync/syncable/entry.h"
+#include "components/sync/syncable/mutable_entry.h"
+#include "components/sync/syncable/nigori_util.h"
+#include "components/sync/syncable/syncable_id.h"
+#include "components/sync/syncable/syncable_read_transaction.h"
+#include "components/sync/syncable/syncable_util.h"
+#include "components/sync/syncable/syncable_write_transaction.h"
+#include "components/sync/test/callback_counter.h"
+#include "components/sync/test/engine/fake_model_worker.h"
+#include "components/sync/test/engine/fake_sync_scheduler.h"
+#include "components/sync/test/engine/test_id_factory.h"
+#include "components/sync/test/fake_encryptor.h"
#include "google_apis/gaia/gaia_constants.h"
-#include "sync/engine/sync_scheduler.h"
-#include "sync/internal_api/public/base/attachment_id_proto.h"
-#include "sync/internal_api/public/base/cancelation_signal.h"
-#include "sync/internal_api/public/base/model_type_test_util.h"
-#include "sync/internal_api/public/change_record.h"
-#include "sync/internal_api/public/engine/model_safe_worker.h"
-#include "sync/internal_api/public/engine/polling_constants.h"
-#include "sync/internal_api/public/events/protocol_event.h"
-#include "sync/internal_api/public/http_post_provider_factory.h"
-#include "sync/internal_api/public/http_post_provider_interface.h"
-#include "sync/internal_api/public/read_node.h"
-#include "sync/internal_api/public/read_transaction.h"
-#include "sync/internal_api/public/test/test_entry_factory.h"
-#include "sync/internal_api/public/test/test_internal_components_factory.h"
-#include "sync/internal_api/public/test/test_user_share.h"
-#include "sync/internal_api/public/write_node.h"
-#include "sync/internal_api/public/write_transaction.h"
-#include "sync/internal_api/sync_encryption_handler_impl.h"
-#include "sync/internal_api/syncapi_internal.h"
-#include "sync/js/js_backend.h"
-#include "sync/js/js_event_handler.h"
-#include "sync/js/js_test_util.h"
-#include "sync/protocol/bookmark_specifics.pb.h"
-#include "sync/protocol/encryption.pb.h"
-#include "sync/protocol/extension_specifics.pb.h"
-#include "sync/protocol/password_specifics.pb.h"
-#include "sync/protocol/preference_specifics.pb.h"
-#include "sync/protocol/proto_value_conversions.h"
-#include "sync/protocol/sync.pb.h"
-#include "sync/sessions/sync_session.h"
-#include "sync/syncable/directory.h"
-#include "sync/syncable/entry.h"
-#include "sync/syncable/mutable_entry.h"
-#include "sync/syncable/nigori_util.h"
-#include "sync/syncable/syncable_id.h"
-#include "sync/syncable/syncable_read_transaction.h"
-#include "sync/syncable/syncable_util.h"
-#include "sync/syncable/syncable_write_transaction.h"
-#include "sync/test/callback_counter.h"
-#include "sync/test/engine/fake_model_worker.h"
-#include "sync/test/engine/fake_sync_scheduler.h"
-#include "sync/test/engine/test_id_factory.h"
-#include "sync/test/fake_encryptor.h"
-#include "sync/util/cryptographer.h"
-#include "sync/util/extensions_activity.h"
-#include "sync/util/mock_unrecoverable_error_handler.h"
-#include "sync/util/time.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/protobuf/src/google/protobuf/io/coded_stream.h"
@@ -162,8 +162,8 @@ int64_t MakeBookmarkWithParent(UserShare* share,
int64_t MakeTypeRoot(UserShare* share, ModelType model_type) {
sync_pb::EntitySpecifics specifics;
AddDefaultFieldValue(model_type, &specifics);
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::UNITTEST, share->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::UNITTEST,
+ share->directory.get());
// Attempt to lookup by nigori tag.
std::string type_tag = ModelTypeToRootTag(model_type);
syncable::Id node_id = syncable::Id::CreateFromServerId(type_tag);
@@ -191,8 +191,8 @@ int64_t MakeServerNode(UserShare* share,
const std::string& client_tag,
const std::string& hashed_tag,
const sync_pb::EntitySpecifics& specifics) {
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::UNITTEST, share->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::UNITTEST,
+ share->directory.get());
syncable::Entry root_entry(&trans, syncable::GET_TYPE_ROOT, model_type);
EXPECT_TRUE(root_entry.good());
syncable::Id root_id = root_entry.GetId();
@@ -390,18 +390,15 @@ TEST_F(SyncApiTest, ModelTypesSiloed) {
ReadNode bookmarknode(&trans);
EXPECT_EQ(BaseNode::INIT_OK,
- bookmarknode.InitByClientTagLookup(BOOKMARKS,
- "collideme"));
+ bookmarknode.InitByClientTagLookup(BOOKMARKS, "collideme"));
ReadNode prefnode(&trans);
EXPECT_EQ(BaseNode::INIT_OK,
- prefnode.InitByClientTagLookup(PREFERENCES,
- "collideme"));
+ prefnode.InitByClientTagLookup(PREFERENCES, "collideme"));
ReadNode autofillnode(&trans);
EXPECT_EQ(BaseNode::INIT_OK,
- autofillnode.InitByClientTagLookup(AUTOFILL,
- "collideme"));
+ autofillnode.InitByClientTagLookup(AUTOFILL, "collideme"));
EXPECT_NE(bookmarknode.GetId(), prefnode.GetId());
EXPECT_NE(autofillnode.GetId(), prefnode.GetId());
@@ -414,15 +411,13 @@ TEST_F(SyncApiTest, ReadMissingTagsFails) {
ReadTransaction trans(FROM_HERE, user_share());
ReadNode node(&trans);
EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_NOT_GOOD,
- node.InitByClientTagLookup(BOOKMARKS,
- "testtag"));
+ node.InitByClientTagLookup(BOOKMARKS, "testtag"));
}
{
WriteTransaction trans(FROM_HERE, user_share());
WriteNode node(&trans);
EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_NOT_GOOD,
- node.InitByClientTagLookup(BOOKMARKS,
- "testtag"));
+ node.InitByClientTagLookup(BOOKMARKS, "testtag"));
}
}
@@ -458,8 +453,7 @@ TEST_F(SyncApiTest, TestDeleteBehavior) {
WriteTransaction trans(FROM_HERE, user_share());
WriteNode wnode(&trans);
EXPECT_EQ(BaseNode::INIT_OK,
- wnode.InitByClientTagLookup(BOOKMARKS,
- "testtag"));
+ wnode.InitByClientTagLookup(BOOKMARKS, "testtag"));
EXPECT_FALSE(wnode.GetIsFolder());
EXPECT_EQ(wnode.GetTitle(), test_title);
@@ -472,8 +466,7 @@ TEST_F(SyncApiTest, TestDeleteBehavior) {
ReadTransaction trans(FROM_HERE, user_share());
ReadNode node(&trans);
EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_IS_DEL,
- node.InitByClientTagLookup(BOOKMARKS,
- "testtag"));
+ 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.
EXPECT_EQ(node.GetTitle(), test_title);
@@ -501,8 +494,7 @@ TEST_F(SyncApiTest, TestDeleteBehavior) {
ReadTransaction trans(FROM_HERE, user_share());
ReadNode node(&trans);
EXPECT_EQ(BaseNode::INIT_OK,
- node.InitByClientTagLookup(BOOKMARKS,
- "testtag"));
+ node.InitByClientTagLookup(BOOKMARKS, "testtag"));
EXPECT_EQ(node.GetTitle(), test_title);
EXPECT_EQ(node.GetModelType(), BOOKMARKS);
}
@@ -521,8 +513,7 @@ TEST_F(SyncApiTest, WriteAndReadPassword) {
WriteNode password_node(&trans);
WriteNode::InitUniqueByCreationResult result =
- password_node.InitUniqueByCreation(PASSWORDS,
- root_node, "foo");
+ password_node.InitUniqueByCreation(PASSWORDS, root_node, "foo");
EXPECT_EQ(WriteNode::INIT_SUCCESS, result);
sync_pb::PasswordSpecificsData data;
data.set_password_value("secret");
@@ -570,13 +561,11 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) {
ReadNode bookmark_node(&trans);
ASSERT_EQ(BaseNode::INIT_OK, bookmark_node.InitByIdLookup(bookmark_id));
EXPECT_EQ("foo", bookmark_node.GetTitle());
- EXPECT_EQ(kEncryptedString,
- bookmark_node.GetEntry()->GetNonUniqueName());
+ EXPECT_EQ(kEncryptedString, bookmark_node.GetEntry()->GetNonUniqueName());
ReadNode pref_node(&trans);
ASSERT_EQ(BaseNode::INIT_OK,
- pref_node.InitByClientTagLookup(PREFERENCES,
- "bar"));
+ pref_node.InitByClientTagLookup(PREFERENCES, "bar"));
EXPECT_EQ(kEncryptedString, pref_node.GetTitle());
}
}
@@ -636,7 +625,7 @@ TEST_F(SyncApiTest, BaseNodeSetSpecificsPreservesUnknownFields) {
std::string unknown_fields;
{
::google::protobuf::io::StringOutputStream unknown_fields_stream(
- &unknown_fields);
+ &unknown_fields);
::google::protobuf::io::CodedOutputStream output(&unknown_fields_stream);
const int tag = 5;
const int value = 100;
@@ -911,12 +900,12 @@ class SyncManagerObserverMock : public SyncManager::Observer {
void(const WeakHandle<JsBackend>&,
const WeakHandle<DataTypeDebugInfoListener>&,
bool,
- syncer::ModelTypeSet)); // NOLINT
- MOCK_METHOD1(OnConnectionStatusChange, void(ConnectionStatus)); // NOLINT
- MOCK_METHOD1(OnUpdatedToken, void(const std::string&)); // NOLINT
+ syncer::ModelTypeSet)); // NOLINT
+ MOCK_METHOD1(OnConnectionStatusChange, void(ConnectionStatus)); // NOLINT
+ MOCK_METHOD1(OnUpdatedToken, void(const std::string&)); // NOLINT
MOCK_METHOD1(OnActionableError, void(const SyncProtocolError&)); // NOLINT
- MOCK_METHOD1(OnMigrationRequested, void(syncer::ModelTypeSet)); // NOLINT
- MOCK_METHOD1(OnProtocolEvent, void(const ProtocolEvent&)); // NOLINT
+ MOCK_METHOD1(OnMigrationRequested, void(syncer::ModelTypeSet)); // NOLINT
+ MOCK_METHOD1(OnProtocolEvent, void(const ProtocolEvent&)); // NOLINT
};
class SyncEncryptionHandlerObserverMock
@@ -925,15 +914,15 @@ class SyncEncryptionHandlerObserverMock
MOCK_METHOD2(OnPassphraseRequired,
void(PassphraseRequiredReason,
const sync_pb::EncryptedData&)); // NOLINT
- MOCK_METHOD0(OnPassphraseAccepted, void()); // NOLINT
+ MOCK_METHOD0(OnPassphraseAccepted, void()); // NOLINT
MOCK_METHOD2(OnBootstrapTokenUpdated,
void(const std::string&, BootstrapTokenType type)); // NOLINT
- MOCK_METHOD2(OnEncryptedTypesChanged,
- void(ModelTypeSet, bool)); // NOLINT
- MOCK_METHOD0(OnEncryptionComplete, void()); // NOLINT
+ MOCK_METHOD2(OnEncryptedTypesChanged, void(ModelTypeSet, bool)); // NOLINT
+ MOCK_METHOD0(OnEncryptionComplete, void()); // NOLINT
MOCK_METHOD1(OnCryptographerStateChanged, void(Cryptographer*)); // NOLINT
- MOCK_METHOD2(OnPassphraseTypeChanged, void(PassphraseType,
- base::Time)); // NOLINT
+ MOCK_METHOD2(OnPassphraseTypeChanged,
+ void(PassphraseType,
+ base::Time)); // NOLINT
MOCK_METHOD1(OnLocalSetPassphraseEncryption,
void(const SyncEncryptionHandler::NigoriState&)); // NOLINT
};
@@ -943,25 +932,16 @@ class SyncEncryptionHandlerObserverMock
class SyncManagerTest : public testing::Test,
public SyncManager::ChangeDelegate {
protected:
- enum NigoriStatus {
- DONT_WRITE_NIGORI,
- WRITE_TO_NIGORI
- };
-
- enum EncryptionStatus {
- UNINITIALIZED,
- DEFAULT_ENCRYPTION,
- FULL_ENCRYPTION
- };
-
- SyncManagerTest()
- : sync_manager_("Test sync manager") {
+ enum NigoriStatus { DONT_WRITE_NIGORI, WRITE_TO_NIGORI };
+
+ enum EncryptionStatus { UNINITIALIZED, DEFAULT_ENCRYPTION, FULL_ENCRYPTION };
+
+ SyncManagerTest() : sync_manager_("Test sync manager") {
switches_.encryption_method =
InternalComponentsFactory::ENCRYPTION_KEYSTORE;
}
- virtual ~SyncManagerTest() {
- }
+ virtual ~SyncManagerTest() {}
// Test implementation.
void SetUp() {
@@ -978,13 +958,13 @@ class SyncManagerTest : public testing::Test,
credentials.scope_set = scope_set;
sync_manager_.AddObserver(&manager_observer_);
- EXPECT_CALL(manager_observer_, OnInitializationComplete(_, _, _, _)).
- WillOnce(DoAll(SaveArg<0>(&js_backend_),
- SaveArg<2>(&initialization_succeeded_)));
+ EXPECT_CALL(manager_observer_, OnInitializationComplete(_, _, _, _))
+ .WillOnce(DoAll(SaveArg<0>(&js_backend_),
+ SaveArg<2>(&initialization_succeeded_)));
EXPECT_FALSE(js_backend_.IsInitialized());
- std::vector<scoped_refptr<ModelSafeWorker> > workers;
+ std::vector<scoped_refptr<ModelSafeWorker>> workers;
ModelSafeRoutingInfo routing_info;
GetModelSafeRoutingInfo(&routing_info);
@@ -1014,8 +994,7 @@ class SyncManagerTest : public testing::Test,
sync_manager_.GetEncryptionHandler()->AddObserver(&encryption_observer_);
EXPECT_TRUE(js_backend_.IsInitialized());
- EXPECT_EQ(InternalComponentsFactory::STORAGE_ON_DISK,
- storage_used_);
+ EXPECT_EQ(InternalComponentsFactory::STORAGE_ON_DISK, storage_used_);
if (initialization_succeeded_) {
for (ModelSafeRoutingInfo::iterator i = routing_info.begin();
@@ -1088,8 +1067,7 @@ class SyncManagerTest : public testing::Test,
sync_pb::NigoriSpecifics nigori;
cryptographer->GetKeys(nigori.mutable_encryption_keybag());
share->directory->GetNigoriHandler()->UpdateNigoriFromEncryptedTypes(
- &nigori,
- trans.GetWrappedTrans());
+ &nigori, trans.GetWrappedTrans());
WriteNode node(&trans);
EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(nigori_id));
node.SetNigoriSpecifics(nigori);
@@ -1103,27 +1081,22 @@ class SyncManagerTest : public testing::Test,
return type_roots_[type];
}
- void PumpLoop() {
- base::RunLoop().RunUntilIdle();
- }
+ void PumpLoop() { base::RunLoop().RunUntilIdle(); }
void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler) {
- js_backend_.Call(FROM_HERE, &JsBackend::SetJsEventHandler,
- event_handler);
+ js_backend_.Call(FROM_HERE, &JsBackend::SetJsEventHandler, event_handler);
PumpLoop();
}
// 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(ModelType type,
- const std::string& client_tag) {
+ bool ResetUnsyncedEntry(ModelType type, const std::string& client_tag) {
UserShare* share = sync_manager_.GetUserShare();
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::UNITTEST, share->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::UNITTEST,
+ share->directory.get());
const std::string hash = syncable::GenerateSyncableHash(type, client_tag);
- syncable::MutableEntry entry(&trans, syncable::GET_BY_CLIENT_TAG,
- hash);
+ syncable::MutableEntry entry(&trans, syncable::GET_BY_CLIENT_TAG, hash);
EXPECT_TRUE(entry.good());
if (!entry.GetIsUnsynced())
return false;
@@ -1151,8 +1124,8 @@ class SyncManagerTest : public testing::Test,
}
ModelTypeSet GetEncryptedTypesWithTrans(BaseTransaction* trans) {
- return trans->GetDirectory()->GetNigoriHandler()->
- GetEncryptedTypes(trans->GetWrappedTrans());
+ return trans->GetDirectory()->GetNigoriHandler()->GetEncryptedTypes(
+ trans->GetWrappedTrans());
}
void SimulateInvalidatorEnabledForTest(bool is_enabled) {
@@ -1172,9 +1145,7 @@ class SyncManagerTest : public testing::Test,
}
}
- InternalComponentsFactory::Switches GetSwitches() const {
- return switches_;
- }
+ InternalComponentsFactory::Switches GetSwitches() const { return switches_; }
void ExpectPassphraseAcceptance() {
EXPECT_CALL(encryption_observer_, OnPassphraseAccepted());
@@ -1183,19 +1154,17 @@ class SyncManagerTest : public testing::Test,
}
void SetImplicitPassphraseAndCheck(const std::string& passphrase) {
- sync_manager_.GetEncryptionHandler()->SetEncryptionPassphrase(
- passphrase,
- false);
+ sync_manager_.GetEncryptionHandler()->SetEncryptionPassphrase(passphrase,
+ false);
EXPECT_EQ(IMPLICIT_PASSPHRASE,
sync_manager_.GetEncryptionHandler()->GetPassphraseType());
}
void SetCustomPassphraseAndCheck(const std::string& passphrase) {
EXPECT_CALL(encryption_observer_,
- OnPassphraseTypeChanged(CUSTOM_PASSPHRASE, _));
- sync_manager_.GetEncryptionHandler()->SetEncryptionPassphrase(
- passphrase,
- true);
+ OnPassphraseTypeChanged(CUSTOM_PASSPHRASE, _));
+ sync_manager_.GetEncryptionHandler()->SetEncryptionPassphrase(passphrase,
+ true);
EXPECT_EQ(CUSTOM_PASSPHRASE,
sync_manager_.GetEncryptionHandler()->GetPassphraseType());
}
@@ -1259,8 +1228,7 @@ TEST_F(SyncManagerTest, RefreshEncryptionReady) {
{
ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
ReadNode node(&trans);
- EXPECT_EQ(BaseNode::INIT_OK,
- node.InitByIdLookup(GetIdForDataType(NIGORI)));
+ EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(GetIdForDataType(NIGORI)));
sync_pb::NigoriSpecifics nigori = node.GetNigoriSpecifics();
EXPECT_TRUE(nigori.has_encryption_keybag());
Cryptographer* cryptographer = trans.GetCryptographer();
@@ -1304,8 +1272,7 @@ TEST_F(SyncManagerTest, RefreshEncryptionEmptyNigori) {
{
ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
ReadNode node(&trans);
- EXPECT_EQ(BaseNode::INIT_OK,
- node.InitByIdLookup(GetIdForDataType(NIGORI)));
+ EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(GetIdForDataType(NIGORI)));
sync_pb::NigoriSpecifics nigori = node.GetNigoriSpecifics();
EXPECT_TRUE(nigori.has_encryption_keybag());
Cryptographer* cryptographer = trans.GetCryptographer();
@@ -1316,9 +1283,9 @@ TEST_F(SyncManagerTest, RefreshEncryptionEmptyNigori) {
TEST_F(SyncManagerTest, EncryptDataTypesWithNoData) {
EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION));
- EXPECT_CALL(encryption_observer_,
- OnEncryptedTypesChanged(
- HasModelTypes(EncryptableUserTypes()), true));
+ EXPECT_CALL(
+ encryption_observer_,
+ OnEncryptedTypesChanged(HasModelTypes(EncryptableUserTypes()), true));
EXPECT_CALL(encryption_observer_, OnEncryptionComplete());
sync_manager_.GetEncryptionHandler()->EnableEncryptEverything();
EXPECT_TRUE(IsEncryptEverythingEnabledForTest());
@@ -1337,12 +1304,12 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) {
MakeBookmarkWithParent(sync_manager_.GetUserShare(), folder, NULL);
}
// Next batch_size nodes are a different type and on their own.
- for (; i < 2*batch_size; ++i) {
+ for (; i < 2 * batch_size; ++i) {
MakeNodeWithRoot(sync_manager_.GetUserShare(), SESSIONS,
base::StringPrintf("%" PRIuS "", i));
}
// Last batch_size nodes are a third type that will not need encryption.
- for (; i < 3*batch_size; ++i) {
+ for (; i < 3 * batch_size; ++i) {
MakeNodeWithRoot(sync_manager_.GetUserShare(), THEMES,
base::StringPrintf("%" PRIuS "", i));
}
@@ -1352,22 +1319,16 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) {
EXPECT_EQ(SyncEncryptionHandler::SensitiveTypes(),
GetEncryptedTypesWithTrans(&trans));
EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
- trans.GetWrappedTrans(),
- BOOKMARKS,
- false /* not encrypted */));
+ trans.GetWrappedTrans(), BOOKMARKS, false /* not encrypted */));
EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
- trans.GetWrappedTrans(),
- SESSIONS,
- false /* not encrypted */));
+ trans.GetWrappedTrans(), SESSIONS, false /* not encrypted */));
EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
- trans.GetWrappedTrans(),
- THEMES,
- false /* not encrypted */));
+ trans.GetWrappedTrans(), THEMES, false /* not encrypted */));
}
- EXPECT_CALL(encryption_observer_,
- OnEncryptedTypesChanged(
- HasModelTypes(EncryptableUserTypes()), true));
+ EXPECT_CALL(
+ encryption_observer_,
+ OnEncryptedTypesChanged(HasModelTypes(EncryptableUserTypes()), true));
EXPECT_CALL(encryption_observer_, OnEncryptionComplete());
sync_manager_.GetEncryptionHandler()->EnableEncryptEverything();
EXPECT_TRUE(IsEncryptEverythingEnabledForTest());
@@ -1375,17 +1336,11 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) {
ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
EXPECT_EQ(EncryptableUserTypes(), GetEncryptedTypesWithTrans(&trans));
EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
- trans.GetWrappedTrans(),
- BOOKMARKS,
- true /* is encrypted */));
+ trans.GetWrappedTrans(), BOOKMARKS, true /* is encrypted */));
EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
- trans.GetWrappedTrans(),
- SESSIONS,
- true /* is encrypted */));
+ trans.GetWrappedTrans(), SESSIONS, true /* is encrypted */));
EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
- trans.GetWrappedTrans(),
- THEMES,
- true /* is encrypted */));
+ trans.GetWrappedTrans(), THEMES, true /* is encrypted */));
}
// Trigger's a ReEncryptEverything with new passphrase.
@@ -1399,23 +1354,18 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) {
ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
EXPECT_EQ(EncryptableUserTypes(), GetEncryptedTypesWithTrans(&trans));
EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
- trans.GetWrappedTrans(),
- BOOKMARKS,
- true /* is encrypted */));
+ trans.GetWrappedTrans(), BOOKMARKS, true /* is encrypted */));
EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
- trans.GetWrappedTrans(),
- SESSIONS,
- true /* is encrypted */));
+ trans.GetWrappedTrans(), SESSIONS, true /* is encrypted */));
EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
- trans.GetWrappedTrans(),
- THEMES,
- true /* is encrypted */));
+ trans.GetWrappedTrans(), THEMES, true /* is encrypted */));
}
// Calling EncryptDataTypes with an empty encrypted types should not trigger
// a reencryption and should just notify immediately.
testing::Mock::VerifyAndClearExpectations(&encryption_observer_);
EXPECT_CALL(encryption_observer_,
- OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)).Times(0);
+ OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN))
+ .Times(0);
EXPECT_CALL(encryption_observer_, OnPassphraseAccepted()).Times(0);
EXPECT_CALL(encryption_observer_, OnEncryptionComplete()).Times(0);
sync_manager_.GetEncryptionHandler()->EnableEncryptEverything();
@@ -1490,14 +1440,13 @@ TEST_F(SyncManagerTest, SetPassphraseWithPassword) {
WriteNode password_node(&trans);
WriteNode::InitUniqueByCreationResult result =
- password_node.InitUniqueByCreation(PASSWORDS,
- root_node, "foo");
+ password_node.InitUniqueByCreation(PASSWORDS, root_node, "foo");
EXPECT_EQ(WriteNode::INIT_SUCCESS, result);
sync_pb::PasswordSpecificsData data;
data.set_password_value("secret");
password_node.SetPasswordSpecifics(data);
}
- EXPECT_CALL(encryption_observer_,
+ EXPECT_CALL(encryption_observer_,
OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN));
ExpectPassphraseAcceptance();
SetCustomPassphraseAndCheck("new_passphrase");
@@ -1513,8 +1462,7 @@ TEST_F(SyncManagerTest, SetPassphraseWithPassword) {
ReadNode password_node(&trans);
EXPECT_EQ(BaseNode::INIT_OK,
- password_node.InitByClientTagLookup(PASSWORDS,
- "foo"));
+ password_node.InitByClientTagLookup(PASSWORDS, "foo"));
const sync_pb::PasswordSpecificsData& data =
password_node.GetPasswordSpecifics();
EXPECT_EQ("secret", data.password_value());
@@ -1749,8 +1697,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(PASSWORDS,
- tag));
+ password_node.InitByClientTagLookup(PASSWORDS, tag));
}
{
ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
@@ -1823,14 +1770,12 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) {
{
ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
- trans.GetWrappedTrans(),
- BOOKMARKS,
- false /* not encrypted */));
+ trans.GetWrappedTrans(), BOOKMARKS, false /* not encrypted */));
}
- EXPECT_CALL(encryption_observer_,
- OnEncryptedTypesChanged(
- HasModelTypes(EncryptableUserTypes()), true));
+ EXPECT_CALL(
+ encryption_observer_,
+ OnEncryptedTypesChanged(HasModelTypes(EncryptableUserTypes()), true));
EXPECT_CALL(encryption_observer_, OnEncryptionComplete());
sync_manager_.GetEncryptionHandler()->EnableEncryptEverything();
EXPECT_TRUE(IsEncryptEverythingEnabledForTest());
@@ -1839,9 +1784,7 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) {
ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
EXPECT_EQ(EncryptableUserTypes(), GetEncryptedTypesWithTrans(&trans));
EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest(
- trans.GetWrappedTrans(),
- BOOKMARKS,
- true /* is encrypted */));
+ trans.GetWrappedTrans(), BOOKMARKS, true /* is encrypted */));
ReadNode node(&trans);
EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(node_id1));
@@ -1902,8 +1845,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
entity_specifics.mutable_bookmark()->set_url("url");
entity_specifics.mutable_bookmark()->set_title("title");
MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, client_tag,
- syncable::GenerateSyncableHash(BOOKMARKS,
- client_tag),
+ syncable::GenerateSyncableHash(BOOKMARKS, client_tag),
entity_specifics);
// New node shouldn't start off unsynced.
EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
@@ -1918,9 +1860,9 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
// Encrypt the datatatype, should set is_unsynced.
- EXPECT_CALL(encryption_observer_,
- OnEncryptedTypesChanged(
- HasModelTypes(EncryptableUserTypes()), true));
+ EXPECT_CALL(
+ encryption_observer_,
+ OnEncryptedTypesChanged(HasModelTypes(EncryptableUserTypes()), true));
EXPECT_CALL(encryption_observer_, OnEncryptionComplete());
EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, FULL_ENCRYPTION));
@@ -1939,8 +1881,8 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
Cryptographer* cryptographer = trans.GetCryptographer();
EXPECT_TRUE(cryptographer->is_ready());
- EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
- specifics.encrypted()));
+ EXPECT_TRUE(
+ cryptographer->CanDecryptUsingDefaultKey(specifics.encrypted()));
}
EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
@@ -1961,8 +1903,8 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
Cryptographer* cryptographer = trans.GetCryptographer();
EXPECT_TRUE(cryptographer->is_ready());
- EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
- specifics.encrypted()));
+ EXPECT_TRUE(
+ cryptographer->CanDecryptUsingDefaultKey(specifics.encrypted()));
}
EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
@@ -1985,8 +1927,8 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
EXPECT_TRUE(specifics.has_encrypted());
EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
Cryptographer* cryptographer = trans.GetCryptographer();
- EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
- specifics.encrypted()));
+ EXPECT_TRUE(
+ cryptographer->CanDecryptUsingDefaultKey(specifics.encrypted()));
}
EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
@@ -2003,8 +1945,8 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
EXPECT_FALSE(node_entry->GetIsUnsynced());
EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
Cryptographer* cryptographer = trans.GetCryptographer();
- EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
- specifics.encrypted()));
+ EXPECT_TRUE(
+ cryptographer->CanDecryptUsingDefaultKey(specifics.encrypted()));
}
EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
@@ -2023,8 +1965,8 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
EXPECT_TRUE(node_entry->GetIsUnsynced());
EXPECT_EQ(kEncryptedString, node_entry->GetNonUniqueName());
Cryptographer* cryptographer = trans.GetCryptographer();
- EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey(
- specifics.encrypted()));
+ EXPECT_TRUE(
+ cryptographer->CanDecryptUsingDefaultKey(specifics.encrypted()));
}
}
@@ -2040,13 +1982,10 @@ TEST_F(SyncManagerTest, UpdatePasswordSetEntitySpecificsNoChange) {
sync_pb::PasswordSpecificsData data;
data.set_password_value("secret");
cryptographer->Encrypt(
- data,
- entity_specifics.mutable_password()->
- mutable_encrypted());
+ data, entity_specifics.mutable_password()->mutable_encrypted());
}
MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag,
- syncable::GenerateSyncableHash(PASSWORDS,
- client_tag),
+ syncable::GenerateSyncableHash(PASSWORDS, client_tag),
entity_specifics);
// New node shouldn't start off unsynced.
EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag));
@@ -2075,13 +2014,10 @@ TEST_F(SyncManagerTest, UpdatePasswordSetPasswordSpecifics) {
sync_pb::PasswordSpecificsData data;
data.set_password_value("secret");
cryptographer->Encrypt(
- data,
- entity_specifics.mutable_password()->
- mutable_encrypted());
+ data, entity_specifics.mutable_password()->mutable_encrypted());
}
MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag,
- syncable::GenerateSyncableHash(PASSWORDS,
- client_tag),
+ syncable::GenerateSyncableHash(PASSWORDS, client_tag),
entity_specifics);
// New node shouldn't start off unsynced.
EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag));
@@ -2107,8 +2043,7 @@ TEST_F(SyncManagerTest, UpdatePasswordSetPasswordSpecifics) {
sync_pb::PasswordSpecificsData data;
data.set_password_value("secret2");
cryptographer->Encrypt(
- data,
- entity_specifics.mutable_password()->mutable_encrypted());
+ data, entity_specifics.mutable_password()->mutable_encrypted());
node.SetPasswordSpecifics(data);
const syncable::Entry* node_entry = node.GetEntry();
EXPECT_TRUE(node_entry->GetIsUnsynced());
@@ -2127,12 +2062,10 @@ TEST_F(SyncManagerTest, UpdatePasswordNewPassphrase) {
sync_pb::PasswordSpecificsData data;
data.set_password_value("secret");
cryptographer->Encrypt(
- data,
- entity_specifics.mutable_password()->mutable_encrypted());
+ data, entity_specifics.mutable_password()->mutable_encrypted());
}
MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag,
- syncable::GenerateSyncableHash(PASSWORDS,
- client_tag),
+ syncable::GenerateSyncableHash(PASSWORDS, client_tag),
entity_specifics);
// New node shouldn't start off unsynced.
EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag));
@@ -2158,12 +2091,10 @@ TEST_F(SyncManagerTest, UpdatePasswordReencryptEverything) {
sync_pb::PasswordSpecificsData data;
data.set_password_value("secret");
cryptographer->Encrypt(
- data,
- entity_specifics.mutable_password()->mutable_encrypted());
+ data, entity_specifics.mutable_password()->mutable_encrypted());
}
MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag,
- syncable::GenerateSyncableHash(PASSWORDS,
- client_tag),
+ syncable::GenerateSyncableHash(PASSWORDS, client_tag),
entity_specifics);
// New node shouldn't start off unsynced.
EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag));
@@ -2195,16 +2126,14 @@ TEST_F(SyncManagerTest, ReencryptEverythingWithUnrecoverableErrorPasswords) {
sync_pb::PasswordSpecificsData data;
data.set_password_value("secret");
other_cryptographer.Encrypt(
- data,
- entity_specifics.mutable_password()->mutable_encrypted());
+ data, entity_specifics.mutable_password()->mutable_encrypted());
// Set up the real cryptographer with a different key.
KeyParams real_params = {"localhost", "username", "real_key"};
trans.GetCryptographer()->AddKey(real_params);
}
MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, kClientTag,
- syncable::GenerateSyncableHash(PASSWORDS,
- kClientTag),
+ syncable::GenerateSyncableHash(PASSWORDS, kClientTag),
entity_specifics);
EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, kClientTag));
@@ -2224,9 +2153,9 @@ TEST_F(SyncManagerTest, ReencryptEverythingWithUnrecoverableErrorPasswords) {
// an unrecoverable error (rather than crashing).
TEST_F(SyncManagerTest, ReencryptEverythingWithUnrecoverableErrorBookmarks) {
const char kClientTag[] = "client_tag";
- EXPECT_CALL(encryption_observer_,
- OnEncryptedTypesChanged(
- HasModelTypes(EncryptableUserTypes()), true));
+ EXPECT_CALL(
+ encryption_observer_,
+ OnEncryptedTypesChanged(HasModelTypes(EncryptableUserTypes()), true));
EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, FULL_ENCRYPTION));
sync_pb::EntitySpecifics entity_specifics;
{
@@ -2248,8 +2177,7 @@ TEST_F(SyncManagerTest, ReencryptEverythingWithUnrecoverableErrorBookmarks) {
trans.GetCryptographer()->AddKey(real_params);
}
MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, kClientTag,
- syncable::GenerateSyncableHash(BOOKMARKS,
- kClientTag),
+ syncable::GenerateSyncableHash(BOOKMARKS, kClientTag),
entity_specifics);
EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, kClientTag));
@@ -2273,8 +2201,7 @@ TEST_F(SyncManagerTest, SetBookmarkTitle) {
entity_specifics.mutable_bookmark()->set_url("url");
entity_specifics.mutable_bookmark()->set_title("title");
MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, client_tag,
- syncable::GenerateSyncableHash(BOOKMARKS,
- client_tag),
+ syncable::GenerateSyncableHash(BOOKMARKS, client_tag),
entity_specifics);
// New node shouldn't start off unsynced.
EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
@@ -2309,16 +2236,15 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) {
entity_specifics.mutable_bookmark()->set_url("url");
entity_specifics.mutable_bookmark()->set_title("title");
MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, client_tag,
- syncable::GenerateSyncableHash(BOOKMARKS,
- client_tag),
+ syncable::GenerateSyncableHash(BOOKMARKS, client_tag),
entity_specifics);
// New node shouldn't start off unsynced.
EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag));
// Encrypt the datatatype, should set is_unsynced.
- EXPECT_CALL(encryption_observer_,
- OnEncryptedTypesChanged(
- HasModelTypes(EncryptableUserTypes()), true));
+ EXPECT_CALL(
+ encryption_observer_,
+ OnEncryptedTypesChanged(HasModelTypes(EncryptableUserTypes()), true));
EXPECT_CALL(encryption_observer_, OnEncryptionComplete());
EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, FULL_ENCRYPTION));
EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_));
@@ -2365,11 +2291,8 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitle) {
sync_pb::EntitySpecifics entity_specifics;
entity_specifics.mutable_preference()->set_name("name");
entity_specifics.mutable_preference()->set_value("value");
- MakeServerNode(sync_manager_.GetUserShare(),
- PREFERENCES,
- client_tag,
- syncable::GenerateSyncableHash(PREFERENCES,
- client_tag),
+ MakeServerNode(sync_manager_.GetUserShare(), PREFERENCES, client_tag,
+ syncable::GenerateSyncableHash(PREFERENCES, client_tag),
entity_specifics);
// New node shouldn't start off unsynced.
EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, client_tag));
@@ -2403,19 +2326,16 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) {
sync_pb::EntitySpecifics entity_specifics;
entity_specifics.mutable_preference()->set_name("name");
entity_specifics.mutable_preference()->set_value("value");
- MakeServerNode(sync_manager_.GetUserShare(),
- PREFERENCES,
- client_tag,
- syncable::GenerateSyncableHash(PREFERENCES,
- client_tag),
+ MakeServerNode(sync_manager_.GetUserShare(), PREFERENCES, client_tag,
+ syncable::GenerateSyncableHash(PREFERENCES, client_tag),
entity_specifics);
// New node shouldn't start off unsynced.
EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, client_tag));
// Encrypt the datatatype, should set is_unsynced.
- EXPECT_CALL(encryption_observer_,
- OnEncryptedTypesChanged(
- HasModelTypes(EncryptableUserTypes()), true));
+ EXPECT_CALL(
+ encryption_observer_,
+ OnEncryptedTypesChanged(HasModelTypes(EncryptableUserTypes()), true));
EXPECT_CALL(encryption_observer_, OnEncryptionComplete());
EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, FULL_ENCRYPTION));
EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_));
@@ -2464,11 +2384,8 @@ TEST_F(SyncManagerTest, SetLongTitle) {
sync_pb::EntitySpecifics entity_specifics;
entity_specifics.mutable_preference()->set_name("name");
entity_specifics.mutable_preference()->set_value("value");
- MakeServerNode(sync_manager_.GetUserShare(),
- PREFERENCES,
- "short_title",
- syncable::GenerateSyncableHash(PREFERENCES,
- kClientTag),
+ MakeServerNode(sync_manager_.GetUserShare(), PREFERENCES, "short_title",
+ syncable::GenerateSyncableHash(PREFERENCES, kClientTag),
entity_specifics);
// New node shouldn't start off unsynced.
EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, kClientTag));
@@ -2528,8 +2445,7 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) {
AddDefaultFieldValue(BOOKMARKS, &entity_specifics);
}
MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, client_tag,
- syncable::GenerateSyncableHash(BOOKMARKS,
- client_tag),
+ syncable::GenerateSyncableHash(BOOKMARKS, client_tag),
entity_specifics);
{
@@ -2582,8 +2498,8 @@ TEST_F(SyncManagerTest, IncrementTransactionVersion) {
// Transaction version is incremented when SyncManagerTest::SetUp()
// creates a node of each type.
EXPECT_EQ(1,
- sync_manager_.GetUserShare()->directory->
- GetTransactionVersion(i->first));
+ sync_manager_.GetUserShare()->directory->GetTransactionVersion(
+ i->first));
}
}
@@ -2593,8 +2509,7 @@ TEST_F(SyncManagerTest, IncrementTransactionVersion) {
entity_specifics.mutable_bookmark()->set_url("url");
entity_specifics.mutable_bookmark()->set_title("title");
MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, client_tag,
- syncable::GenerateSyncableHash(BOOKMARKS,
- client_tag),
+ syncable::GenerateSyncableHash(BOOKMARKS, client_tag),
entity_specifics);
{
@@ -2602,8 +2517,8 @@ TEST_F(SyncManagerTest, IncrementTransactionVersion) {
for (ModelSafeRoutingInfo::iterator i = routing_info.begin();
i != routing_info.end(); ++i) {
EXPECT_EQ(i->first == BOOKMARKS ? 2 : 1,
- sync_manager_.GetUserShare()->directory->
- GetTransactionVersion(i->first));
+ sync_manager_.GetUserShare()->directory->GetTransactionVersion(
+ i->first));
}
}
}
@@ -2624,7 +2539,9 @@ class ComponentsFactory : public TestInternalComponentsFactory {
sessions::SyncSessionContext** session_context,
InternalComponentsFactory::StorageOption* storage_used)
: TestInternalComponentsFactory(
- switches, InternalComponentsFactory::STORAGE_IN_MEMORY, storage_used),
+ switches,
+ InternalComponentsFactory::STORAGE_IN_MEMORY,
+ storage_used),
scheduler_to_use_(scheduler_to_use),
session_context_(session_context) {}
~ComponentsFactory() override {}
@@ -2652,9 +2569,7 @@ class SyncManagerTestWithMockScheduler : public SyncManagerTest {
}
MockSyncScheduler* scheduler() { return scheduler_; }
- sessions::SyncSessionContext* session_context() {
- return session_context_;
- }
+ sessions::SyncSessionContext* session_context() { return session_context_; }
private:
MockSyncScheduler* scheduler_;
@@ -2674,8 +2589,8 @@ TEST_F(SyncManagerTestWithMockScheduler, BasicConfiguration) {
ConfigurationParams params;
EXPECT_CALL(*scheduler(), Start(SyncScheduler::CONFIGURATION_MODE, _));
- EXPECT_CALL(*scheduler(), ScheduleConfiguration(_)).
- WillOnce(SaveArg<0>(&params));
+ EXPECT_CALL(*scheduler(), ScheduleConfiguration(_))
+ .WillOnce(SaveArg<0>(&params));
// Set data for all types.
ModelTypeSet protocol_types = ProtocolTypes();
@@ -2686,20 +2601,14 @@ TEST_F(SyncManagerTestWithMockScheduler, BasicConfiguration) {
CallbackCounter ready_task_counter, retry_task_counter;
sync_manager_.ConfigureSyncer(
- reason,
- types_to_download,
- disabled_types,
- ModelTypeSet(),
- ModelTypeSet(),
- new_routing_info,
- base::Bind(&CallbackCounter::Callback,
- base::Unretained(&ready_task_counter)),
+ reason, types_to_download, disabled_types, ModelTypeSet(), ModelTypeSet(),
+ new_routing_info, base::Bind(&CallbackCounter::Callback,
+ base::Unretained(&ready_task_counter)),
base::Bind(&CallbackCounter::Callback,
base::Unretained(&retry_task_counter)));
EXPECT_EQ(0, ready_task_counter.times_called());
EXPECT_EQ(0, retry_task_counter.times_called());
- EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RECONFIGURATION,
- params.source);
+ EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, params.source);
EXPECT_EQ(types_to_download, params.types_to_download);
EXPECT_EQ(new_routing_info, params.routing_info);
@@ -2726,8 +2635,8 @@ TEST_F(SyncManagerTestWithMockScheduler, ReConfiguration) {
ConfigurationParams params;
EXPECT_CALL(*scheduler(), Start(SyncScheduler::CONFIGURATION_MODE, _));
- EXPECT_CALL(*scheduler(), ScheduleConfiguration(_)).
- WillOnce(SaveArg<0>(&params));
+ EXPECT_CALL(*scheduler(), ScheduleConfiguration(_))
+ .WillOnce(SaveArg<0>(&params));
// Set data for all types except those recently disabled (so we can verify
// only those recently disabled are purged) .
@@ -2746,20 +2655,14 @@ TEST_F(SyncManagerTestWithMockScheduler, ReConfiguration) {
CallbackCounter ready_task_counter, retry_task_counter;
sync_manager_.ConfigureSyncer(
- reason,
- types_to_download,
- ModelTypeSet(),
- ModelTypeSet(),
- ModelTypeSet(),
- new_routing_info,
- base::Bind(&CallbackCounter::Callback,
- base::Unretained(&ready_task_counter)),
+ reason, types_to_download, ModelTypeSet(), ModelTypeSet(), ModelTypeSet(),
+ new_routing_info, base::Bind(&CallbackCounter::Callback,
+ base::Unretained(&ready_task_counter)),
base::Bind(&CallbackCounter::Callback,
base::Unretained(&retry_task_counter)));
EXPECT_EQ(0, ready_task_counter.times_called());
EXPECT_EQ(0, retry_task_counter.times_called());
- EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RECONFIGURATION,
- params.source);
+ EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, params.source);
EXPECT_EQ(types_to_download, params.types_to_download);
EXPECT_EQ(new_routing_info, params.routing_info);
@@ -2794,8 +2697,7 @@ TEST_F(SyncManagerTest, PurgePartiallySyncedTypes) {
// Further ensure that the test harness did not create its root node.
{
syncable::ReadTransaction trans(FROM_HERE, share->directory.get());
- syncable::Entry autofill_root_node(&trans,
- syncable::GET_TYPE_ROOT,
+ syncable::Entry autofill_root_node(&trans, syncable::GET_TYPE_ROOT,
AUTOFILL);
ASSERT_FALSE(autofill_root_node.good());
}
@@ -2834,8 +2736,8 @@ TEST_F(SyncManagerTest, PurgePartiallySyncedTypes) {
std::string pref_hashed_tag = "hashXYZ";
sync_pb::EntitySpecifics pref_specifics;
AddDefaultFieldValue(PREFERENCES, &pref_specifics);
- int pref_meta = MakeServerNode(
- share, PREFERENCES, pref_client_tag, pref_hashed_tag, pref_specifics);
+ int pref_meta = MakeServerNode(share, PREFERENCES, pref_client_tag,
+ pref_hashed_tag, pref_specifics);
// And now, the purge.
EXPECT_TRUE(sync_manager_.PurgePartiallySyncedTypes());
@@ -2877,8 +2779,7 @@ TEST_F(SyncManagerTest, PurgeDisabledTypes) {
// Verify all the enabled types remain after cleanup, and all the disabled
// types were purged.
- sync_manager_.PurgeDisabledTypes(disabled_types,
- ModelTypeSet(),
+ sync_manager_.PurgeDisabledTypes(disabled_types, ModelTypeSet(),
ModelTypeSet());
EXPECT_EQ(enabled_types,
sync_manager_.GetUserShare()->directory->InitialSyncEndedTypes());
@@ -2892,8 +2793,7 @@ TEST_F(SyncManagerTest, PurgeDisabledTypes) {
Difference(ModelTypeSet::All(), disabled_types);
// Verify only the non-disabled types remain after cleanup.
- sync_manager_.PurgeDisabledTypes(disabled_types,
- ModelTypeSet(),
+ sync_manager_.PurgeDisabledTypes(disabled_types, ModelTypeSet(),
ModelTypeSet());
EXPECT_EQ(new_enabled_types,
sync_manager_.GetUserShare()->directory->InitialSyncEndedTypes());
@@ -2933,21 +2833,20 @@ TEST_F(SyncManagerTest, PurgeUnappliedTypes) {
AddDefaultFieldValue(PREFERENCES, &pref_specifics);
sync_pb::EntitySpecifics bm_specifics;
AddDefaultFieldValue(BOOKMARKS, &bm_specifics);
- int pref1_meta = MakeServerNode(
- share, PREFERENCES, "pref1", "hash1", pref_specifics);
+ int pref1_meta =
+ MakeServerNode(share, PREFERENCES, "pref1", "hash1", pref_specifics);
int64_t pref2_meta = MakeNodeWithRoot(share, PREFERENCES, "pref2");
- int pref3_meta = MakeServerNode(
- share, PREFERENCES, "pref3", "hash3", pref_specifics);
- int pref4_meta = MakeServerNode(
- share, PREFERENCES, "pref4", "hash4", pref_specifics);
- int pref5_meta = MakeServerNode(
- share, PREFERENCES, "pref5", "hash5", pref_specifics);
- int bookmark_meta = MakeServerNode(
- share, BOOKMARKS, "bookmark", "", bm_specifics);
-
- {
- syncable::WriteTransaction trans(FROM_HERE,
- syncable::SYNCER,
+ int pref3_meta =
+ MakeServerNode(share, PREFERENCES, "pref3", "hash3", pref_specifics);
+ int pref4_meta =
+ MakeServerNode(share, PREFERENCES, "pref4", "hash4", pref_specifics);
+ int pref5_meta =
+ MakeServerNode(share, PREFERENCES, "pref5", "hash5", pref_specifics);
+ int bookmark_meta =
+ MakeServerNode(share, BOOKMARKS, "bookmark", "", bm_specifics);
+
+ {
+ syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER,
share->directory.get());
// Pref's 1 and 2 are already set up properly.
// Locally delete pref 3.
@@ -2972,8 +2871,7 @@ TEST_F(SyncManagerTest, PurgeUnappliedTypes) {
// Now request a purge for the unapplied types.
disabled_types.PutAll(unapplied_types);
- sync_manager_.PurgeDisabledTypes(disabled_types,
- ModelTypeSet(),
+ sync_manager_.PurgeDisabledTypes(disabled_types, ModelTypeSet(),
unapplied_types);
// Verify the unapplied types still have progress markers and initial sync
@@ -2982,8 +2880,8 @@ TEST_F(SyncManagerTest, PurgeUnappliedTypes) {
sync_manager_.GetUserShare()->directory->InitialSyncEndedTypes().HasAll(
unapplied_types));
EXPECT_TRUE(
- sync_manager_.GetTypesWithEmptyProgressMarkerToken(unapplied_types).
- Empty());
+ sync_manager_.GetTypesWithEmptyProgressMarkerToken(unapplied_types)
+ .Empty());
// Ensure the items were unapplied as necessary.
{
@@ -3065,16 +2963,14 @@ class SyncManagerChangeProcessingTest : public SyncManagerTest {
return last_changes_;
}
- UserShare* share() {
- return sync_manager_.GetUserShare();
- }
+ UserShare* share() { return sync_manager_.GetUserShare(); }
// Set some flags so our nodes reasonably approximate the real world scenario
// and can get past CheckTreeInvariants.
//
// It's never going to be truly accurate, since we're squashing update
// receipt, processing and application into a single transaction.
- void SetNodeProperties(syncable::MutableEntry *entry) {
+ void SetNodeProperties(syncable::MutableEntry* entry) {
entry->PutId(id_factory_.NewServerId());
entry->PutBaseVersion(10);
entry->PutServerVersion(10);
@@ -3085,8 +2981,8 @@ class SyncManagerChangeProcessingTest : public SyncManagerTest {
size_t FindChangeInList(int64_t id, ChangeRecord::Action action) {
SCOPED_TRACE(id);
for (size_t i = 0; i < last_changes_.Get().size(); ++i) {
- if (last_changes_.Get()[i].id == id
- && last_changes_.Get()[i].action == action) {
+ if (last_changes_.Get()[i].id == id &&
+ last_changes_.Get()[i].action == action) {
return i;
}
}
@@ -3099,9 +2995,7 @@ class SyncManagerChangeProcessingTest : public SyncManagerTest {
// Note that spurious changes do not necessarily indicate a problem.
// Assertions on change list size can help detect problems, but it may be
// necessary to reduce their strictness if the implementation changes.
- size_t GetChangeListSize() {
- return last_changes_.Get().size();
- }
+ size_t GetChangeListSize() { return last_changes_.Get().size(); }
void ClearChangeList() { last_changes_ = ImmutableChangeRecordList(); }
@@ -3118,20 +3012,20 @@ TEST_F(SyncManagerChangeProcessingTest, AddBookmarks) {
// Create a folder and a bookmark under it.
{
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::SYNCER, share()->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER,
+ share()->directory.get());
syncable::Entry root(&trans, syncable::GET_BY_HANDLE, type_root);
ASSERT_TRUE(root.good());
- syncable::MutableEntry folder(&trans, syncable::CREATE,
- BOOKMARKS, root.GetId(), "folder");
+ syncable::MutableEntry folder(&trans, syncable::CREATE, BOOKMARKS,
+ root.GetId(), "folder");
ASSERT_TRUE(folder.good());
SetNodeProperties(&folder);
folder.PutIsDir(true);
folder_id = folder.GetMetahandle();
- syncable::MutableEntry child(&trans, syncable::CREATE,
- BOOKMARKS, folder.GetId(), "child");
+ syncable::MutableEntry child(&trans, syncable::CREATE, BOOKMARKS,
+ folder.GetId(), "child");
ASSERT_TRUE(child.good());
SetNodeProperties(&child);
child_id = child.GetMetahandle();
@@ -3193,27 +3087,26 @@ TEST_F(SyncManagerChangeProcessingTest, MoveBookmarkIntoEmptyFolder) {
// Create two folders. Place a child under folder A.
{
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::SYNCER, share()->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER,
+ share()->directory.get());
syncable::Entry root(&trans, syncable::GET_BY_HANDLE, type_root);
ASSERT_TRUE(root.good());
- syncable::MutableEntry folder_a(&trans, syncable::CREATE,
- BOOKMARKS, root.GetId(), "folderA");
+ syncable::MutableEntry folder_a(&trans, syncable::CREATE, BOOKMARKS,
+ root.GetId(), "folderA");
ASSERT_TRUE(folder_a.good());
SetNodeProperties(&folder_a);
folder_a.PutIsDir(true);
- syncable::MutableEntry folder_b(&trans, syncable::CREATE,
- BOOKMARKS, root.GetId(), "folderB");
+ syncable::MutableEntry folder_b(&trans, syncable::CREATE, BOOKMARKS,
+ root.GetId(), "folderB");
ASSERT_TRUE(folder_b.good());
SetNodeProperties(&folder_b);
folder_b.PutIsDir(true);
folder_b_id = folder_b.GetMetahandle();
- syncable::MutableEntry child(&trans, syncable::CREATE,
- BOOKMARKS, folder_a.GetId(),
- "child");
+ syncable::MutableEntry child(&trans, syncable::CREATE, BOOKMARKS,
+ folder_a.GetId(), "child");
ASSERT_TRUE(child.good());
SetNodeProperties(&child);
child_id = child.GetMetahandle();
@@ -3224,8 +3117,8 @@ TEST_F(SyncManagerChangeProcessingTest, MoveBookmarkIntoEmptyFolder) {
// Move the child from folder A to folder B.
{
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::SYNCER, share()->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER,
+ share()->directory.get());
syncable::Entry folder_b(&trans, syncable::GET_BY_HANDLE, folder_b_id);
syncable::MutableEntry child(&trans, syncable::GET_BY_HANDLE, child_id);
@@ -3250,33 +3143,31 @@ TEST_F(SyncManagerChangeProcessingTest, MoveIntoPopulatedFolder) {
// Create two folders. Place one child each under folder A and folder B.
{
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::SYNCER, share()->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER,
+ share()->directory.get());
syncable::Entry root(&trans, syncable::GET_BY_HANDLE, type_root);
ASSERT_TRUE(root.good());
- syncable::MutableEntry folder_a(&trans, syncable::CREATE,
- BOOKMARKS, root.GetId(), "folderA");
+ syncable::MutableEntry folder_a(&trans, syncable::CREATE, BOOKMARKS,
+ root.GetId(), "folderA");
ASSERT_TRUE(folder_a.good());
SetNodeProperties(&folder_a);
folder_a.PutIsDir(true);
- syncable::MutableEntry folder_b(&trans, syncable::CREATE,
- BOOKMARKS, root.GetId(), "folderB");
+ syncable::MutableEntry folder_b(&trans, syncable::CREATE, BOOKMARKS,
+ root.GetId(), "folderB");
ASSERT_TRUE(folder_b.good());
SetNodeProperties(&folder_b);
folder_b.PutIsDir(true);
- syncable::MutableEntry child_a(&trans, syncable::CREATE,
- BOOKMARKS, folder_a.GetId(),
- "childA");
+ syncable::MutableEntry child_a(&trans, syncable::CREATE, BOOKMARKS,
+ folder_a.GetId(), "childA");
ASSERT_TRUE(child_a.good());
SetNodeProperties(&child_a);
child_a_id = child_a.GetMetahandle();
- syncable::MutableEntry child_b(&trans, syncable::CREATE,
- BOOKMARKS, folder_b.GetId(),
- "childB");
+ syncable::MutableEntry child_b(&trans, syncable::CREATE, BOOKMARKS,
+ folder_b.GetId(), "childB");
SetNodeProperties(&child_b);
child_b_id = child_b.GetMetahandle();
}
@@ -3285,8 +3176,8 @@ TEST_F(SyncManagerChangeProcessingTest, MoveIntoPopulatedFolder) {
// real test starts now.
{
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::SYNCER, share()->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER,
+ share()->directory.get());
syncable::MutableEntry child_a(&trans, syncable::GET_BY_HANDLE, child_a_id);
syncable::MutableEntry child_b(&trans, syncable::GET_BY_HANDLE, child_b_id);
@@ -3312,28 +3203,27 @@ TEST_F(SyncManagerChangeProcessingTest, DeletionsAndChanges) {
// Create two folders. Place a child under folder A.
{
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::SYNCER, share()->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER,
+ share()->directory.get());
syncable::Entry root(&trans, syncable::GET_BY_HANDLE, type_root);
ASSERT_TRUE(root.good());
- syncable::MutableEntry folder_a(&trans, syncable::CREATE,
- BOOKMARKS, root.GetId(), "folderA");
+ syncable::MutableEntry folder_a(&trans, syncable::CREATE, BOOKMARKS,
+ root.GetId(), "folderA");
ASSERT_TRUE(folder_a.good());
SetNodeProperties(&folder_a);
folder_a.PutIsDir(true);
folder_a_id = folder_a.GetMetahandle();
- syncable::MutableEntry folder_b(&trans, syncable::CREATE,
- BOOKMARKS, root.GetId(), "folderB");
+ syncable::MutableEntry folder_b(&trans, syncable::CREATE, BOOKMARKS,
+ root.GetId(), "folderB");
ASSERT_TRUE(folder_b.good());
SetNodeProperties(&folder_b);
folder_b.PutIsDir(true);
folder_b_id = folder_b.GetMetahandle();
- syncable::MutableEntry child(&trans, syncable::CREATE,
- BOOKMARKS, folder_a.GetId(),
- "child");
+ syncable::MutableEntry child(&trans, syncable::CREATE, BOOKMARKS,
+ folder_a.GetId(), "child");
ASSERT_TRUE(child.good());
SetNodeProperties(&child);
child_id = child.GetMetahandle();
@@ -3343,13 +3233,13 @@ TEST_F(SyncManagerChangeProcessingTest, DeletionsAndChanges) {
// real test starts now.
{
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::SYNCER, share()->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER,
+ share()->directory.get());
- syncable::MutableEntry folder_a(
- &trans, syncable::GET_BY_HANDLE, folder_a_id);
- syncable::MutableEntry folder_b(
- &trans, syncable::GET_BY_HANDLE, folder_b_id);
+ syncable::MutableEntry folder_a(&trans, syncable::GET_BY_HANDLE,
+ folder_a_id);
+ syncable::MutableEntry folder_b(&trans, syncable::GET_BY_HANDLE,
+ folder_b_id);
syncable::MutableEntry child(&trans, syncable::GET_BY_HANDLE, child_id);
// Delete folder B and its child.
@@ -3379,13 +3269,13 @@ TEST_F(SyncManagerChangeProcessingTest, AttachmentMetadataOnlyChanges) {
// Create an article with no attachments. See that a change is generated.
int64_t article_id = kInvalidId;
{
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::SYNCER, share()->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER,
+ share()->directory.get());
int64_t type_root = GetIdForDataType(ARTICLES);
syncable::Entry root(&trans, syncable::GET_BY_HANDLE, type_root);
ASSERT_TRUE(root.good());
- syncable::MutableEntry article(
- &trans, syncable::CREATE, ARTICLES, root.GetId(), "article");
+ syncable::MutableEntry article(&trans, syncable::CREATE, ARTICLES,
+ root.GetId(), "article");
ASSERT_TRUE(article.good());
SetNodeProperties(&article);
article_id = article.GetMetahandle();
@@ -3397,8 +3287,8 @@ TEST_F(SyncManagerChangeProcessingTest, AttachmentMetadataOnlyChanges) {
// Modify the article by adding one attachment. Don't touch anything else.
// See that a change is generated.
{
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::SYNCER, share()->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER,
+ share()->directory.get());
syncable::MutableEntry article(&trans, syncable::GET_BY_HANDLE, article_id);
sync_pb::AttachmentMetadata metadata;
*metadata.add_record()->mutable_id() = CreateAttachmentIdProto(0, 0);
@@ -3411,8 +3301,8 @@ TEST_F(SyncManagerChangeProcessingTest, AttachmentMetadataOnlyChanges) {
// Modify the article by replacing its attachment with a different one. See
// that a change is generated.
{
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::SYNCER, share()->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER,
+ share()->directory.get());
syncable::MutableEntry article(&trans, syncable::GET_BY_HANDLE, article_id);
sync_pb::AttachmentMetadata metadata = article.GetAttachmentMetadata();
*metadata.add_record()->mutable_id() = CreateAttachmentIdProto(0, 0);
@@ -3425,8 +3315,8 @@ TEST_F(SyncManagerChangeProcessingTest, AttachmentMetadataOnlyChanges) {
// Modify the article by replacing its attachment metadata with the same
// attachment metadata. No change should be generated.
{
- syncable::WriteTransaction trans(
- FROM_HERE, syncable::SYNCER, share()->directory.get());
+ syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER,
+ share()->directory.get());
syncable::MutableEntry article(&trans, syncable::GET_BY_HANDLE, article_id);
article.PutAttachmentMetadata(article.GetAttachmentMetadata());
}
@@ -3440,8 +3330,7 @@ TEST_F(SyncManagerChangeProcessingTest, AttachmentMetadataOnlyChanges) {
// to load.
class SyncManagerInitInvalidStorageTest : public SyncManagerTest {
public:
- SyncManagerInitInvalidStorageTest() {
- }
+ SyncManagerInitInvalidStorageTest() {}
InternalComponentsFactory* GetFactory() override {
return new TestInternalComponentsFactory(
« no previous file with comments | « components/sync/core_impl/sync_manager_impl.cc ('k') | components/sync/core_impl/syncapi_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698