diff options
110 files changed, 479 insertions, 370 deletions
diff --git a/sync/android/model_type_helper.cc b/sync/android/model_type_helper.cc index 64d808f..304d9e7 100644 --- a/sync/android/model_type_helper.cc +++ b/sync/android/model_type_helper.cc @@ -4,6 +4,8 @@ #include "sync/android/model_type_helper.h" +#include <string> + #include "base/android/jni_android.h" #include "base/android/jni_string.h" #include "jni/ModelTypeHelper_jni.h" diff --git a/sync/android/model_type_helper.h b/sync/android/model_type_helper.h index dc3d6bf..d389d08 100644 --- a/sync/android/model_type_helper.h +++ b/sync/android/model_type_helper.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SYNC_MODEL_TYPE_HELPER_H_ -#define SYNC_MODEL_TYPE_HELPER_H_ +#ifndef SYNC_ANDROID_MODEL_TYPE_HELPER_H_ +#define SYNC_ANDROID_MODEL_TYPE_HELPER_H_ #include <jni.h> @@ -13,4 +13,4 @@ bool RegisterModelTypeHelperJni(JNIEnv* env); } -#endif // SYNC_MODEL_TYPE_HELPER_H_ +#endif // SYNC_ANDROID_MODEL_TYPE_HELPER_H_ diff --git a/sync/android/sync_jni_registrar.h b/sync/android/sync_jni_registrar.h index 5a13680..548407f 100644 --- a/sync/android/sync_jni_registrar.h +++ b/sync/android/sync_jni_registrar.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SYNC_JNI_REGISTRAR_H_ -#define SYNC_JNI_REGISTRAR_H_ +#ifndef SYNC_ANDROID_SYNC_JNI_REGISTRAR_H_ +#define SYNC_ANDROID_SYNC_JNI_REGISTRAR_H_ #include <jni.h> @@ -15,4 +15,4 @@ SYNC_EXPORT bool RegisterSyncJni(JNIEnv* env); } -#endif // SYNC_JNI_REGISTRAR_H_ +#endif // SYNC_ANDROID_SYNC_JNI_REGISTRAR_H_ diff --git a/sync/api/attachments/attachment_id.h b/sync/api/attachments/attachment_id.h index 039d386..835011a 100644 --- a/sync/api/attachments/attachment_id.h +++ b/sync/api/attachments/attachment_id.h @@ -72,7 +72,7 @@ class SYNC_EXPORT AttachmentId { ImmutableAttachmentIdProto proto_; - AttachmentId(sync_pb::AttachmentIdProto* proto); + explicit AttachmentId(sync_pb::AttachmentIdProto* proto); }; // All public interfaces use AttachmentIdList. AttachmentIdSet is used in diff --git a/sync/api/entity_change.cc b/sync/api/entity_change.cc index e2f2bed..81020de 100644 --- a/sync/api/entity_change.cc +++ b/sync/api/entity_change.cc @@ -26,7 +26,7 @@ EntityChange EntityChange::CreateDelete(std::string client_key) { EntityChange::EntityChange(std::string client_key, ChangeType type, EntityDataPtr data) - : client_key_(client_key), type_(type), data_(data){}; + : client_key_(client_key), type_(type), data_(data) {} EntityChange::~EntityChange() {} diff --git a/sync/api/entity_data.cc b/sync/api/entity_data.cc index 0914022..35e5e74 100644 --- a/sync/api/entity_data.cc +++ b/sync/api/entity_data.cc @@ -4,6 +4,8 @@ #include "sync/api/entity_data.h" +#include <algorithm> + #include "base/logging.h" namespace syncer_v2 { diff --git a/sync/api/fake_sync_change_processor.cc b/sync/api/fake_sync_change_processor.cc index 2721650..b9adf88 100644 --- a/sync/api/fake_sync_change_processor.cc +++ b/sync/api/fake_sync_change_processor.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "sync/api/fake_sync_change_processor.h" + #include "sync/api/sync_change.h" #include "sync/api/sync_data.h" diff --git a/sync/api/fake_sync_change_processor.h b/sync/api/fake_sync_change_processor.h index d9bd596..7271edf 100644 --- a/sync/api/fake_sync_change_processor.h +++ b/sync/api/fake_sync_change_processor.h @@ -5,6 +5,8 @@ #ifndef SYNC_API_FAKE_SYNC_CHANGE_PROCESSOR_H_ #define SYNC_API_FAKE_SYNC_CHANGE_PROCESSOR_H_ +#include <string> + #include "sync/api/sync_change_processor.h" namespace syncer { diff --git a/sync/api/sync_change_processor.h b/sync/api/sync_change_processor.h index b70ef3d..e815d3e 100644 --- a/sync/api/sync_change_processor.h +++ b/sync/api/sync_change_processor.h @@ -5,6 +5,7 @@ #ifndef SYNC_API_SYNC_CHANGE_PROCESSOR_H_ #define SYNC_API_SYNC_CHANGE_PROCESSOR_H_ +#include <string> #include <vector> #include "sync/api/sync_data.h" @@ -59,7 +60,7 @@ class SYNC_EXPORT SyncChangeProcessor { // // Refer to sync_data.h for a description of |sync_tag|. // - // TODO:(maniscalco): N.B. this method should really be pure virtual. An + // TODO(maniscalco): N.B. this method should really be pure virtual. An // implentation is provided here just to verify that everything compiles. // Update this method to be pure virtual (bug 353300). virtual void GetSyncData(const ModelType& type, diff --git a/sync/api/sync_data.cc b/sync/api/sync_data.cc index d6c9152..17b54dc 100644 --- a/sync/api/sync_data.cc +++ b/sync/api/sync_data.cc @@ -4,6 +4,7 @@ #include "sync/api/sync_data.h" +#include <algorithm> #include <ostream> #include "base/json/json_writer.h" diff --git a/sync/api/sync_data_unittest.cc b/sync/api/sync_data_unittest.cc index 9d45149..9d676c0 100644 --- a/sync/api/sync_data_unittest.cc +++ b/sync/api/sync_data_unittest.cc @@ -23,9 +23,9 @@ namespace syncer { namespace { -const string kSyncTag = "3984729834"; +const char kSyncTag[] = "3984729834"; const ModelType kDatatype = syncer::PREFERENCES; -const string kNonUniqueTitle = "my preference"; +const char kNonUniqueTitle[] = "my preference"; const int64 kId = 439829; const base::Time kLastModifiedTime = base::Time(); diff --git a/sync/api/sync_error.h b/sync/api/sync_error.h index 281621e..d2832a5 100644 --- a/sync/api/sync_error.h +++ b/sync/api/sync_error.h @@ -27,21 +27,23 @@ class SYNC_EXPORT SyncError { // in the datatype being disabled) from actionable sync errors (which might // have more complicated results). enum ErrorType { - UNSET, // No error. - UNRECOVERABLE_ERROR, // An unrecoverable runtime error was encountered, and - // sync should be disabled and purged completely. - DATATYPE_ERROR, // A datatype error was encountered, and the datatype - // should be disabled and purged completely. Note that - // datatype errors may be reset, triggering a - // re-enable. - PERSISTENCE_ERROR, // A persistence error was detected, and the - // datataype should be associated after a sync update. - CRYPTO_ERROR, // A cryptographer error was detected, and the - // datatype should be associated after it is resolved. - UNREADY_ERROR, // A datatype is not ready to start yet, so should be - // neither purged nor enabled until it is ready. - DATATYPE_POLICY_ERROR // A datatype should be disabled and purged due - // to configuration constraints. + UNSET, // No error. + UNRECOVERABLE_ERROR, // An unrecoverable runtime error was encountered, + // and sync should be disabled and purged completely. + DATATYPE_ERROR, // A datatype error was encountered, and the datatype + // should be disabled and purged completely. Note + // that datatype errors may be reset, triggering a + // re-enable. + PERSISTENCE_ERROR, // A persistence error was detected, and the + // datataype should be associated after a sync + // update. + CRYPTO_ERROR, // A cryptographer error was detected, and the + // datatype should be associated after it is + // resolved. + UNREADY_ERROR, // A datatype is not ready to start yet, so should be + // neither purged nor enabled until it is ready. + DATATYPE_POLICY_ERROR // A datatype should be disabled and purged due to + // configuration constraints. }; // Severity is used to indicate how an error should be logged and @@ -93,6 +95,7 @@ class SYNC_EXPORT SyncError { // Returns empty string is IsSet() is false. std::string ToString() const; + private: // Print error information to log. void PrintLogError() const; diff --git a/sync/api/sync_error_factory_mock.h b/sync/api/sync_error_factory_mock.h index bd675ee..cffab26 100644 --- a/sync/api/sync_error_factory_mock.h +++ b/sync/api/sync_error_factory_mock.h @@ -5,8 +5,9 @@ #ifndef SYNC_API_SYNC_ERROR_FACTORY_MOCK_H_ #define SYNC_API_SYNC_ERROR_FACTORY_MOCK_H_ -#include "sync/api/sync_error_factory.h" +#include <string> +#include "sync/api/sync_error_factory.h" #include "testing/gmock/include/gmock/gmock.h" namespace syncer { diff --git a/sync/engine/all_status.cc b/sync/engine/all_status.cc index 36fb23e..10b54e0 100644 --- a/sync/engine/all_status.cc +++ b/sync/engine/all_status.cc @@ -164,7 +164,7 @@ void AllStatus::SetInvalidatorClientId( void AllStatus::IncrementNudgeCounter(NudgeSource source) { ScopedStatusLock lock(this); - switch(source) { + switch (source) { case NUDGE_SOURCE_LOCAL_REFRESH: status_.nudge_source_local_refresh++; return; diff --git a/sync/engine/all_status.h b/sync/engine/all_status.h index 6eadc6d..95d9545 100644 --- a/sync/engine/all_status.h +++ b/sync/engine/all_status.h @@ -5,8 +5,8 @@ // The AllStatus object watches various sync engine components and aggregates // the status of all of them into one place. -#ifndef SYNC_INTERNAL_API_ALL_STATUS_H_ -#define SYNC_INTERNAL_API_ALL_STATUS_H_ +#ifndef SYNC_ENGINE_ALL_STATUS_H_ +#define SYNC_ENGINE_ALL_STATUS_H_ #include <map> #include <string> @@ -35,7 +35,6 @@ struct SyncCycleEvent; // we will continue to collect data and update state mid-sync-cycle in case we // need to debug slow or stuck sync cycles. class AllStatus : public SyncEngineEventListener { - friend class ScopedStatusLock; public: AllStatus(); ~AllStatus() override; @@ -77,6 +76,10 @@ class AllStatus : public SyncEngineEventListener { SyncStatus status_; mutable base::Lock mutex_; // Protects all data members. + + private: + friend class ScopedStatusLock; + DISALLOW_COPY_AND_ASSIGN(AllStatus); }; @@ -90,4 +93,4 @@ class ScopedStatusLock { } // namespace syncer -#endif // SYNC_INTERNAL_API_ALL_STATUS_H_ +#endif // SYNC_ENGINE_ALL_STATUS_H_ diff --git a/sync/engine/apply_control_data_updates.cc b/sync/engine/apply_control_data_updates.cc index 49825b8..ce6c6c5 100644 --- a/sync/engine/apply_control_data_updates.cc +++ b/sync/engine/apply_control_data_updates.cc @@ -4,6 +4,8 @@ #include "sync/engine/apply_control_data_updates.h" +#include <vector> + #include "base/metrics/histogram.h" #include "sync/engine/conflict_resolver.h" #include "sync/engine/conflict_util.h" diff --git a/sync/engine/apply_control_data_updates_unittest.cc b/sync/engine/apply_control_data_updates_unittest.cc index c01e5a7..405ae0e 100644 --- a/sync/engine/apply_control_data_updates_unittest.cc +++ b/sync/engine/apply_control_data_updates_unittest.cc @@ -2,12 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "sync/engine/apply_control_data_updates.h" + +#include <string> + #include "base/format_macros.h" #include "base/location.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/strings/stringprintf.h" -#include "sync/engine/apply_control_data_updates.h" #include "sync/engine/syncer.h" #include "sync/engine/syncer_util.h" #include "sync/internal_api/public/test/test_entry_factory.h" diff --git a/sync/engine/backoff_delay_provider.cc b/sync/engine/backoff_delay_provider.cc index bff3fd6..ddd90ed 100644 --- a/sync/engine/backoff_delay_provider.cc +++ b/sync/engine/backoff_delay_provider.cc @@ -4,6 +4,8 @@ #include "sync/engine/backoff_delay_provider.h" +#include <algorithm> + #include "base/rand_util.h" #include "sync/internal_api/public/engine/polling_constants.h" #include "sync/internal_api/public/sessions/model_neutral_state.h" diff --git a/sync/engine/commit_queue.cc b/sync/engine/commit_queue.cc index 1a0e58b..dbe4c0a 100644 --- a/sync/engine/commit_queue.cc +++ b/sync/engine/commit_queue.cc @@ -12,4 +12,4 @@ CommitQueue::CommitQueue() { CommitQueue::~CommitQueue() { } -} // namespace syncer +} // namespace syncer_v2 diff --git a/sync/engine/conflict_resolver.h b/sync/engine/conflict_resolver.h index 5838623..3266afb 100644 --- a/sync/engine/conflict_resolver.h +++ b/sync/engine/conflict_resolver.h @@ -29,9 +29,6 @@ class StatusController; } // namespace sessions class ConflictResolver { - friend class SyncerTest; - FRIEND_TEST_ALL_PREFIXES(SyncerTest, - ConflictResolverMergeOverwritesLocalEntry); public: // Enumeration of different conflict resolutions. Used for histogramming. enum SimpleConflictResolutions { @@ -57,6 +54,10 @@ class ConflictResolver { UpdateCounters* counters); private: + friend class SyncerTest; + FRIEND_TEST_ALL_PREFIXES(SyncerTest, + ConflictResolverMergeOverwritesLocalEntry); + void ProcessSimpleConflict( syncable::WriteTransaction* trans, const syncable::Id& id, diff --git a/sync/engine/directory_commit_contribution.cc b/sync/engine/directory_commit_contribution.cc index 568d621..a65e3da 100644 --- a/sync/engine/directory_commit_contribution.cc +++ b/sync/engine/directory_commit_contribution.cc @@ -4,6 +4,9 @@ #include "sync/engine/directory_commit_contribution.h" +#include <algorithm> +#include <set> + #include "sync/engine/commit_util.h" #include "sync/engine/get_commit_ids.h" #include "sync/engine/syncer_util.h" diff --git a/sync/engine/directory_commit_contribution_unittest.cc b/sync/engine/directory_commit_contribution_unittest.cc index ce0fa75..3789bee 100644 --- a/sync/engine/directory_commit_contribution_unittest.cc +++ b/sync/engine/directory_commit_contribution_unittest.cc @@ -4,6 +4,9 @@ #include "sync/engine/directory_commit_contribution.h" +#include <set> +#include <string> + #include "base/message_loop/message_loop.h" #include "sync/internal_api/public/base/attachment_id_proto.h" #include "sync/sessions/status_controller.h" @@ -291,7 +294,6 @@ TEST_F(DirectoryCommitContributionTest, DeletedBookmarksWithSpecifics) { // Test that bookmarks support hierarchy. TEST_F(DirectoryCommitContributionTest, HierarchySupport_Bookmark) { - // Create a normal-looking bookmark item. int64 bm1; { diff --git a/sync/engine/directory_commit_contributor.h b/sync/engine/directory_commit_contributor.h index 62251f7..430bcaf 100644 --- a/sync/engine/directory_commit_contributor.h +++ b/sync/engine/directory_commit_contributor.h @@ -45,6 +45,6 @@ class DirectoryCommitContributor : public CommitContributor { DISALLOW_COPY_AND_ASSIGN(DirectoryCommitContributor); }; -} // namespace +} // namespace syncer #endif // SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_ diff --git a/sync/engine/directory_update_handler.cc b/sync/engine/directory_update_handler.cc index 8adc6dd..60b08c5 100644 --- a/sync/engine/directory_update_handler.cc +++ b/sync/engine/directory_update_handler.cc @@ -4,6 +4,8 @@ #include "sync/engine/directory_update_handler.h" +#include <vector> + #include "sync/engine/conflict_resolver.h" #include "sync/engine/process_updates_util.h" #include "sync/engine/update_applicator.h" diff --git a/sync/engine/directory_update_handler_unittest.cc b/sync/engine/directory_update_handler_unittest.cc index 6238eb0..3a29d1c 100644 --- a/sync/engine/directory_update_handler_unittest.cc +++ b/sync/engine/directory_update_handler_unittest.cc @@ -4,6 +4,8 @@ #include "sync/engine/directory_update_handler.h" +#include <set> +#include <string> #include <utility> #include "base/compiler_specific.h" @@ -533,7 +535,7 @@ sync_pb::EntitySpecifics DefaultBookmarkSpecifics() { AddDefaultFieldValue(BOOKMARKS, &result); return result; } -} // namespace +} // namespace // Test update application for a few bookmark items. TEST_F(DirectoryUpdateHandlerApplyUpdateTest, SimpleBookmark) { diff --git a/sync/engine/entity_tracker_unittest.cc b/sync/engine/entity_tracker_unittest.cc index 02dabf0..5dd2d38 100644 --- a/sync/engine/entity_tracker_unittest.cc +++ b/sync/engine/entity_tracker_unittest.cc @@ -156,4 +156,4 @@ TEST_F(EntityTrackerTest, ReflectedUpdateDoesntClobberCommit) { EXPECT_TRUE(entity->HasPendingCommit()); } -} // namespace syncer +} // namespace syncer_v2 diff --git a/sync/engine/get_commit_ids.cc b/sync/engine/get_commit_ids.cc index 543dc1b..5c4d111 100644 --- a/sync/engine/get_commit_ids.cc +++ b/sync/engine/get_commit_ids.cc @@ -69,7 +69,7 @@ void GetCommitIdsForType( if (cryptographer) { encrypted_types = dir->GetNigoriHandler()->GetEncryptedTypes(trans); passphrase_missing = cryptographer->has_pending_keys(); - }; + } // We filter out all unready entries from the set of unsynced handles. This // new set of ready and unsynced items is then what we use to determine what diff --git a/sync/engine/get_updates_processor_unittest.cc b/sync/engine/get_updates_processor_unittest.cc index 566a295..c89b57d 100644 --- a/sync/engine/get_updates_processor_unittest.cc +++ b/sync/engine/get_updates_processor_unittest.cc @@ -4,6 +4,8 @@ #include "sync/engine/get_updates_processor.h" +#include <string> + #include "base/message_loop/message_loop.h" #include "base/stl_util.h" #include "sync/engine/get_updates_delegate.h" diff --git a/sync/engine/model_type_worker.cc b/sync/engine/model_type_worker.cc index afcf0f4..991ee82 100644 --- a/sync/engine/model_type_worker.cc +++ b/sync/engine/model_type_worker.cc @@ -5,6 +5,7 @@ #include "sync/engine/model_type_worker.h" #include <utility> +#include <vector> #include "base/bind.h" #include "base/format_macros.h" @@ -461,4 +462,4 @@ bool ModelTypeWorker::DecryptSpecifics(Cryptographer* cryptographer, return true; } -} // namespace syncer +} // namespace syncer_v2 diff --git a/sync/engine/model_type_worker.h b/sync/engine/model_type_worker.h index 130c1d3..a6a1ae8 100644 --- a/sync/engine/model_type_worker.h +++ b/sync/engine/model_type_worker.h @@ -5,6 +5,9 @@ #ifndef SYNC_ENGINE_MODEL_TYPE_WORKER_H_ #define SYNC_ENGINE_MODEL_TYPE_WORKER_H_ +#include <map> +#include <string> + #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/threading/non_thread_safe.h" @@ -164,6 +167,6 @@ class SYNC_EXPORT ModelTypeWorker : public syncer::UpdateHandler, base::WeakPtrFactory<ModelTypeWorker> weak_ptr_factory_; }; -} // namespace syncer +} // namespace syncer_v2 #endif // SYNC_ENGINE_MODEL_TYPE_WORKER_H_ diff --git a/sync/engine/model_type_worker_unittest.cc b/sync/engine/model_type_worker_unittest.cc index 06fc15c..b0f7484 100644 --- a/sync/engine/model_type_worker_unittest.cc +++ b/sync/engine/model_type_worker_unittest.cc @@ -1140,4 +1140,4 @@ TEST_F(ModelTypeWorkerTest, ReceiveCorruptEncryption) { EXPECT_TRUE(HasUpdateResponseOnModelThread("tag1")); } -} // namespace syncer +} // namespace syncer_v2 diff --git a/sync/engine/net/url_translator.cc b/sync/engine/net/url_translator.cc index 285053a..dd0b57e 100644 --- a/sync/engine/net/url_translator.cc +++ b/sync/engine/net/url_translator.cc @@ -24,7 +24,7 @@ const char kClientName[] = "Google Chrome"; #else const char kClientName[] = "Chromium"; #endif // defined(GOOGLE_CHROME_BUILD) -} +} // namespace // Convenience wrappers around CgiEscapePath(). string CgiEscapeString(const char* src) { diff --git a/sync/engine/non_blocking_type_commit_contribution.cc b/sync/engine/non_blocking_type_commit_contribution.cc index cdebda3..55b81e2 100644 --- a/sync/engine/non_blocking_type_commit_contribution.cc +++ b/sync/engine/non_blocking_type_commit_contribution.cc @@ -4,6 +4,8 @@ #include "sync/engine/non_blocking_type_commit_contribution.h" +#include <algorithm> + #include "base/values.h" #include "sync/engine/model_type_worker.h" #include "sync/internal_api/public/non_blocking_sync_common.h" @@ -116,4 +118,4 @@ size_t NonBlockingTypeCommitContribution::GetNumEntries() const { return sequence_numbers_.size(); } -} // namespace syncer +} // namespace syncer_v2 diff --git a/sync/engine/non_blocking_type_commit_contribution.h b/sync/engine/non_blocking_type_commit_contribution.h index 3247a2c..41ee4de 100644 --- a/sync/engine/non_blocking_type_commit_contribution.h +++ b/sync/engine/non_blocking_type_commit_contribution.h @@ -61,6 +61,6 @@ class NonBlockingTypeCommitContribution : public syncer::CommitContribution { DISALLOW_COPY_AND_ASSIGN(NonBlockingTypeCommitContribution); }; -} // namespace syncer +} // namespace syncer_v2 #endif // SYNC_ENGINE_NON_BLOCKING_TYPE_COMMIT_CONTRIBUTION_H_ diff --git a/sync/engine/nudge_source.cc b/sync/engine/nudge_source.cc index 62a2409..5445e9d 100644 --- a/sync/engine/nudge_source.cc +++ b/sync/engine/nudge_source.cc @@ -16,7 +16,7 @@ const char* GetNudgeSourceString(NudgeSource nudge_source) { ENUM_CASE(NUDGE_SOURCE_NOTIFICATION); ENUM_CASE(NUDGE_SOURCE_LOCAL); ENUM_CASE(NUDGE_SOURCE_LOCAL_REFRESH); - }; + } NOTREACHED(); return ""; } diff --git a/sync/engine/process_updates_util.cc b/sync/engine/process_updates_util.cc index e1931d7..1ad577a 100644 --- a/sync/engine/process_updates_util.cc +++ b/sync/engine/process_updates_util.cc @@ -4,6 +4,8 @@ #include "sync/engine/process_updates_util.h" +#include <string> + #include "base/location.h" #include "base/metrics/sparse_histogram.h" #include "sync/engine/syncer_proto_util.h" @@ -49,7 +51,7 @@ namespace { // For more information, see FindLocalIdToUpdate(). bool UpdateContainsNewVersion(syncable::BaseTransaction *trans, const sync_pb::SyncEntity &update) { - int64 existing_version = -1; // The server always sends positive versions. + int64 existing_version = -1; // The server always sends positive versions. syncable::Entry existing_entry(trans, GET_BY_ID, SyncableIdFromProto(update.id_string())); if (existing_entry.good()) @@ -159,7 +161,6 @@ VerifyResult VerifyUpdate( bool ReverifyEntry(syncable::ModelNeutralWriteTransaction* trans, const sync_pb::SyncEntity& entry, syncable::ModelNeutralMutableEntry* same_id) { - const bool deleted = entry.has_deleted() && entry.deleted(); const bool is_directory = IsFolder(entry); const ModelType model_type = GetModelType(entry); diff --git a/sync/engine/sync_scheduler_unittest.cc b/sync/engine/sync_scheduler_unittest.cc index dbf6fda..ea07b4a 100644 --- a/sync/engine/sync_scheduler_unittest.cc +++ b/sync/engine/sync_scheduler_unittest.cc @@ -305,7 +305,7 @@ TEST_F(SyncSchedulerTest, Nudge) { SyncShareTimes times; ModelTypeSet model_types(THEMES); - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), RecordSyncShare(×, true))) .RetiresOnSaturation(); @@ -321,7 +321,7 @@ TEST_F(SyncSchedulerTest, Nudge) { SyncShareTimes times2; model_types.Remove(THEMES); model_types.Put(TYPED_URLS); - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), RecordSyncShare(×2, true))); scheduler()->ScheduleLocalNudge(model_types, FROM_HERE); @@ -334,7 +334,7 @@ TEST_F(SyncSchedulerTest, Config) { SyncShareTimes times; const ModelTypeSet model_types(THEMES); - EXPECT_CALL(*syncer(), ConfigureSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), ConfigureSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConfigureSuccess), RecordSyncShare(×, true))); @@ -364,7 +364,7 @@ TEST_F(SyncSchedulerTest, ConfigWithBackingOff) { StartSyncConfiguration(); - EXPECT_CALL(*syncer(), ConfigureSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), ConfigureSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConfigureFailed), RecordSyncShare(×, false))) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConfigureFailed), @@ -391,7 +391,7 @@ TEST_F(SyncSchedulerTest, ConfigWithBackingOff) { Mock::VerifyAndClearExpectations(syncer()); - EXPECT_CALL(*syncer(), ConfigureSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), ConfigureSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConfigureSuccess), RecordSyncShare(×, true))); RunLoop(); @@ -412,7 +412,7 @@ TEST_F(SyncSchedulerTest, ConfigWithStop) { // Make ConfigureSyncShare call scheduler->Stop(). It is not supposed to call // retry_task or dereference configuration params. - EXPECT_CALL(*syncer(), ConfigureSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), ConfigureSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConfigureFailed), StopScheduler(scheduler()), RecordSyncShare(×, false))); @@ -443,7 +443,7 @@ TEST_F(SyncSchedulerTest, NudgeWithConfigWithBackingOff) { StartSyncConfiguration(); // Request a configure and make sure it fails. - EXPECT_CALL(*syncer(), ConfigureSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), ConfigureSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConfigureFailed), RecordSyncShare(×, false))); CallbackCounter ready_counter; @@ -461,7 +461,7 @@ TEST_F(SyncSchedulerTest, NudgeWithConfigWithBackingOff) { Mock::VerifyAndClearExpectations(syncer()); // Ask for a nudge while dealing with repeated configure failure. - EXPECT_CALL(*syncer(), ConfigureSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), ConfigureSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConfigureFailed), RecordSyncShare(×, false))); scheduler()->ScheduleLocalNudge(model_types, FROM_HERE); @@ -473,13 +473,13 @@ TEST_F(SyncSchedulerTest, NudgeWithConfigWithBackingOff) { ASSERT_EQ(0, ready_counter.times_called()); // Let the next configure retry succeed. - EXPECT_CALL(*syncer(), ConfigureSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), ConfigureSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConfigureSuccess), RecordSyncShare(×, true))); RunLoop(); // Now change the mode so nudge can execute. - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), RecordSyncShare(×, true))); StartSyncScheduler(base::Time()); @@ -491,7 +491,7 @@ TEST_F(SyncSchedulerTest, NudgeCoalescing) { StartSyncScheduler(base::Time()); SyncShareTimes times; - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), RecordSyncShare(×, true))); const ModelTypeSet types1(THEMES), types2(TYPED_URLS), types3(THEMES); @@ -506,7 +506,7 @@ TEST_F(SyncSchedulerTest, NudgeCoalescing) { Mock::VerifyAndClearExpectations(syncer()); SyncShareTimes times2; - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), RecordSyncShare(×2, true))); scheduler()->ScheduleLocalNudge(types3, FROM_HERE); @@ -518,7 +518,7 @@ TEST_F(SyncSchedulerTest, NudgeCoalescingWithDifferentTimings) { StartSyncScheduler(base::Time()); SyncShareTimes times; - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), RecordSyncShare(×, true))); ModelTypeSet types1(THEMES), types2(TYPED_URLS), types3; @@ -549,7 +549,7 @@ TEST_F(SyncSchedulerTest, NudgeWithStates) { StartSyncScheduler(base::Time()); SyncShareTimes times1; - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), RecordSyncShare(×1, true))) .RetiresOnSaturation(); @@ -561,7 +561,7 @@ TEST_F(SyncSchedulerTest, NudgeWithStates) { // Make sure a second, later, nudge is unaffected by first (no coalescing). SyncShareTimes times2; - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), RecordSyncShare(×2, true))); scheduler()->ScheduleInvalidationNudge( @@ -573,7 +573,8 @@ TEST_F(SyncSchedulerTest, NudgeWithStates) { TEST_F(SyncSchedulerTest, Polling) { SyncShareTimes times; TimeDelta poll_interval(TimeDelta::FromMilliseconds(30)); - EXPECT_CALL(*syncer(), PollSyncShare(_,_)).Times(AtLeast(kMinNumSamples)) + EXPECT_CALL(*syncer(), PollSyncShare(_, _)) + .Times(AtLeast(kMinNumSamples)) .WillRepeatedly( DoAll(Invoke(sessions::test_util::SimulatePollSuccess), RecordSyncShareMultiple(×, kMinNumSamples, true))); @@ -598,7 +599,8 @@ TEST_F(SyncSchedulerTest, PollingPersistence) { // Use a large poll interval that wouldn't normally get hit on its own for // some time yet. TimeDelta poll_interval(TimeDelta::FromMilliseconds(500)); - EXPECT_CALL(*syncer(), PollSyncShare(_,_)).Times(AtLeast(kMinNumSamples)) + EXPECT_CALL(*syncer(), PollSyncShare(_, _)) + .Times(AtLeast(kMinNumSamples)) .WillRepeatedly( DoAll(Invoke(sessions::test_util::SimulatePollSuccess), RecordSyncShareMultiple(×, kMinNumSamples, true))); @@ -621,7 +623,8 @@ TEST_F(SyncSchedulerTest, PollingPersistence) { TEST_F(SyncSchedulerTest, PollingPersistenceBadClock) { SyncShareTimes times; TimeDelta poll_interval(TimeDelta::FromMilliseconds(30)); - EXPECT_CALL(*syncer(), PollSyncShare(_,_)).Times(AtLeast(kMinNumSamples)) + EXPECT_CALL(*syncer(), PollSyncShare(_, _)) + .Times(AtLeast(kMinNumSamples)) .WillRepeatedly( DoAll(Invoke(sessions::test_util::SimulatePollSuccess), RecordSyncShareMultiple(×, kMinNumSamples, true))); @@ -643,7 +646,8 @@ TEST_F(SyncSchedulerTest, PollingPersistenceBadClock) { TEST_F(SyncSchedulerTest, PollNotificationsDisabled) { SyncShareTimes times; TimeDelta poll_interval(TimeDelta::FromMilliseconds(30)); - EXPECT_CALL(*syncer(), PollSyncShare(_,_)).Times(AtLeast(kMinNumSamples)) + EXPECT_CALL(*syncer(), PollSyncShare(_, _)) + .Times(AtLeast(kMinNumSamples)) .WillRepeatedly( DoAll(Invoke(sessions::test_util::SimulatePollSuccess), RecordSyncShareMultiple(×, kMinNumSamples, true))); @@ -667,15 +671,15 @@ TEST_F(SyncSchedulerTest, PollIntervalUpdate) { TimeDelta poll1(TimeDelta::FromMilliseconds(120)); TimeDelta poll2(TimeDelta::FromMilliseconds(30)); scheduler()->OnReceivedLongPollIntervalUpdate(poll1); - EXPECT_CALL(*syncer(), PollSyncShare(_,_)).Times(AtLeast(kMinNumSamples)) - .WillOnce(DoAll( - WithArgs<0,1>( - sessions::test_util::SimulatePollIntervalUpdate(poll2)), - Return(true))) - .WillRepeatedly( - DoAll(Invoke(sessions::test_util::SimulatePollSuccess), - WithArg<1>( - RecordSyncShareMultiple(×, kMinNumSamples, true)))); + EXPECT_CALL(*syncer(), PollSyncShare(_, _)) + .Times(AtLeast(kMinNumSamples)) + .WillOnce( + DoAll(WithArgs<0, 1>( + sessions::test_util::SimulatePollIntervalUpdate(poll2)), + Return(true))) + .WillRepeatedly(DoAll( + Invoke(sessions::test_util::SimulatePollSuccess), + WithArg<1>(RecordSyncShareMultiple(×, kMinNumSamples, true)))); TimeTicks optimal_start = TimeTicks::Now() + poll1 + poll2; StartSyncScheduler(base::Time()); @@ -694,10 +698,10 @@ TEST_F(SyncSchedulerTest, ThrottlingDoesThrottle) { TimeDelta throttle(TimeDelta::FromMinutes(10)); scheduler()->OnReceivedLongPollIntervalUpdate(poll); - EXPECT_CALL(*syncer(), ConfigureSyncShare(_,_,_)) - .WillOnce(DoAll( - WithArg<2>(sessions::test_util::SimulateThrottled(throttle)), - Return(false))) + EXPECT_CALL(*syncer(), ConfigureSyncShare(_, _, _)) + .WillOnce( + DoAll(WithArg<2>(sessions::test_util::SimulateThrottled(throttle)), + Return(false))) .WillRepeatedly(AddFailureAndQuitLoopNow()); StartSyncScheduler(base::Time()); @@ -728,12 +732,12 @@ TEST_F(SyncSchedulerTest, ThrottlingExpiresFromPoll) { scheduler()->OnReceivedLongPollIntervalUpdate(poll); ::testing::InSequence seq; - EXPECT_CALL(*syncer(), PollSyncShare(_,_)) - .WillOnce(DoAll( - WithArg<1>(sessions::test_util::SimulateThrottled(throttle1)), - Return(false))) + EXPECT_CALL(*syncer(), PollSyncShare(_, _)) + .WillOnce( + DoAll(WithArg<1>(sessions::test_util::SimulateThrottled(throttle1)), + Return(false))) .RetiresOnSaturation(); - EXPECT_CALL(*syncer(), PollSyncShare(_,_)) + EXPECT_CALL(*syncer(), PollSyncShare(_, _)) .WillRepeatedly( DoAll(Invoke(sessions::test_util::SimulatePollSuccess), RecordSyncShareMultiple(×, kMinNumSamples, true))); @@ -755,12 +759,12 @@ TEST_F(SyncSchedulerTest, ThrottlingExpiresFromNudge) { scheduler()->OnReceivedLongPollIntervalUpdate(poll); ::testing::InSequence seq; - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) - .WillOnce(DoAll( - WithArg<2>(sessions::test_util::SimulateThrottled(throttle1)), - Return(false))) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) + .WillOnce( + DoAll(WithArg<2>(sessions::test_util::SimulateThrottled(throttle1)), + Return(false))) .RetiresOnSaturation(); - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), QuitLoopNowAction(true))); @@ -768,8 +772,8 @@ TEST_F(SyncSchedulerTest, ThrottlingExpiresFromNudge) { StartSyncScheduler(base::Time()); scheduler()->ScheduleLocalNudge(types, FROM_HERE); - PumpLoop(); // To get PerformDelayedNudge called. - PumpLoop(); // To get TrySyncSessionJob called + PumpLoop(); // To get PerformDelayedNudge called. + PumpLoop(); // To get TrySyncSessionJob called EXPECT_TRUE(scheduler()->IsCurrentlyThrottled()); RunLoop(); EXPECT_FALSE(scheduler()->IsCurrentlyThrottled()); @@ -784,12 +788,12 @@ TEST_F(SyncSchedulerTest, ThrottlingExpiresFromConfigure) { scheduler()->OnReceivedLongPollIntervalUpdate(poll); ::testing::InSequence seq; - EXPECT_CALL(*syncer(), ConfigureSyncShare(_,_,_)) - .WillOnce(DoAll( - WithArg<2>(sessions::test_util::SimulateThrottled(throttle1)), - Return(false))) + EXPECT_CALL(*syncer(), ConfigureSyncShare(_, _, _)) + .WillOnce( + DoAll(WithArg<2>(sessions::test_util::SimulateThrottled(throttle1)), + Return(false))) .RetiresOnSaturation(); - EXPECT_CALL(*syncer(), ConfigureSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), ConfigureSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConfigureSuccess), QuitLoopNowAction(true))); @@ -828,17 +832,16 @@ TEST_F(SyncSchedulerTest, TypeThrottlingBlocksNudge) { const ModelTypeSet types(THEMES); ::testing::InSequence seq; - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) - .WillOnce(DoAll( - WithArg<2>( - sessions::test_util::SimulateTypesThrottled(types, throttle1)), - Return(false))) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) + .WillOnce(DoAll(WithArg<2>(sessions::test_util::SimulateTypesThrottled( + types, throttle1)), + Return(false))) .RetiresOnSaturation(); StartSyncScheduler(base::Time()); scheduler()->ScheduleLocalNudge(types, FROM_HERE); - PumpLoop(); // To get PerformDelayedNudge called. - PumpLoop(); // To get TrySyncSessionJob called + PumpLoop(); // To get PerformDelayedNudge called. + PumpLoop(); // To get TrySyncSessionJob called EXPECT_TRUE(GetThrottledTypes().HasAll(types)); // This won't cause a sync cycle because the types are throttled. @@ -862,18 +865,16 @@ TEST_F(SyncSchedulerTest, TypeThrottlingDoesBlockOtherSources) { const ModelTypeSet unthrottled_types(PREFERENCES); ::testing::InSequence seq; - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) - .WillOnce(DoAll( - WithArg<2>( - sessions::test_util::SimulateTypesThrottled( - throttled_types, throttle1)), - Return(false))) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) + .WillOnce(DoAll(WithArg<2>(sessions::test_util::SimulateTypesThrottled( + throttled_types, throttle1)), + Return(false))) .RetiresOnSaturation(); StartSyncScheduler(base::Time()); scheduler()->ScheduleLocalNudge(throttled_types, FROM_HERE); - PumpLoop(); // To get PerformDelayedNudge called. - PumpLoop(); // To get TrySyncSessionJob called + PumpLoop(); // To get PerformDelayedNudge called. + PumpLoop(); // To get TrySyncSessionJob called EXPECT_TRUE(GetThrottledTypes().HasAll(throttled_types)); // Ignore invalidations for throttled types. @@ -888,7 +889,7 @@ TEST_F(SyncSchedulerTest, TypeThrottlingDoesBlockOtherSources) { Mock::VerifyAndClearExpectations(syncer()); // Local nudges for non-throttled types will trigger a sync. - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillRepeatedly(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), RecordSyncShare(×, true))); scheduler()->ScheduleLocalNudge(unthrottled_types, FROM_HERE); @@ -912,7 +913,7 @@ TEST_F(SyncSchedulerTest, ConfigurationMode) { const ModelTypeSet config_types(THEMES); - EXPECT_CALL(*syncer(), ConfigureSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), ConfigureSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConfigureSuccess), RecordSyncShare(×, true))) .RetiresOnSaturation(); @@ -934,7 +935,7 @@ TEST_F(SyncSchedulerTest, ConfigurationMode) { // Switch to NORMAL_MODE to ensure NUDGES were properly saved and run. scheduler()->OnReceivedLongPollIntervalUpdate(TimeDelta::FromDays(1)); SyncShareTimes times2; - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), RecordSyncShare(×2, true))); @@ -964,7 +965,7 @@ class BackoffTriggersSyncSchedulerTest : public SyncSchedulerTest { // Have the syncer fail during commit. Expect that the scheduler enters // backoff. TEST_F(BackoffTriggersSyncSchedulerTest, FailCommitOnce) { - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateCommitFailed), QuitLoopNowAction(false))); EXPECT_TRUE(RunAndGetBackoff()); @@ -973,10 +974,10 @@ TEST_F(BackoffTriggersSyncSchedulerTest, FailCommitOnce) { // Have the syncer fail during download updates and succeed on the first // retry. Expect that this clears the backoff state. TEST_F(BackoffTriggersSyncSchedulerTest, FailDownloadOnceThenSucceed) { - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) - .WillOnce(DoAll( - Invoke(sessions::test_util::SimulateDownloadUpdatesFailed), - Return(false))) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) + .WillOnce( + DoAll(Invoke(sessions::test_util::SimulateDownloadUpdatesFailed), + Return(false))) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), QuitLoopNowAction(true))); EXPECT_FALSE(RunAndGetBackoff()); @@ -985,10 +986,9 @@ TEST_F(BackoffTriggersSyncSchedulerTest, FailDownloadOnceThenSucceed) { // Have the syncer fail during commit and succeed on the first retry. Expect // that this clears the backoff state. TEST_F(BackoffTriggersSyncSchedulerTest, FailCommitOnceThenSucceed) { - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) - .WillOnce(DoAll( - Invoke(sessions::test_util::SimulateCommitFailed), - Return(false))) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) + .WillOnce(DoAll(Invoke(sessions::test_util::SimulateCommitFailed), + Return(false))) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), QuitLoopNowAction(true))); EXPECT_FALSE(RunAndGetBackoff()); @@ -997,26 +997,26 @@ TEST_F(BackoffTriggersSyncSchedulerTest, FailCommitOnceThenSucceed) { // Have the syncer fail to download updates and fail again on the retry. // Expect this will leave the scheduler in backoff. TEST_F(BackoffTriggersSyncSchedulerTest, FailDownloadTwice) { - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) - .WillOnce(DoAll( - Invoke(sessions::test_util::SimulateDownloadUpdatesFailed), - Return(false))) - .WillRepeatedly(DoAll( - Invoke(sessions::test_util::SimulateDownloadUpdatesFailed), - QuitLoopNowAction(false))); + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) + .WillOnce( + DoAll(Invoke(sessions::test_util::SimulateDownloadUpdatesFailed), + Return(false))) + .WillRepeatedly( + DoAll(Invoke(sessions::test_util::SimulateDownloadUpdatesFailed), + QuitLoopNowAction(false))); EXPECT_TRUE(RunAndGetBackoff()); } // Have the syncer fail to get the encryption key yet succeed in downloading // updates. Expect this will leave the scheduler in backoff. TEST_F(BackoffTriggersSyncSchedulerTest, FailGetEncryptionKey) { - EXPECT_CALL(*syncer(), ConfigureSyncShare(_,_,_)) - .WillOnce(DoAll( - Invoke(sessions::test_util::SimulateGetEncryptionKeyFailed), - Return(false))) - .WillRepeatedly(DoAll( - Invoke(sessions::test_util::SimulateGetEncryptionKeyFailed), - QuitLoopNowAction(false))); + EXPECT_CALL(*syncer(), ConfigureSyncShare(_, _, _)) + .WillOnce( + DoAll(Invoke(sessions::test_util::SimulateGetEncryptionKeyFailed), + Return(false))) + .WillRepeatedly( + DoAll(Invoke(sessions::test_util::SimulateGetEncryptionKeyFailed), + QuitLoopNowAction(false))); StartSyncConfiguration(); ModelTypeSet types(THEMES); @@ -1042,7 +1042,7 @@ TEST_F(SyncSchedulerTest, BackoffDropsJobs) { scheduler()->OnReceivedLongPollIntervalUpdate(poll); UseMockDelayProvider(); - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateCommitFailed), RecordSyncShareMultiple(×, 1U, false))); EXPECT_CALL(*delay(), GetDelay(_)). @@ -1090,9 +1090,11 @@ TEST_F(SyncSchedulerTest, BackoffElevation) { SyncShareTimes times; UseMockDelayProvider(); - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)).Times(kMinNumSamples) - .WillRepeatedly(DoAll(Invoke(sessions::test_util::SimulateCommitFailed), - RecordSyncShareMultiple(×, kMinNumSamples, false))); + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) + .Times(kMinNumSamples) + .WillRepeatedly( + DoAll(Invoke(sessions::test_util::SimulateCommitFailed), + RecordSyncShareMultiple(×, kMinNumSamples, false))); const TimeDelta first = TimeDelta::FromSeconds(kInitialBackoffRetrySeconds); const TimeDelta second = TimeDelta::FromMilliseconds(20); @@ -1137,7 +1139,7 @@ TEST_F(SyncSchedulerTest, BackoffRelief) { StartSyncScheduler(base::Time()); // Kick off the test with a failed nudge. - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateCommitFailed), RecordSyncShare(×, false))); scheduler()->ScheduleLocalNudge(ModelTypeSet(THEMES), FROM_HERE); @@ -1148,10 +1150,9 @@ TEST_F(SyncSchedulerTest, BackoffRelief) { EXPECT_GE(times[0], optimal_job_time); // The retry succeeds. - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) - .WillOnce(DoAll( - Invoke(sessions::test_util::SimulateNormalSuccess), - RecordSyncShare(×, true))); + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) + .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), + RecordSyncShare(×, true))); RunLoop(); Mock::VerifyAndClearExpectations(syncer()); optimal_job_time = optimal_job_time + backoff; @@ -1159,10 +1160,10 @@ TEST_F(SyncSchedulerTest, BackoffRelief) { EXPECT_GE(times[1], optimal_job_time); // Now let the Poll timer do its thing. - EXPECT_CALL(*syncer(), PollSyncShare(_,_)) - .WillRepeatedly(DoAll( - Invoke(sessions::test_util::SimulatePollSuccess), - RecordSyncShareMultiple(×, kMinNumSamples, true))); + EXPECT_CALL(*syncer(), PollSyncShare(_, _)) + .WillRepeatedly( + DoAll(Invoke(sessions::test_util::SimulatePollSuccess), + RecordSyncShareMultiple(×, kMinNumSamples, true))); const TimeDelta poll(TimeDelta::FromMilliseconds(10)); scheduler()->OnReceivedLongPollIntervalUpdate(poll); @@ -1187,11 +1188,11 @@ TEST_F(SyncSchedulerTest, TransientPollFailure) { SyncShareTimes times; const TimeDelta poll_interval(TimeDelta::FromMilliseconds(10)); scheduler()->OnReceivedLongPollIntervalUpdate(poll_interval); - UseMockDelayProvider(); // Will cause test failure if backoff is initiated. + UseMockDelayProvider(); // Will cause test failure if backoff is initiated. EXPECT_CALL(*delay(), GetDelay(_)) .WillRepeatedly(Return(TimeDelta::FromMilliseconds(0))); - EXPECT_CALL(*syncer(), PollSyncShare(_,_)) + EXPECT_CALL(*syncer(), PollSyncShare(_, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollFailed), RecordSyncShare(×, false))) .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollSuccess), @@ -1213,11 +1214,11 @@ TEST_F(SyncSchedulerTest, TransientPollFailure) { TEST_F(SyncSchedulerTest, StartWhenNotConnected) { connection()->SetServerNotReachable(); connection()->UpdateConnectionStatus(); - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) - .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConnectionFailure), - Return(false))) - .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), - Return(true))); + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) + .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConnectionFailure), + Return(false))) + .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), + Return(true))); StartSyncScheduler(base::Time()); scheduler()->ScheduleLocalNudge(ModelTypeSet(THEMES), FROM_HERE); @@ -1239,15 +1240,15 @@ TEST_F(SyncSchedulerTest, ServerConnectionChangeDuringBackoff) { connection()->SetServerNotReachable(); connection()->UpdateConnectionStatus(); - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) - .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConnectionFailure), - Return(false))) - .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), - Return(true))); + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) + .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConnectionFailure), + Return(false))) + .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), + Return(true))); scheduler()->ScheduleLocalNudge(ModelTypeSet(THEMES), FROM_HERE); - PumpLoop(); // To get PerformDelayedNudge called. - PumpLoop(); // Run the nudge, that will fail and schedule a quick retry. + PumpLoop(); // To get PerformDelayedNudge called. + PumpLoop(); // Run the nudge, that will fail and schedule a quick retry. ASSERT_TRUE(scheduler()->IsBackingOff()); // Before we run the scheduled canary, trigger a server connection change. @@ -1269,18 +1270,18 @@ TEST_F(SyncSchedulerTest, ConnectionChangeCanaryPreemptedByNudge) { connection()->SetServerNotReachable(); connection()->UpdateConnectionStatus(); - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) - .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConnectionFailure), - Return(false))) - .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), - Return(true))) - .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), - QuitLoopNowAction(true))); + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) + .WillOnce(DoAll(Invoke(sessions::test_util::SimulateConnectionFailure), + Return(false))) + .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), + Return(true))) + .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), + QuitLoopNowAction(true))); scheduler()->ScheduleLocalNudge(ModelTypeSet(THEMES), FROM_HERE); - PumpLoop(); // To get PerformDelayedNudge called. - PumpLoop(); // Run the nudge, that will fail and schedule a quick retry. + PumpLoop(); // To get PerformDelayedNudge called. + PumpLoop(); // Run the nudge, that will fail and schedule a quick retry. ASSERT_TRUE(scheduler()->IsBackingOff()); // Before we run the scheduled canary, trigger a server connection change. @@ -1295,10 +1296,10 @@ TEST_F(SyncSchedulerTest, ConnectionChangeCanaryPreemptedByNudge) { // Tests that we don't crash trying to run two canaries at once if we receive // extra connection status change notifications. See crbug.com/190085. TEST_F(SyncSchedulerTest, DoubleCanaryInConfigure) { - EXPECT_CALL(*syncer(), ConfigureSyncShare(_,_,_)) - .WillRepeatedly(DoAll( - Invoke(sessions::test_util::SimulateConfigureConnectionFailure), - Return(true))); + EXPECT_CALL(*syncer(), ConfigureSyncShare(_, _, _)) + .WillRepeatedly( + DoAll(Invoke(sessions::test_util::SimulateConfigureConnectionFailure), + Return(true))); StartSyncConfiguration(); connection()->SetServerNotReachable(); connection()->UpdateConnectionStatus(); @@ -1326,7 +1327,7 @@ TEST_F(SyncSchedulerTest, PollFromCanaryAfterAuthError) { scheduler()->OnReceivedLongPollIntervalUpdate(poll); ::testing::InSequence seq; - EXPECT_CALL(*syncer(), PollSyncShare(_,_)) + EXPECT_CALL(*syncer(), PollSyncShare(_, _)) .WillRepeatedly( DoAll(Invoke(sessions::test_util::SimulatePollSuccess), RecordSyncShareMultiple(×, kMinNumSamples, true))); @@ -1340,7 +1341,7 @@ TEST_F(SyncSchedulerTest, PollFromCanaryAfterAuthError) { // Normally OnCredentialsUpdated calls TryCanaryJob that doesn't run Poll, // but after poll finished with auth error from poll timer it should retry // poll once more - EXPECT_CALL(*syncer(), PollSyncShare(_,_)) + EXPECT_CALL(*syncer(), PollSyncShare(_, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollSuccess), RecordSyncShare(×, true))); scheduler()->OnCredentialsUpdated(); @@ -1357,10 +1358,9 @@ TEST_F(SyncSchedulerTest, SuccessfulRetry) { scheduler()->OnReceivedGuRetryDelay(delay); EXPECT_EQ(delay, GetRetryTimerDelay()); - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) - .WillOnce( - DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), - RecordSyncShare(×, true))); + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) + .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), + RecordSyncShare(×, true))); // Run to wait for retrying. RunLoop(); @@ -1380,7 +1380,7 @@ TEST_F(SyncSchedulerTest, FailedRetry) { base::TimeDelta delay = base::TimeDelta::FromMilliseconds(10); scheduler()->OnReceivedGuRetryDelay(delay); - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce( DoAll(Invoke(sessions::test_util::SimulateDownloadUpdatesFailed), RecordSyncShare(×, false))); @@ -1389,10 +1389,9 @@ TEST_F(SyncSchedulerTest, FailedRetry) { RunLoop(); EXPECT_TRUE(scheduler()->IsBackingOff()); - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) - .WillOnce( - DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), - RecordSyncShare(×, true))); + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) + .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), + RecordSyncShare(×, true))); // Run to wait for second retrying. RunLoop(); @@ -1415,7 +1414,7 @@ TEST_F(SyncSchedulerTest, ReceiveNewRetryDelay) { scheduler()->OnReceivedGuRetryDelay(delay1); EXPECT_EQ(delay1, GetRetryTimerDelay()); - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll( WithoutArgs(VerifyRetryTimerDelay(this, delay1)), WithArg<2>(sessions::test_util::SimulateGuRetryDelayCommand(delay2)), @@ -1425,7 +1424,7 @@ TEST_F(SyncSchedulerTest, ReceiveNewRetryDelay) { RunLoop(); EXPECT_EQ(delay2, GetRetryTimerDelay()); - EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) + EXPECT_CALL(*syncer(), NormalSyncShare(_, _, _)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), RecordSyncShare(×, true))); diff --git a/sync/engine/syncer_unittest.cc b/sync/engine/syncer_unittest.cc index fff926c..8d21d59 100644 --- a/sync/engine/syncer_unittest.cc +++ b/sync/engine/syncer_unittest.cc @@ -176,7 +176,7 @@ void TypeDebugInfoCache::OnStatusCountersUpdated( status_counters_map_[type] = counters; } -} // namespace +} // namespace class SyncerTest : public testing::Test, public SyncSession::Delegate, @@ -237,7 +237,7 @@ class SyncerTest : public testing::Test, DVLOG(1) << "HandleSyncEngineEvent in unittest " << event.what_happened; // we only test for entry-specific events, not status changed ones. switch (event.what_happened) { - case SyncCycleEvent::SYNC_CYCLE_BEGIN: // Fall through. + case SyncCycleEvent::SYNC_CYCLE_BEGIN: // Fall through. case SyncCycleEvent::STATUS_CHANGED: case SyncCycleEvent::SYNC_CYCLE_ENDED: return; @@ -604,6 +604,7 @@ class SyncerTest : public testing::Test, sessions::NudgeTracker nudge_tracker_; scoped_ptr<MockDebugInfoGetter> debug_info_getter_; + private: DISALLOW_COPY_AND_ASSIGN(SyncerTest); }; @@ -2418,15 +2419,15 @@ TEST_F(SyncerTest, ConflictMatchingEntryHandlesUnsanitizedNames) { Entry A(&trans, GET_BY_ID, ids_.FromNumber(1)); ASSERT_TRUE(A.good()); - EXPECT_TRUE(A.GetIsUnsynced()== false); - EXPECT_TRUE(A.GetIsUnappliedUpdate()== false); - EXPECT_TRUE(A.GetServerVersion()== 20); + EXPECT_FALSE(A.GetIsUnsynced()); + EXPECT_FALSE(A.GetIsUnappliedUpdate()); + EXPECT_EQ(20, A.GetServerVersion()); Entry B(&trans, GET_BY_ID, ids_.FromNumber(2)); ASSERT_TRUE(B.good()); - EXPECT_TRUE(B.GetIsUnsynced()== false); - EXPECT_TRUE(B.GetIsUnappliedUpdate()== false); - EXPECT_TRUE(B.GetServerVersion()== 20); + EXPECT_FALSE(B.GetIsUnsynced()); + EXPECT_FALSE(B.GetIsUnappliedUpdate()); + EXPECT_EQ(20, B.GetServerVersion()); } } @@ -2460,15 +2461,15 @@ TEST_F(SyncerTest, ConflictMatchingEntryHandlesNormalNames) { Entry A(&trans, GET_BY_ID, ids_.FromNumber(1)); ASSERT_TRUE(A.good()); - EXPECT_TRUE(A.GetIsUnsynced()== false); - EXPECT_TRUE(A.GetIsUnappliedUpdate()== false); - EXPECT_TRUE(A.GetServerVersion()== 20); + EXPECT_FALSE(A.GetIsUnsynced()); + EXPECT_FALSE(A.GetIsUnappliedUpdate()); + EXPECT_EQ(20, A.GetServerVersion()); Entry B(&trans, GET_BY_ID, ids_.FromNumber(2)); ASSERT_TRUE(B.good()); - EXPECT_TRUE(B.GetIsUnsynced()== false); - EXPECT_TRUE(B.GetIsUnappliedUpdate()== false); - EXPECT_TRUE(B.GetServerVersion()== 20); + EXPECT_FALSE(B.GetIsUnsynced()); + EXPECT_FALSE(B.GetIsUnappliedUpdate()); + EXPECT_EQ(20, B.GetServerVersion()); } } @@ -2902,11 +2903,11 @@ TEST_F(SyncerTest, FolderSwapUpdate) { syncable::ReadTransaction trans(FROM_HERE, directory()); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(7801)); ASSERT_TRUE(id1.good()); - EXPECT_TRUE("fred" == id1.GetNonUniqueName()); + EXPECT_EQ("fred", id1.GetNonUniqueName()); EXPECT_TRUE(root_id_ == id1.GetParentId()); Entry id2(&trans, GET_BY_ID, ids_.FromNumber(1024)); ASSERT_TRUE(id2.good()); - EXPECT_TRUE("bob" == id2.GetNonUniqueName()); + EXPECT_EQ("bob", id2.GetNonUniqueName()); EXPECT_TRUE(root_id_ == id2.GetParentId()); } saw_syncer_event_ = false; @@ -2924,15 +2925,15 @@ TEST_F(SyncerTest, NameCollidingFolderSwapWorksFine) { syncable::ReadTransaction trans(FROM_HERE, directory()); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(7801)); ASSERT_TRUE(id1.good()); - EXPECT_TRUE("bob" == id1.GetNonUniqueName()); + EXPECT_EQ("bob", id1.GetNonUniqueName()); EXPECT_TRUE(root_id_ == id1.GetParentId()); Entry id2(&trans, GET_BY_ID, ids_.FromNumber(1024)); ASSERT_TRUE(id2.good()); - EXPECT_TRUE("fred" == id2.GetNonUniqueName()); + EXPECT_EQ("fred", id2.GetNonUniqueName()); EXPECT_TRUE(root_id_ == id2.GetParentId()); Entry id3(&trans, GET_BY_ID, ids_.FromNumber(4096)); ASSERT_TRUE(id3.good()); - EXPECT_TRUE("alice" == id3.GetNonUniqueName()); + EXPECT_EQ("alice", id3.GetNonUniqueName()); EXPECT_TRUE(root_id_ == id3.GetParentId()); } mock_server_->AddUpdateDirectory(1024, 0, "bob", 2, 20, @@ -2946,15 +2947,15 @@ TEST_F(SyncerTest, NameCollidingFolderSwapWorksFine) { syncable::ReadTransaction trans(FROM_HERE, directory()); Entry id1(&trans, GET_BY_ID, ids_.FromNumber(7801)); ASSERT_TRUE(id1.good()); - EXPECT_TRUE("fred" == id1.GetNonUniqueName()); + EXPECT_EQ("fred", id1.GetNonUniqueName()); EXPECT_TRUE(root_id_ == id1.GetParentId()); Entry id2(&trans, GET_BY_ID, ids_.FromNumber(1024)); ASSERT_TRUE(id2.good()); - EXPECT_TRUE("bob" == id2.GetNonUniqueName()); + EXPECT_EQ("bob", id2.GetNonUniqueName()); EXPECT_TRUE(root_id_ == id2.GetParentId()); Entry id3(&trans, GET_BY_ID, ids_.FromNumber(4096)); ASSERT_TRUE(id3.good()); - EXPECT_TRUE("bob" == id3.GetNonUniqueName()); + EXPECT_EQ("bob", id3.GetNonUniqueName()); EXPECT_TRUE(root_id_ == id3.GetParentId()); } saw_syncer_event_ = false; @@ -3431,8 +3432,8 @@ TEST_F(SyncerTest, SiblingDirectoriesBecomeCircular) { ASSERT_TRUE(A.good()); MutableEntry B(&wtrans, GET_BY_ID, ids_.FromNumber(2)); ASSERT_TRUE(B.good()); - EXPECT_TRUE(A.GetNonUniqueName()== "B"); - EXPECT_TRUE(B.GetNonUniqueName()== "B"); + EXPECT_EQ("B", A.GetNonUniqueName()); + EXPECT_EQ("B", B.GetNonUniqueName()); } } @@ -3598,11 +3599,11 @@ TEST_F(SyncerTest, ConflictResolverMergesLocalDeleteAndServerUpdate) { { syncable::ReadTransaction trans(FROM_HERE, directory()); Entry local_deleted(&trans, GET_BY_ID, ids_.FromNumber(1)); - EXPECT_TRUE(local_deleted.GetBaseVersion()== 10); - EXPECT_TRUE(local_deleted.GetIsUnappliedUpdate()== false); - EXPECT_TRUE(local_deleted.GetIsUnsynced()== true); - EXPECT_TRUE(local_deleted.GetIsDel()== true); - EXPECT_TRUE(local_deleted.GetIsDir()== false); + EXPECT_EQ(10, local_deleted.GetBaseVersion()); + EXPECT_FALSE(local_deleted.GetIsUnappliedUpdate()); + EXPECT_TRUE(local_deleted.GetIsUnsynced()); + EXPECT_TRUE(local_deleted.GetIsDel()); + EXPECT_FALSE(local_deleted.GetIsDir()); } } @@ -3637,11 +3638,11 @@ TEST_F(SyncerTest, UpdateFlipsTheFolderBit) { { syncable::ReadTransaction trans(FROM_HERE, directory()); Entry local_deleted(&trans, GET_BY_ID, ids_.FromNumber(1)); - EXPECT_TRUE(local_deleted.GetBaseVersion()== 1); - EXPECT_TRUE(local_deleted.GetIsUnappliedUpdate()== false); - EXPECT_TRUE(local_deleted.GetIsUnsynced()== true); - EXPECT_TRUE(local_deleted.GetIsDel()== true); - EXPECT_TRUE(local_deleted.GetIsDir()== true); + EXPECT_EQ(1, local_deleted.GetBaseVersion()); + EXPECT_FALSE(local_deleted.GetIsUnappliedUpdate()); + EXPECT_TRUE(local_deleted.GetIsUnsynced()); + EXPECT_TRUE(local_deleted.GetIsDel()); + EXPECT_TRUE(local_deleted.GetIsDir()); } } @@ -4010,8 +4011,8 @@ TEST_F(SyncerTest, EnsureWeSendUpOldParent) { EXPECT_TRUE(SyncShareNudge()); const sync_pb::CommitMessage& commit = mock_server_->last_sent_commit(); ASSERT_EQ(2, commit.entries_size()); - EXPECT_TRUE(commit.entries(0).parent_id_string() == "2"); - EXPECT_TRUE(commit.entries(0).old_parent_id() == "0"); + EXPECT_EQ("2", commit.entries(0).parent_id_string()); + EXPECT_EQ("0", commit.entries(0).old_parent_id()); EXPECT_FALSE(commit.entries(1).has_old_parent_id()); } @@ -4209,8 +4210,8 @@ TEST_F(SyncerTest, ClientTagIllegalUpdateIgnored) { ASSERT_TRUE(perm_folder.good()); EXPECT_FALSE(perm_folder.GetIsUnappliedUpdate()); EXPECT_FALSE(perm_folder.GetIsUnsynced()); - EXPECT_EQ(perm_folder.GetUniqueClientTag(), "permfolder"); - EXPECT_TRUE(perm_folder.GetNonUniqueName()== "permitem1"); + EXPECT_EQ("permfolder", perm_folder.GetUniqueClientTag()); + EXPECT_EQ("permitem1", perm_folder.GetNonUniqueName()); EXPECT_TRUE(perm_folder.GetId().ServerKnows()); } @@ -4232,7 +4233,7 @@ TEST_F(SyncerTest, ClientTagIllegalUpdateIgnored) { ASSERT_TRUE(perm_folder.good()); EXPECT_FALSE(perm_folder.GetIsUnappliedUpdate()); EXPECT_FALSE(perm_folder.GetIsUnsynced()); - EXPECT_EQ(perm_folder.GetNonUniqueName(), "permitem1"); + EXPECT_EQ("permitem1", perm_folder.GetNonUniqueName()); } } @@ -4287,7 +4288,7 @@ TEST_F(SyncerTest, ClientTagUncommittedTagMatchesUpdate) { EXPECT_FALSE(pref.GetIsDel()); EXPECT_FALSE(pref.GetIsUnappliedUpdate()); EXPECT_FALSE(pref.GetIsUnsynced()); - EXPECT_TRUE(10 < pref.GetBaseVersion()); + EXPECT_LT(10, pref.GetBaseVersion()); // Entry should have been given the new ID while preserving the // metahandle; client should have won the conflict resolution. EXPECT_EQ(original_metahandle, pref.GetMetahandle()); @@ -4589,7 +4590,7 @@ TEST_F(SyncerTest, UniqueServerTagUpdates) { ASSERT_TRUE(hurdle.good()); ASSERT_TRUE(!hurdle.GetIsDel()); ASSERT_TRUE(hurdle.GetUniqueServerTag().empty()); - ASSERT_TRUE(hurdle.GetNonUniqueName()== "bob"); + ASSERT_EQ("bob", hurdle.GetNonUniqueName()); // Try to lookup by the tagname. These should fail. Entry tag_alpha(&trans, GET_BY_SERVER_TAG, "alpha"); @@ -4615,19 +4616,19 @@ TEST_F(SyncerTest, UniqueServerTagUpdates) { Entry tag_alpha(&trans, GET_BY_SERVER_TAG, "alpha"); ASSERT_TRUE(tag_alpha.good()); ASSERT_TRUE(!tag_alpha.GetIsDel()); - ASSERT_TRUE(tag_alpha.GetUniqueServerTag()== "alpha"); - ASSERT_TRUE(tag_alpha.GetNonUniqueName()== "update1"); + ASSERT_EQ("alpha", tag_alpha.GetUniqueServerTag()); + ASSERT_EQ("update1", tag_alpha.GetNonUniqueName()); Entry tag_bob(&trans, GET_BY_SERVER_TAG, "bob"); ASSERT_TRUE(tag_bob.good()); ASSERT_TRUE(!tag_bob.GetIsDel()); - ASSERT_TRUE(tag_bob.GetUniqueServerTag()== "bob"); - ASSERT_TRUE(tag_bob.GetNonUniqueName()== "update2"); + ASSERT_EQ("bob", tag_bob.GetUniqueServerTag()); + ASSERT_EQ("update2", tag_bob.GetNonUniqueName()); // The old item should be unchanged. Entry hurdle(&trans, GET_BY_HANDLE, hurdle_handle); ASSERT_TRUE(hurdle.good()); ASSERT_TRUE(!hurdle.GetIsDel()); ASSERT_TRUE(hurdle.GetUniqueServerTag().empty()); - ASSERT_TRUE(hurdle.GetNonUniqueName()== "bob"); + ASSERT_EQ("bob", hurdle.GetNonUniqueName()); } } diff --git a/sync/engine/traffic_logger.h b/sync/engine/traffic_logger.h index 0205395..39997de 100644 --- a/sync/engine/traffic_logger.h +++ b/sync/engine/traffic_logger.h @@ -6,8 +6,8 @@ // To get the log run a debug build of chrome with the flag // --vmodule=traffic_logger=1. -#ifndef CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_LOGGER_H_ -#define CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_LOGGER_H_ +#ifndef SYNC_ENGINE_TRAFFIC_LOGGER_H_ +#define SYNC_ENGINE_TRAFFIC_LOGGER_H_ namespace sync_pb { class ClientToServerResponse; @@ -22,4 +22,4 @@ void LogClientToServerResponse( } // namespace syncer -#endif // CHROME_BROWSER_SYNC_ENGINE_TRAFFIC_LOGGER_H_ +#endif // SYNC_ENGINE_TRAFFIC_LOGGER_H_ diff --git a/sync/engine/update_applicator.h b/sync/engine/update_applicator.h index 55534ad..1fc8bb8 100644 --- a/sync/engine/update_applicator.h +++ b/sync/engine/update_applicator.h @@ -11,6 +11,7 @@ #ifndef SYNC_ENGINE_UPDATE_APPLICATOR_H_ #define SYNC_ENGINE_UPDATE_APPLICATOR_H_ +#include <set> #include <vector> #include "base/basictypes.h" @@ -34,7 +35,7 @@ class Cryptographer; class UpdateApplicator { public: - UpdateApplicator(Cryptographer* cryptographer); + explicit UpdateApplicator(Cryptographer* cryptographer); ~UpdateApplicator(); // Attempt to apply the specified updates. @@ -64,12 +65,12 @@ class UpdateApplicator { // Used to decrypt sensitive sync nodes. Cryptographer* cryptographer_; - DISALLOW_COPY_AND_ASSIGN(UpdateApplicator); - int updates_applied_; int encryption_conflicts_; int hierarchy_conflicts_; std::set<syncable::Id> simple_conflict_ids_; + + DISALLOW_COPY_AND_ASSIGN(UpdateApplicator); }; } // namespace syncer diff --git a/sync/internal_api/public/attachments/attachment_service_proxy.h b/sync/internal_api/public/attachments/attachment_service_proxy.h index 9953b8d..f7d1b3c 100644 --- a/sync/internal_api/public/attachments/attachment_service_proxy.h +++ b/sync/internal_api/public/attachments/attachment_service_proxy.h @@ -81,10 +81,11 @@ class SYNC_EXPORT AttachmentServiceProxy : public AttachmentService { void UploadAttachments(const AttachmentIdList& attachment_ids) override; protected: - friend class base::RefCountedThreadSafe<Core>; ~Core() override; private: + friend class base::RefCountedThreadSafe<Core>; + base::WeakPtr<AttachmentService> wrapped_; DISALLOW_COPY_AND_ASSIGN(Core); diff --git a/sync/internal_api/public/attachments/task_queue.h b/sync/internal_api/public/attachments/task_queue.h index fd92661..c46ce85 100644 --- a/sync/internal_api/public/attachments/task_queue.h +++ b/sync/internal_api/public/attachments/task_queue.h @@ -279,4 +279,4 @@ bool TaskQueue<T>::ShouldDispatch() { } // namespace syncer -#endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_TASK_QUEUE_H_ +#endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_TASK_QUEUE_H_ diff --git a/sync/internal_api/public/engine/model_safe_worker.h b/sync/internal_api/public/engine/model_safe_worker.h index bd78249..ee4e9a6 100644 --- a/sync/internal_api/public/engine/model_safe_worker.h +++ b/sync/internal_api/public/engine/model_safe_worker.h @@ -93,8 +93,6 @@ class SYNC_EXPORT ModelSafeWorker void WillDestroyCurrentMessageLoop() override; protected: - friend class base::RefCountedThreadSafe<ModelSafeWorker>; - explicit ModelSafeWorker(WorkerLoopDestructionObserver* observer); ~ModelSafeWorker() override; @@ -115,6 +113,8 @@ class SYNC_EXPORT ModelSafeWorker void SetWorkingLoopToCurrent(); private: + friend class base::RefCountedThreadSafe<ModelSafeWorker>; + void UnregisterForLoopDestructionAsync( base::Callback<void(ModelSafeGroup)> unregister_done_callback); diff --git a/sync/internal_api/public/http_bridge.h b/sync/internal_api/public/http_bridge.h index 2c25b5b..85ad32e 100644 --- a/sync/internal_api/public/http_bridge.h +++ b/sync/internal_api/public/http_bridge.h @@ -83,14 +83,13 @@ class SYNC_EXPORT HttpBridge : public base::RefCountedThreadSafe<HttpBridge>, net::URLRequestContextGetter* GetRequestContextGetterForTest() const; protected: - friend class base::RefCountedThreadSafe<HttpBridge>; - ~HttpBridge() override; // Protected virtual so the unit test can override to shunt network requests. virtual void MakeAsynchronousPost(); private: + friend class base::RefCountedThreadSafe<HttpBridge>; friend class SyncHttpBridgeTest; friend class ::HttpBridgeTest; diff --git a/sync/internal_api/public/util/immutable.h b/sync/internal_api/public/util/immutable.h index 23ac696..e11458c 100644 --- a/sync/internal_api/public/util/immutable.h +++ b/sync/internal_api/public/util/immutable.h @@ -97,10 +97,11 @@ class ImmutableCore } private: + friend class base::RefCountedThreadSafe<ImmutableCore<T, Traits>>; + ~ImmutableCore() { Traits::DestroyWrapper(&wrapper_); } - friend class base::RefCountedThreadSafe<ImmutableCore<T, Traits> >; // This is semantically const, but we can't mark it a such as we // modify it in the constructor. diff --git a/sync/protocol/proto_enum_conversions_unittest.cc b/sync/protocol/proto_enum_conversions_unittest.cc index db88a8f..247d918 100644 --- a/sync/protocol/proto_enum_conversions_unittest.cc +++ b/sync/protocol/proto_enum_conversions_unittest.cc @@ -88,7 +88,6 @@ TEST_F(ProtoEnumConversionsTest, GetErrorTypeString) { GetErrorTypeString, sync_pb::SyncEnums::UNKNOWN, sync_pb::SyncEnums::ErrorType_MAX); - } TEST_F(ProtoEnumConversionsTest, GetActionString) { diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc index 154d2f7..ddafb9c 100644 --- a/sync/protocol/proto_value_conversions.cc +++ b/sync/protocol/proto_value_conversions.cc @@ -6,6 +6,7 @@ #include "sync/protocol/proto_value_conversions.h" +#include <algorithm> #include <string> #include "base/base64.h" diff --git a/sync/protocol/proto_value_conversions_unittest.cc b/sync/protocol/proto_value_conversions_unittest.cc index 9796c68..7c2bb95 100644 --- a/sync/protocol/proto_value_conversions_unittest.cc +++ b/sync/protocol/proto_value_conversions_unittest.cc @@ -6,6 +6,8 @@ #include "sync/protocol/proto_value_conversions.h" +#include <string> + #include "base/memory/scoped_ptr.h" #include "base/strings/string_number_conversions.h" #include "base/time/time.h" diff --git a/sync/protocol/sync_protocol_error.h b/sync/protocol/sync_protocol_error.h index d65fd24..38c5f18 100644 --- a/sync/protocol/sync_protocol_error.h +++ b/sync/protocol/sync_protocol_error.h @@ -10,7 +10,7 @@ #include "sync/base/sync_export.h" #include "sync/internal_api/public/base/model_type.h" -namespace syncer{ +namespace syncer { enum SyncProtocolErrorType { // Success case. diff --git a/sync/sessions/data_type_tracker.cc b/sync/sessions/data_type_tracker.cc index 8103c00..b4d7bee 100644 --- a/sync/sessions/data_type_tracker.cc +++ b/sync/sessions/data_type_tracker.cc @@ -4,6 +4,8 @@ #include "sync/sessions/data_type_tracker.h" +#include <algorithm> + #include "base/logging.h" #include "sync/internal_api/public/base/invalidation_interface.h" #include "sync/sessions/nudge_tracker.h" diff --git a/sync/sessions/data_type_tracker.h b/sync/sessions/data_type_tracker.h index 0842197..a01d7c6 100644 --- a/sync/sessions/data_type_tracker.h +++ b/sync/sessions/data_type_tracker.h @@ -24,7 +24,7 @@ namespace sessions { // A class to track the per-type scheduling data. class DataTypeTracker { public: - explicit DataTypeTracker(); + DataTypeTracker(); ~DataTypeTracker(); // For STL compatibility, we do not forbid the creation of a default copy diff --git a/sync/sessions/directory_type_debug_info_emitter.cc b/sync/sessions/directory_type_debug_info_emitter.cc index e1a89e8..d6b8721 100644 --- a/sync/sessions/directory_type_debug_info_emitter.cc +++ b/sync/sessions/directory_type_debug_info_emitter.cc @@ -4,6 +4,8 @@ #include "sync/sessions/directory_type_debug_info_emitter.h" +#include <vector> + #include "sync/internal_api/public/sessions/status_counters.h" #include "sync/internal_api/public/sessions/type_debug_info_observer.h" #include "sync/syncable/entry.h" diff --git a/sync/sessions/nudge_tracker.cc b/sync/sessions/nudge_tracker.cc index bd1f20f..023e6e6 100644 --- a/sync/sessions/nudge_tracker.cc +++ b/sync/sessions/nudge_tracker.cc @@ -25,22 +25,22 @@ const int kSyncSchedulerDelayMilliseconds = 250; base::TimeDelta GetDefaultDelayForType(ModelType model_type, base::TimeDelta minimum_delay) { switch (model_type) { - case AUTOFILL: + case AUTOFILL: // Accompany types rely on nudges from other types, and hence have long // nudge delays. return base::TimeDelta::FromSeconds(kDefaultShortPollIntervalSeconds); - case BOOKMARKS: - case PREFERENCES: + case BOOKMARKS: + case PREFERENCES: // Types with sometimes automatic changes get longer delays to allow more // coalescing. return base::TimeDelta::FromMilliseconds(kSlowNudgeDelayMilliseconds); - case SESSIONS: - case FAVICON_IMAGES: - case FAVICON_TRACKING: + case SESSIONS: + case FAVICON_IMAGES: + case FAVICON_TRACKING: // Types with navigation triggered changes get longer delays to allow more // coalescing. return base::TimeDelta::FromSeconds(kDefaultSessionsCommitDelaySeconds); - default: + default: return minimum_delay; } } diff --git a/sync/sessions/nudge_tracker_unittest.cc b/sync/sessions/nudge_tracker_unittest.cc index db2bc3e..43577a3 100644 --- a/sync/sessions/nudge_tracker_unittest.cc +++ b/sync/sessions/nudge_tracker_unittest.cc @@ -2,10 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "sync/sessions/nudge_tracker.h" + +#include <string> +#include <vector> + #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "sync/internal_api/public/base/model_type_test_util.h" -#include "sync/sessions/nudge_tracker.h" #include "sync/test/mock_invalidation.h" #include "sync/test/mock_invalidation_tracker.h" #include "sync/test/trackable_mock_invalidation.h" @@ -196,7 +200,7 @@ TEST_F(NudgeTrackerTest, HintCoalescing) { ASSERT_EQ(2, bm_gu_trigger.notification_hint_size()); EXPECT_EQ("bm_hint_1", bm_gu_trigger.notification_hint(0)); EXPECT_EQ("bm_hint_2", - bm_gu_trigger.notification_hint(1)); // most recent last. + bm_gu_trigger.notification_hint(1)); // most recent last. EXPECT_FALSE(bm_gu_trigger.client_dropped_hints()); // Verify the new type, too. diff --git a/sync/sessions/test_util.cc b/sync/sessions/test_util.cc index c226a12..2b7fa0d 100644 --- a/sync/sessions/test_util.cc +++ b/sync/sessions/test_util.cc @@ -4,6 +4,8 @@ #include "sync/sessions/test_util.h" +#include <map> + namespace syncer { namespace sessions { namespace test_util { diff --git a/sync/syncable/dir_open_result.h b/sync/syncable/dir_open_result.h index 0df3c6c..2ba8d66 100644 --- a/sync/syncable/dir_open_result.h +++ b/sync/syncable/dir_open_result.h @@ -7,16 +7,17 @@ namespace syncer { namespace syncable { -enum DirOpenResult { NOT_INITIALIZED, - OPENED, // success. - FAILED_NEWER_VERSION, // DB version is too new. - FAILED_MAKE_REPOSITORY, // Couldn't create subdir. - FAILED_OPEN_DATABASE, // sqlite_open() failed. - FAILED_DISK_FULL, // The disk is full. - FAILED_DATABASE_CORRUPT, // Something is wrong with the DB - FAILED_LOGICAL_CORRUPTION, // Invalid database contents - FAILED_IN_UNITTEST, // For tests. - FAILED_INITIAL_WRITE, // Early write to DB failed. +enum DirOpenResult { + NOT_INITIALIZED, + OPENED, // success. + FAILED_NEWER_VERSION, // DB version is too new. + FAILED_MAKE_REPOSITORY, // Couldn't create subdir. + FAILED_OPEN_DATABASE, // sqlite_open() failed. + FAILED_DISK_FULL, // The disk is full. + FAILED_DATABASE_CORRUPT, // Something is wrong with the DB + FAILED_LOGICAL_CORRUPTION, // Invalid database contents + FAILED_IN_UNITTEST, // For tests. + FAILED_INITIAL_WRITE, // Early write to DB failed. }; } // namespace syncable } // namespace syncer diff --git a/sync/syncable/directory_backing_store.cc b/sync/syncable/directory_backing_store.cc index e57f246..54b573f 100644 --- a/sync/syncable/directory_backing_store.cc +++ b/sync/syncable/directory_backing_store.cc @@ -4,8 +4,6 @@ #include "sync/syncable/directory_backing_store.h" -#include "build/build_config.h" - #include <limits> #include "base/base64.h" @@ -16,6 +14,7 @@ #include "base/thread_task_runner_handle.h" #include "base/time/time.h" #include "base/trace_event/trace_event.h" +#include "build/build_config.h" #include "sql/connection.h" #include "sql/error_delegate_util.h" #include "sql/statement.h" @@ -1210,8 +1209,8 @@ bool DirectoryBackingStore::MigrateVersion79To80() { } bool DirectoryBackingStore::MigrateVersion80To81() { - if(!db_->Execute( - "ALTER TABLE metas ADD COLUMN server_ordinal_in_parent BLOB")) + if (!db_->Execute( + "ALTER TABLE metas ADD COLUMN server_ordinal_in_parent BLOB")) return false; sql::Statement get_positions(db_->GetUniqueStatement( @@ -1221,7 +1220,7 @@ bool DirectoryBackingStore::MigrateVersion80To81() { "UPDATE metas SET server_ordinal_in_parent = ?" "WHERE metahandle = ?")); - while(get_positions.Step()) { + while (get_positions.Step()) { int64 metahandle = get_positions.ColumnInt64(0); int64 position = get_positions.ColumnInt64(1); @@ -1229,7 +1228,7 @@ bool DirectoryBackingStore::MigrateVersion80To81() { put_ordinals.BindBlob(0, ordinal.data(), ordinal.length()); put_ordinals.BindInt64(1, metahandle); - if(!put_ordinals.Run()) + if (!put_ordinals.Run()) return false; put_ordinals.Reset(true); } @@ -1390,7 +1389,7 @@ bool DirectoryBackingStore::MigrateVersion85To86() { // when we see updates for this item. That should ensure that commonly // modified items will end up with the proper tag values eventually. unique_bookmark_tag = syncable::GenerateSyncableBookmarkHash( - std::string(), // cache_guid left intentionally blank. + std::string(), // cache_guid left intentionally blank. id_string.substr(1)); } diff --git a/sync/syncable/directory_unittest.cc b/sync/syncable/directory_unittest.cc index a9d8058..c5eae75 100644 --- a/sync/syncable/directory_unittest.cc +++ b/sync/syncable/directory_unittest.cc @@ -700,7 +700,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); dir()->GetUnsyncedMetaHandles(&trans, &handles); - ASSERT_TRUE(0 == handles.size()); + ASSERT_EQ(0u, handles.size()); MutableEntry e1(&trans, CREATE, BOOKMARKS, trans.root_id(), "abba"); ASSERT_TRUE(e1.good()); @@ -720,7 +720,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); dir()->GetUnsyncedMetaHandles(&trans, &handles); - ASSERT_TRUE(0 == handles.size()); + ASSERT_EQ(0u, handles.size()); MutableEntry e3(&trans, GET_BY_HANDLE, handle1); ASSERT_TRUE(e3.good()); @@ -730,7 +730,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) { { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); dir()->GetUnsyncedMetaHandles(&trans, &handles); - ASSERT_TRUE(1 == handles.size()); + ASSERT_EQ(1u, handles.size()); ASSERT_TRUE(handle1 == handles[0]); MutableEntry e4(&trans, GET_BY_HANDLE, handle2); @@ -741,7 +741,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) { { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); dir()->GetUnsyncedMetaHandles(&trans, &handles); - ASSERT_TRUE(2 == handles.size()); + ASSERT_EQ(2u, handles.size()); if (handle1 == handles[0]) { ASSERT_TRUE(handle2 == handles[1]); } else { @@ -759,7 +759,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) { { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); dir()->GetUnsyncedMetaHandles(&trans, &handles); - ASSERT_TRUE(1 == handles.size()); + ASSERT_EQ(1u, handles.size()); ASSERT_TRUE(handle2 == handles[0]); } } @@ -772,7 +772,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); dir()->GetUnappliedUpdateMetaHandles(&trans, all_types, &handles); - ASSERT_TRUE(0 == handles.size()); + ASSERT_EQ(0u, handles.size()); MutableEntry e1(&trans, CREATE, BOOKMARKS, trans.root_id(), "abba"); ASSERT_TRUE(e1.good()); @@ -794,7 +794,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); dir()->GetUnappliedUpdateMetaHandles(&trans, all_types, &handles); - ASSERT_TRUE(0 == handles.size()); + ASSERT_EQ(0u, handles.size()); MutableEntry e3(&trans, GET_BY_HANDLE, handle1); ASSERT_TRUE(e3.good()); @@ -804,7 +804,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); dir()->GetUnappliedUpdateMetaHandles(&trans, all_types, &handles); - ASSERT_TRUE(1 == handles.size()); + ASSERT_EQ(1u, handles.size()); ASSERT_TRUE(handle1 == handles[0]); MutableEntry e4(&trans, GET_BY_HANDLE, handle2); @@ -815,7 +815,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); dir()->GetUnappliedUpdateMetaHandles(&trans, all_types, &handles); - ASSERT_TRUE(2 == handles.size()); + ASSERT_EQ(2u, handles.size()); if (handle1 == handles[0]) { ASSERT_TRUE(handle2 == handles[1]); } else { @@ -831,7 +831,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); dir()->GetUnappliedUpdateMetaHandles(&trans, all_types, &handles); - ASSERT_TRUE(1 == handles.size()); + ASSERT_EQ(1u, handles.size()); ASSERT_TRUE(handle2 == handles[0]); } } @@ -1668,7 +1668,7 @@ class StressTransactionsDelegate : public base::PlatformThread::Delegate { const int rand_action = rand() % 10; if (rand_action < 4 && !path_name.empty()) { ReadTransaction trans(FROM_HERE, dir_); - CHECK(1 == CountEntriesWithName(&trans, trans.root_id(), path_name)); + EXPECT_EQ(1, CountEntriesWithName(&trans, trans.root_id(), path_name)); base::PlatformThread::Sleep( base::TimeDelta::FromMilliseconds(rand() % 10)); } else { @@ -1677,7 +1677,7 @@ class StressTransactionsDelegate : public base::PlatformThread::Delegate { path_name.assign(unique_name.begin(), unique_name.end()); WriteTransaction trans(FROM_HERE, UNITTEST, dir_); MutableEntry e(&trans, CREATE, BOOKMARKS, trans.root_id(), path_name); - CHECK(e.good()); + EXPECT_TRUE(e.good()); base::PlatformThread::Sleep( base::TimeDelta::FromMilliseconds(rand() % 20)); e.PutIsUnsynced(true); @@ -2119,7 +2119,7 @@ TEST_F(SyncableDirectoryTest, InitialSyncEndedForType) { // Create the root node. ModelNeutralMutableEntry entry(&trans, syncable::CREATE_NEW_TYPE_ROOT, PREFERENCES); - DCHECK(entry.good()); + ASSERT_TRUE(entry.good()); entry.PutServerIsDir(true); entry.PutUniqueServerTag(ModelTypeToRootTag(PREFERENCES)); diff --git a/sync/syncable/entry.h b/sync/syncable/entry.h index 47a7815..cf9b9af 100644 --- a/sync/syncable/entry.h +++ b/sync/syncable/entry.h @@ -5,6 +5,9 @@ #ifndef SYNC_SYNCABLE_ENTRY_H_ #define SYNC_SYNCABLE_ENTRY_H_ +#include <string> +#include <vector> + #include "sync/base/sync_export.h" #include "sync/syncable/entry_kernel.h" @@ -216,7 +219,7 @@ class SYNC_EXPORT Entry { } bool GetSyncing() const; - bool GetDirtySync() const ; + bool GetDirtySync() const; ModelType GetServerModelType() const; ModelType GetModelType() const; diff --git a/sync/syncable/entry_kernel.cc b/sync/syncable/entry_kernel.cc index 8fb611f..ec7575b 100644 --- a/sync/syncable/entry_kernel.cc +++ b/sync/syncable/entry_kernel.cc @@ -287,5 +287,5 @@ std::ostream& operator<<(std::ostream& os, const EntryKernel& entry_kernel) { return os; } -} // namespace syncer } // namespace syncable +} // namespace syncer diff --git a/sync/syncable/metahandle_set.h b/sync/syncable/metahandle_set.h index 5b4e425..acb5c27 100644 --- a/sync/syncable/metahandle_set.h +++ b/sync/syncable/metahandle_set.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SYNC_SYNCABLE_METAHANDLE_SET_ -#define SYNC_SYNCABLE_METAHANDLE_SET_ +#ifndef SYNC_SYNCABLE_METAHANDLE_SET_H_ +#define SYNC_SYNCABLE_METAHANDLE_SET_H_ #include <set> @@ -17,4 +17,4 @@ typedef std::set<int64> MetahandleSet; } // namespace syncable } // namespace syncer -#endif // SYNC_SYNCABLE_METAHANDLE_SET_ +#endif // SYNC_SYNCABLE_METAHANDLE_SET_H_ diff --git a/sync/syncable/model_neutral_mutable_entry.cc b/sync/syncable/model_neutral_mutable_entry.cc index 1c75b64..46486f7 100644 --- a/sync/syncable/model_neutral_mutable_entry.cc +++ b/sync/syncable/model_neutral_mutable_entry.cc @@ -402,7 +402,7 @@ void ModelNeutralMutableEntry::PutBaseServerSpecifics( void ModelNeutralMutableEntry::PutServerUniquePosition( const UniquePosition& value) { DCHECK(kernel_); - if(!kernel_->ref(SERVER_UNIQUE_POSITION).Equals(value)) { + if (!kernel_->ref(SERVER_UNIQUE_POSITION).Equals(value)) { base_write_transaction_->TrackChangesTo(kernel_); // We should never overwrite a valid position with an invalid one. DCHECK(value.IsValid()); diff --git a/sync/syncable/mutable_entry.cc b/sync/syncable/mutable_entry.cc index 7c42b48..978bbe7 100644 --- a/sync/syncable/mutable_entry.cc +++ b/sync/syncable/mutable_entry.cc @@ -237,7 +237,7 @@ void MutableEntry::PutSpecifics(const sync_pb::EntitySpecifics& value) { void MutableEntry::PutUniquePosition(const UniquePosition& value) { DCHECK(kernel_); - if(!kernel_->ref(UNIQUE_POSITION).Equals(value)) { + if (!kernel_->ref(UNIQUE_POSITION).Equals(value)) { write_transaction()->TrackChangesTo(kernel_); // We should never overwrite a valid position with an invalid one. DCHECK(value.IsValid()); diff --git a/sync/syncable/nigori_handler.cc b/sync/syncable/nigori_handler.cc index e193c893..fd8a9a3 100644 --- a/sync/syncable/nigori_handler.cc +++ b/sync/syncable/nigori_handler.cc @@ -10,5 +10,5 @@ namespace syncable { NigoriHandler::NigoriHandler() {} NigoriHandler::~NigoriHandler() {} -} // namespace syncer } // namespace syncable +} // namespace syncer diff --git a/sync/syncable/parent_child_index_unittest.cc b/sync/syncable/parent_child_index_unittest.cc index 26ccb52..50aeca1 100644 --- a/sync/syncable/parent_child_index_unittest.cc +++ b/sync/syncable/parent_child_index_unittest.cc @@ -5,6 +5,7 @@ #include "sync/syncable/parent_child_index.h" #include <list> +#include <string> #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" @@ -176,10 +177,10 @@ TEST_F(ParentChildIndexTest, ChildInsertionAndIteration) { EntryKernel* b4 = MakeBookmark(4, 4, false); // Insert them out-of-order to test different cases. - index_.Insert(b3); // Only child. - index_.Insert(b4); // Right-most child. - index_.Insert(b1); // Left-most child. - index_.Insert(b2); // Between existing items. + index_.Insert(b3); // Only child. + index_.Insert(b4); // Right-most child. + index_.Insert(b1); // Left-most child. + index_.Insert(b2); // Between existing items. // Double-check they've been added. EXPECT_TRUE(index_.Contains(b1)); diff --git a/sync/syncable/scoped_kernel_lock.h b/sync/syncable/scoped_kernel_lock.h index c684810..942faef 100644 --- a/sync/syncable/scoped_kernel_lock.h +++ b/sync/syncable/scoped_kernel_lock.h @@ -20,6 +20,8 @@ class ScopedKernelLock { base::AutoLock scoped_lock_; const Directory* const dir_; + + private: DISALLOW_COPY_AND_ASSIGN(ScopedKernelLock); }; diff --git a/sync/syncable/scoped_parent_child_index_updater.cc b/sync/syncable/scoped_parent_child_index_updater.cc index 0dc3e95..dc48edd 100644 --- a/sync/syncable/scoped_parent_child_index_updater.cc +++ b/sync/syncable/scoped_parent_child_index_updater.cc @@ -10,9 +10,10 @@ namespace syncer { namespace syncable { ScopedParentChildIndexUpdater::ScopedParentChildIndexUpdater( - ScopedKernelLock& proof_of_lock, + const ScopedKernelLock& proof_of_lock, EntryKernel* entry, - ParentChildIndex* index) : entry_(entry), index_(index) { + ParentChildIndex* index) + : entry_(entry), index_(index) { if (ParentChildIndex::ShouldInclude(entry_)) { index_->Remove(entry_); } @@ -24,5 +25,5 @@ ScopedParentChildIndexUpdater::~ScopedParentChildIndexUpdater() { } } -} // namespace syncer } // namespace syncable +} // namespace syncer diff --git a/sync/syncable/scoped_parent_child_index_updater.h b/sync/syncable/scoped_parent_child_index_updater.h index 89385feb..29bda16 100644 --- a/sync/syncable/scoped_parent_child_index_updater.h +++ b/sync/syncable/scoped_parent_child_index_updater.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SYNC_SYNCABLE_PARENT_CHILD_INDEX_UPDATER_H_ -#define SYNC_SYNCABLE_PARENT_CHILD_INDEX_UPDATER_H_ +#ifndef SYNC_SYNCABLE_SCOPED_PARENT_CHILD_INDEX_UPDATER_H_ +#define SYNC_SYNCABLE_SCOPED_PARENT_CHILD_INDEX_UPDATER_H_ #include "base/basictypes.h" #include "sync/base/sync_export.h" @@ -19,7 +19,7 @@ struct EntryKernel; // object goes out of scope. class ScopedParentChildIndexUpdater { public: - ScopedParentChildIndexUpdater(ScopedKernelLock& proof_of_lock, + ScopedParentChildIndexUpdater(const ScopedKernelLock& proof_of_lock, EntryKernel* entry, ParentChildIndex* index); ~ScopedParentChildIndexUpdater(); @@ -31,7 +31,7 @@ class ScopedParentChildIndexUpdater { DISALLOW_COPY_AND_ASSIGN(ScopedParentChildIndexUpdater); }; -} // namespace syncer } // namespace syncable +} // namespace syncer -#endif // SYNC_SYNCABLE_PARENT_CHILD_INDEX_UPDATER_H_ +#endif // SYNC_SYNCABLE_SCOPED_PARENT_CHILD_INDEX_UPDATER_H_ diff --git a/sync/syncable/syncable_base_transaction.h b/sync/syncable/syncable_base_transaction.h index 58c7bfa..8921623 100644 --- a/sync/syncable/syncable_base_transaction.h +++ b/sync/syncable/syncable_base_transaction.h @@ -5,6 +5,8 @@ #ifndef SYNC_SYNCABLE_SYNCABLE_BASE_TRANSACTION_H_ #define SYNC_SYNCABLE_SYNCABLE_BASE_TRANSACTION_H_ +#include <string> + #include "base/location.h" #include "sync/base/sync_export.h" #include "sync/syncable/syncable_id.h" diff --git a/sync/syncable/syncable_delete_journal.h b/sync/syncable/syncable_delete_journal.h index b475850..bba5321 100644 --- a/sync/syncable/syncable_delete_journal.h +++ b/sync/syncable/syncable_delete_journal.h @@ -28,8 +28,6 @@ typedef std::set<const EntryKernel*, LessField<IdField, ID> > JournalIndex; // method requires a non-null |trans| parameter. class SYNC_EXPORT DeleteJournal { public: - FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, ManageDeleteJournals); - // Initialize |delete_journals_| using |intitial_journal|, whose content is // destroyed during initialization. explicit DeleteJournal(JournalIndex* initial_journal); @@ -81,6 +79,8 @@ class SYNC_EXPORT DeleteJournal { static bool IsDeleteJournalEnabled(ModelType type); private: + FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, ManageDeleteJournals); + // Contains deleted entries that may not be persisted in native models. And // in case of unrecoverable error, all purged entries are moved here for // bookkeeping to prevent back-from-dead entries that are deleted elsewhere diff --git a/sync/syncable/syncable_enum_conversions.cc b/sync/syncable/syncable_enum_conversions.cc index fe8cd5d4..6ac1fdc 100644 --- a/sync/syncable/syncable_enum_conversions.cc +++ b/sync/syncable/syncable_enum_conversions.cc @@ -151,7 +151,7 @@ const char* GetUniquePositionFieldString(UniquePositionField position_field) { ASSERT_ENUM_BOUNDS(SERVER_UNIQUE_POSITION, UNIQUE_POSITION, UNIQUE_POSITION_FIELDS_BEGIN, UNIQUE_POSITION_FIELDS_END - 1); - switch(position_field) { + switch (position_field) { ENUM_CASE(SERVER_UNIQUE_POSITION); ENUM_CASE(UNIQUE_POSITION); case UNIQUE_POSITION_FIELDS_END: break; @@ -166,7 +166,7 @@ const char* GetAttachmentMetadataFieldString( SERVER_ATTACHMENT_METADATA, ATTACHMENT_METADATA_FIELDS_BEGIN, ATTACHMENT_METADATA_FIELDS_END - 1); - switch(attachment_metadata_field) { + switch (attachment_metadata_field) { ENUM_CASE(ATTACHMENT_METADATA); ENUM_CASE(SERVER_ATTACHMENT_METADATA); case ATTACHMENT_METADATA_FIELDS_END: break; diff --git a/sync/syncable/syncable_model_neutral_write_transaction.cc b/sync/syncable/syncable_model_neutral_write_transaction.cc index 9aaf740..d7981d2 100644 --- a/sync/syncable/syncable_model_neutral_write_transaction.cc +++ b/sync/syncable/syncable_model_neutral_write_transaction.cc @@ -29,5 +29,5 @@ void ModelNeutralWriteTransaction::TrackChangesTo(const EntryKernel* entry) { modified_handles_.insert(entry->ref(META_HANDLE)); } -} // namespace syncer } // namespace syncable +} // namespace syncer diff --git a/sync/syncable/syncable_read_transaction.h b/sync/syncable/syncable_read_transaction.h index a13f92f..4ee325f 100644 --- a/sync/syncable/syncable_read_transaction.h +++ b/sync/syncable/syncable_read_transaction.h @@ -21,9 +21,11 @@ class SYNC_EXPORT ReadTransaction : public BaseTransaction { ~ReadTransaction() override; protected: // Don't allow creation on heap, except by sync API wrapper. - friend class syncer::ReadTransaction; void* operator new(size_t size) { return (::operator new)(size); } + private: + friend class syncer::ReadTransaction; + DISALLOW_COPY_AND_ASSIGN(ReadTransaction); }; diff --git a/sync/syncable/syncable_unittest.cc b/sync/syncable/syncable_unittest.cc index 6430aab..c4d5443 100644 --- a/sync/syncable/syncable_unittest.cc +++ b/sync/syncable/syncable_unittest.cc @@ -54,12 +54,10 @@ class TestBackingStore : public OnDiskDirectoryBackingStore { bool SaveChanges(const Directory::SaveChangesSnapshot& snapshot) override; - void StartFailingSaveChanges() { - fail_save_changes_ = true; - } + void StartFailingSaveChanges() { fail_save_changes_ = true; } private: - bool fail_save_changes_; + bool fail_save_changes_; }; TestBackingStore::TestBackingStore(const std::string& dir_name, @@ -71,7 +69,7 @@ TestBackingStore::TestBackingStore(const std::string& dir_name, TestBackingStore::~TestBackingStore() { } bool TestBackingStore::SaveChanges( - const Directory::SaveChangesSnapshot& snapshot){ + const Directory::SaveChangesSnapshot& snapshot) { if (fail_save_changes_) { return false; } else { @@ -84,7 +82,7 @@ class TestDirectory : public Directory { public: // A factory function used to work around some initialization order issues. static TestDirectory* Create( - Encryptor *encryptor, + Encryptor* encryptor, const WeakHandle<UnrecoverableErrorHandler>& handler, const std::string& dir_name, const base::FilePath& backing_filepath); @@ -104,7 +102,7 @@ class TestDirectory : public Directory { }; TestDirectory* TestDirectory::Create( - Encryptor *encryptor, + Encryptor* encryptor, const WeakHandle<UnrecoverableErrorHandler>& handler, const std::string& dir_name, const base::FilePath& backing_filepath) { @@ -193,7 +191,7 @@ class OnDiskSyncableDirectoryTest : public SyncableDirectoryTest { test_directory_->StartFailingSaveChanges(); } - TestDirectory *test_directory_; // mirrors scoped_ptr<Directory> dir_ + TestDirectory* test_directory_; // mirrors scoped_ptr<Directory> dir_ base::ScopedTempDir temp_dir_; base::FilePath file_path_; }; diff --git a/sync/syncable/syncable_util_unittest.cc b/sync/syncable/syncable_util_unittest.cc index 8f818f0..c94ead6 100644 --- a/sync/syncable/syncable_util_unittest.cc +++ b/sync/syncable/syncable_util_unittest.cc @@ -28,5 +28,5 @@ TEST(SyncableUtilTest, GenerateSyncableHash) { } } // namespace -} // namespace syncer } // namespace syncable +} // namespace syncer diff --git a/sync/syncable/syncable_write_transaction.cc b/sync/syncable/syncable_write_transaction.cc index 6a5557f..1e1ac56 100644 --- a/sync/syncable/syncable_write_transaction.cc +++ b/sync/syncable/syncable_write_transaction.cc @@ -4,6 +4,8 @@ #include "sync/syncable/syncable_write_transaction.h" +#include <string> + #include "sync/syncable/directory.h" #include "sync/syncable/directory_change_delegate.h" #include "sync/syncable/mutable_entry.h" @@ -177,7 +179,7 @@ std::string WriterTagToString(WriterTag writer_tag) { ENUM_CASE(HANDLE_SAVE_FAILURE); ENUM_CASE(PURGE_ENTRIES); ENUM_CASE(SYNCAPI); - }; + } NOTREACHED(); return std::string(); } diff --git a/sync/syncable/syncable_write_transaction.h b/sync/syncable/syncable_write_transaction.h index 93942c7..f85b035 100644 --- a/sync/syncable/syncable_write_transaction.h +++ b/sync/syncable/syncable_write_transaction.h @@ -5,6 +5,8 @@ #ifndef SYNC_SYNCABLE_SYNCABLE_WRITE_TRANSACTION_H_ #define SYNC_SYNCABLE_SYNCABLE_WRITE_TRANSACTION_H_ +#include <vector> + #include "sync/base/sync_export.h" #include "sync/syncable/entry_kernel.h" #include "sync/syncable/syncable_base_write_transaction.h" @@ -65,4 +67,4 @@ class SYNC_EXPORT WriteTransaction : public BaseWriteTransaction { } // namespace syncable } // namespace syncer -#endif // SYNC_SYNCABLE_SYNCABLE_WRITE_TRANSACTION_H_ +#endif // SYNC_SYNCABLE_SYNCABLE_WRITE_TRANSACTION_H_ diff --git a/sync/syncable/write_transaction_info.h b/sync/syncable/write_transaction_info.h index 823a66c..0b571d2 100644 --- a/sync/syncable/write_transaction_info.h +++ b/sync/syncable/write_transaction_info.h @@ -5,6 +5,8 @@ #ifndef SYNC_SYNCABLE_WRITE_TRANSACTION_INFO_H_ #define SYNC_SYNCABLE_WRITE_TRANSACTION_INFO_H_ +#include <string> + #include "sync/syncable/entry_kernel.h" #include "sync/syncable/syncable_base_transaction.h" diff --git a/sync/test/directory_backing_store_corruption_testing.cc b/sync/test/directory_backing_store_corruption_testing.cc index 9350369f..7418465 100644 --- a/sync/test/directory_backing_store_corruption_testing.cc +++ b/sync/test/directory_backing_store_corruption_testing.cc @@ -4,6 +4,8 @@ #include "sync/test/directory_backing_store_corruption_testing.h" +#include <string> + #include "base/files/file_util.h" #include "base/files/scoped_file.h" @@ -32,6 +34,6 @@ bool CorruptDatabase(const base::FilePath& backing_file_path) { return num_written == 1U; } -} // namespace corruption_util +} // namespace corruption_testing } // namespace syncable } // namespace syncer diff --git a/sync/test/directory_backing_store_corruption_testing.h b/sync/test/directory_backing_store_corruption_testing.h index 5897ec0..cf87422 100644 --- a/sync/test/directory_backing_store_corruption_testing.h +++ b/sync/test/directory_backing_store_corruption_testing.h @@ -20,7 +20,7 @@ extern const int kNumEntriesRequiredForCorruption; // Returns true if the database was successfully corrupted. bool CorruptDatabase(const base::FilePath& backing_file_path); -} // namespace corruption_util +} // namespace corruption_testing } // namespace syncable } // namespace syncer diff --git a/sync/test/engine/fake_sync_scheduler.cc b/sync/test/engine/fake_sync_scheduler.cc index f166754..894c01f 100644 --- a/sync/test/engine/fake_sync_scheduler.cc +++ b/sync/test/engine/fake_sync_scheduler.cc @@ -48,11 +48,9 @@ void FakeSyncScheduler::SetNotificationsEnabled(bool notifications_enabled) { } void FakeSyncScheduler::OnCredentialsUpdated() { - } void FakeSyncScheduler::OnConnectionStatusChange() { - } void FakeSyncScheduler::OnThrottled( diff --git a/sync/test/engine/fake_sync_scheduler.h b/sync/test/engine/fake_sync_scheduler.h index 09b7d70..0fe9438 100644 --- a/sync/test/engine/fake_sync_scheduler.h +++ b/sync/test/engine/fake_sync_scheduler.h @@ -9,6 +9,8 @@ #ifndef SYNC_TEST_ENGINE_FAKE_SYNC_SCHEDULER_H_ #define SYNC_TEST_ENGINE_FAKE_SYNC_SCHEDULER_H_ +#include <map> + #include "base/message_loop/message_loop.h" #include "sync/engine/sync_scheduler.h" diff --git a/sync/test/engine/mock_commit_queue.cc b/sync/test/engine/mock_commit_queue.cc index 347d40b..e3a9a12 100644 --- a/sync/test/engine/mock_commit_queue.cc +++ b/sync/test/engine/mock_commit_queue.cc @@ -176,4 +176,4 @@ void MockCommitQueue::SetServerVersion(const std::string& tag_hash, server_versions_[tag_hash] = version; } -} // namespace syncer +} // namespace syncer_v2 diff --git a/sync/test/engine/mock_commit_queue.h b/sync/test/engine/mock_commit_queue.h index 25dd8f7..65a6e11 100644 --- a/sync/test/engine/mock_commit_queue.h +++ b/sync/test/engine/mock_commit_queue.h @@ -5,6 +5,8 @@ #ifndef SYNC_TEST_ENGINE_MOCK_COMMIT_QUEUE_H_ #define SYNC_TEST_ENGINE_MOCK_COMMIT_QUEUE_H_ +#include <map> +#include <string> #include <vector> #include "base/macros.h" @@ -83,6 +85,6 @@ class MockCommitQueue : public CommitQueue { DISALLOW_COPY_AND_ASSIGN(MockCommitQueue); }; -} // namespace syncer +} // namespace syncer_v2 #endif // SYNC_TEST_ENGINE_MOCK_COMMIT_QUEUE_H_ diff --git a/sync/test/engine/mock_model_type_processor.cc b/sync/test/engine/mock_model_type_processor.cc index ec4e2fe..8f2f947 100644 --- a/sync/test/engine/mock_model_type_processor.cc +++ b/sync/test/engine/mock_model_type_processor.cc @@ -271,4 +271,4 @@ void MockModelTypeProcessor::SetServerAssignedId(const std::string& tag_hash, assigned_ids_[tag_hash] = id; } -} // namespace syncer +} // namespace syncer_v2 diff --git a/sync/test/engine/mock_model_type_processor.h b/sync/test/engine/mock_model_type_processor.h index 8efc50b..d926dfe 100644 --- a/sync/test/engine/mock_model_type_processor.h +++ b/sync/test/engine/mock_model_type_processor.h @@ -5,6 +5,8 @@ #ifndef SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_PROCESSOR_H_ #define SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_PROCESSOR_H_ +#include <map> +#include <string> #include <vector> #include "base/callback.h" @@ -84,7 +86,6 @@ class MockModelTypeProcessor : public ModelTypeProcessor { CommitResponseData GetCommitResponse(const std::string& tag_hash) const; private: - // Process a received commit response. // // Implemented as an Impl method so we can defer its execution in some cases. @@ -136,6 +137,6 @@ class MockModelTypeProcessor : public ModelTypeProcessor { DISALLOW_COPY_AND_ASSIGN(MockModelTypeProcessor); }; -} // namespace syncer +} // namespace syncer_v2 #endif // SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_PROCESSOR_H_ diff --git a/sync/test/engine/mock_update_handler.cc b/sync/test/engine/mock_update_handler.cc index b4e1bd2..7863f60 100644 --- a/sync/test/engine/mock_update_handler.cc +++ b/sync/test/engine/mock_update_handler.cc @@ -4,6 +4,8 @@ #include "sync/test/engine/mock_update_handler.h" +#include <string> + #include "sync/internal_api/public/base/model_type.h" namespace syncer { diff --git a/sync/test/engine/single_type_mock_server.h b/sync/test/engine/single_type_mock_server.h index 2e3684c..53ec575 100644 --- a/sync/test/engine/single_type_mock_server.h +++ b/sync/test/engine/single_type_mock_server.h @@ -5,6 +5,10 @@ #ifndef SYNC_TEST_ENGINE_SINGLE_TYPE_MOCK_SERVER_H_ #define SYNC_TEST_ENGINE_SINGLE_TYPE_MOCK_SERVER_H_ +#include <map> +#include <string> +#include <vector> + #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/non_blocking_sync_common.h" diff --git a/sync/test/engine/test_syncable_utils.cc b/sync/test/engine/test_syncable_utils.cc index aeb4c66..a2c36f4 100644 --- a/sync/test/engine/test_syncable_utils.cc +++ b/sync/test/engine/test_syncable_utils.cc @@ -61,7 +61,7 @@ Id GetFirstEntryWithName(BaseTransaction* rtrans, Id GetOnlyEntryWithName(BaseTransaction* rtrans, const syncable::Id& parent_id, const string& name) { - CHECK(1 == CountEntriesWithName(rtrans, parent_id, name)); + CHECK_EQ(1, CountEntriesWithName(rtrans, parent_id, name)); return GetFirstEntryWithName(rtrans, parent_id, name); } diff --git a/sync/test/fake_encryptor.h b/sync/test/fake_encryptor.h index a168999..c61207a 100644 --- a/sync/test/fake_encryptor.h +++ b/sync/test/fake_encryptor.h @@ -5,6 +5,8 @@ #ifndef SYNC_TEST_FAKE_ENCRYPTOR_H_ #define SYNC_TEST_FAKE_ENCRYPTOR_H_ +#include <string> + #include "base/compiler_specific.h" #include "sync/util/encryptor.h" diff --git a/sync/test/fake_server/android/fake_server_helper_android.cc b/sync/test/fake_server/android/fake_server_helper_android.cc index 434d280..919f3a6 100644 --- a/sync/test/fake_server/android/fake_server_helper_android.cc +++ b/sync/test/fake_server/android/fake_server_helper_android.cc @@ -5,6 +5,8 @@ #include "sync/test/fake_server/android/fake_server_helper_android.h" #include <jni.h> +#include <set> +#include <vector> #include "base/android/jni_array.h" #include "base/android/jni_string.h" @@ -142,7 +144,7 @@ void FakeServerHelperAndroid::InjectUniqueClientEntity( sync_pb::EntitySpecifics entity_specifics; DeserializeEntitySpecifics(env, serialized_entity_specifics, - entity_specifics); + &entity_specifics); fake_server_ptr->InjectEntity( fake_server::UniqueClientEntity::CreateForInjection( @@ -160,7 +162,7 @@ void FakeServerHelperAndroid::ModifyEntitySpecifics( sync_pb::EntitySpecifics entity_specifics; DeserializeEntitySpecifics(env, serialized_entity_specifics, - entity_specifics); + &entity_specifics); fake_server_ptr->ModifyEntitySpecifics( base::android::ConvertJavaStringToUTF8(env, id), entity_specifics); @@ -169,14 +171,14 @@ void FakeServerHelperAndroid::ModifyEntitySpecifics( void FakeServerHelperAndroid::DeserializeEntitySpecifics( JNIEnv* env, jbyteArray serialized_entity_specifics, - sync_pb::EntitySpecifics& entity_specifics) { + sync_pb::EntitySpecifics* entity_specifics) { int specifics_bytes_length = env->GetArrayLength(serialized_entity_specifics); jbyte* specifics_bytes = env->GetByteArrayElements(serialized_entity_specifics, NULL); std::string specifics_string(reinterpret_cast<char *>(specifics_bytes), specifics_bytes_length); - if (!entity_specifics.ParseFromString(specifics_string)) + if (!entity_specifics->ParseFromString(specifics_string)) NOTREACHED() << "Could not deserialize EntitySpecifics"; } diff --git a/sync/test/fake_server/android/fake_server_helper_android.h b/sync/test/fake_server/android/fake_server_helper_android.h index 0f4ed34..497b2e0 100644 --- a/sync/test/fake_server/android/fake_server_helper_android.h +++ b/sync/test/fake_server/android/fake_server_helper_android.h @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SYNC_TEST_FAKE_SERVER_ANDROID_FAKE_SERVER_HELPER_ANDROID -#define SYNC_TEST_FAKE_SERVER_ANDROID_FAKE_SERVER_HELPER_ANDROID +#ifndef SYNC_TEST_FAKE_SERVER_ANDROID_FAKE_SERVER_HELPER_ANDROID_H_ +#define SYNC_TEST_FAKE_SERVER_ANDROID_FAKE_SERVER_HELPER_ANDROID_H_ #include <jni.h> +#include <string> #include "base/android/scoped_java_ref.h" #include "base/basictypes.h" @@ -139,7 +140,7 @@ class FakeServerHelperAndroid { // Deserializes |serialized_entity_specifics| into |entity_specifics|. void DeserializeEntitySpecifics(JNIEnv* env, jbyteArray serialized_entity_specifics, - sync_pb::EntitySpecifics& entity_specifics); + sync_pb::EntitySpecifics* entity_specifics); // Creates a bookmark entity. scoped_ptr<fake_server::FakeServerEntity> CreateBookmarkEntity( @@ -149,4 +150,4 @@ class FakeServerHelperAndroid { jstring parent_id); }; -#endif // SYNC_TEST_FAKE_SERVER_ANDROID_FAKE_SERVER_HELPER_ANDROID +#endif // SYNC_TEST_FAKE_SERVER_ANDROID_FAKE_SERVER_HELPER_ANDROID_H_ diff --git a/sync/test/fake_server/fake_server.cc b/sync/test/fake_server/fake_server.cc index e342e62..d5e39af 100644 --- a/sync/test/fake_server/fake_server.cc +++ b/sync/test/fake_server/fake_server.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <limits> +#include <set> #include <string> #include <utility> #include <vector> diff --git a/sync/test/fake_server/fake_server_http_post_provider.h b/sync/test/fake_server/fake_server_http_post_provider.h index 3ee4d42..b9f5e4d 100644 --- a/sync/test/fake_server/fake_server_http_post_provider.h +++ b/sync/test/fake_server/fake_server_http_post_provider.h @@ -41,10 +41,11 @@ class FakeServerHttpPostProvider const std::string& name) const override; protected: - friend class base::RefCountedThreadSafe<FakeServerHttpPostProvider>; ~FakeServerHttpPostProvider() override; private: + friend class base::RefCountedThreadSafe<FakeServerHttpPostProvider>; + // |fake_server_| should only be dereferenced on the same thread as // |fake_server_task_runner_| runs on. base::WeakPtr<FakeServer> fake_server_; diff --git a/sync/test/fake_server/fake_server_verifier.cc b/sync/test/fake_server/fake_server_verifier.cc index b968d0f..9d2e49c 100644 --- a/sync/test/fake_server/fake_server_verifier.cc +++ b/sync/test/fake_server/fake_server_verifier.cc @@ -4,6 +4,10 @@ #include "sync/test/fake_server/fake_server_verifier.h" +#include <map> +#include <set> +#include <vector> + #include "base/json/json_writer.h" #include "base/memory/scoped_ptr.h" #include "base/values.h" diff --git a/sync/test/fake_sync_encryption_handler.h b/sync/test/fake_sync_encryption_handler.h index 7853947..2b9f753 100644 --- a/sync/test/fake_sync_encryption_handler.h +++ b/sync/test/fake_sync_encryption_handler.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SYNC_SYNCABLE_TEST_FAKE_SYNC_ENCRYPTION_HANDLER_H_ -#define SYNC_SYNCABLE_TEST_FAKE_SYNC_ENCRYPTION_HANDLER_H_ +#ifndef SYNC_TEST_FAKE_SYNC_ENCRYPTION_HANDLER_H_ +#define SYNC_TEST_FAKE_SYNC_ENCRYPTION_HANDLER_H_ #include <string> @@ -67,4 +67,4 @@ class FakeSyncEncryptionHandler : public SyncEncryptionHandler, } // namespace syncer -#endif // SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_ENCRYPTION_HANDLER_H_ +#endif // SYNC_TEST_FAKE_SYNC_ENCRYPTION_HANDLER_H_ diff --git a/sync/test/local_sync_test_server.cc b/sync/test/local_sync_test_server.cc index 791fe09..e5f0a38 100644 --- a/sync/test/local_sync_test_server.cc +++ b/sync/test/local_sync_test_server.cc @@ -4,6 +4,8 @@ #include "sync/test/local_sync_test_server.h" +#include <string> + #include "base/command_line.h" #include "base/path_service.h" #include "base/strings/string_number_conversions.h" diff --git a/sync/test/mock_invalidation.h b/sync/test/mock_invalidation.h index 65d1bce..2aea01b 100644 --- a/sync/test/mock_invalidation.h +++ b/sync/test/mock_invalidation.h @@ -5,6 +5,8 @@ #ifndef SYNC_TEST_MOCK_INVALIDATION_H_ #define SYNC_TEST_MOCK_INVALIDATION_H_ +#include <string> + #include "base/memory/scoped_ptr.h" #include "sync/internal_api/public/base/invalidation_interface.h" diff --git a/sync/test/mock_invalidation_tracker.h b/sync/test/mock_invalidation_tracker.h index 9f0e5bd..ee1f740 100644 --- a/sync/test/mock_invalidation_tracker.h +++ b/sync/test/mock_invalidation_tracker.h @@ -6,6 +6,7 @@ #define SYNC_TEST_MOCK_INVALIDATION_TRACKER_H_ #include <set> +#include <string> #include "base/memory/scoped_ptr.h" #include "sync/test/trackable_mock_invalidation.h" diff --git a/sync/test/null_directory_change_delegate.h b/sync/test/null_directory_change_delegate.h index a37e6708..4c52f3c 100644 --- a/sync/test/null_directory_change_delegate.h +++ b/sync/test/null_directory_change_delegate.h @@ -5,6 +5,8 @@ #ifndef SYNC_TEST_NULL_DIRECTORY_CHANGE_DELEGATE_H_ #define SYNC_TEST_NULL_DIRECTORY_CHANGE_DELEGATE_H_ +#include <vector> + #include "base/compiler_specific.h" #include "sync/syncable/directory_change_delegate.h" diff --git a/sync/test/sessions/mock_debug_info_getter.h b/sync/test/sessions/mock_debug_info_getter.h index 1ca833e..85cb6f9 100644 --- a/sync/test/sessions/mock_debug_info_getter.h +++ b/sync/test/sessions/mock_debug_info_getter.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SYNC_SESSIONS_MOCK_DEBUG_INFO_GETTER_H_ -#define SYNC_SESSIONS_MOCK_DEBUG_INFO_GETTER_H_ +#ifndef SYNC_TEST_SESSIONS_MOCK_DEBUG_INFO_GETTER_H_ +#define SYNC_TEST_SESSIONS_MOCK_DEBUG_INFO_GETTER_H_ #include "base/basictypes.h" #include "base/compiler_specific.h" @@ -36,4 +36,4 @@ class MockDebugInfoGetter : public sessions::DebugInfoGetter { } // namespace sessions } // namespace syncer -#endif // SYNC_SESSIONS_MOCK_DEBUG_INFO_GETTER_H_ +#endif // SYNC_TEST_SESSIONS_MOCK_DEBUG_INFO_GETTER_H_ diff --git a/sync/test/test_directory_backing_store.h b/sync/test/test_directory_backing_store.h index 53f89e5..013cbfa 100644 --- a/sync/test/test_directory_backing_store.h +++ b/sync/test/test_directory_backing_store.h @@ -5,6 +5,8 @@ #ifndef SYNC_TEST_TEST_DIRECTORY_BACKING_STORE_H_ #define SYNC_TEST_TEST_DIRECTORY_BACKING_STORE_H_ +#include <string> + #include "base/gtest_prod_util.h" #include "sync/syncable/directory_backing_store.h" diff --git a/sync/test/test_transaction_observer.h b/sync/test/test_transaction_observer.h index b341d1e..005479e 100644 --- a/sync/test/test_transaction_observer.h +++ b/sync/test/test_transaction_observer.h @@ -5,6 +5,7 @@ #ifndef SYNC_TEST_TEST_TRANSACTION_OBSERVER_H_ #define SYNC_TEST_TEST_TRANSACTION_OBSERVER_H_ +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/syncable/transaction_observer.h" @@ -33,9 +34,9 @@ class TestTransactionObserver : int transactions_observed(); private: - DISALLOW_COPY_AND_ASSIGN(TestTransactionObserver); - int transactions_observed_; + + DISALLOW_COPY_AND_ASSIGN(TestTransactionObserver); }; } // namespace syncable diff --git a/sync/test/trackable_mock_invalidation.h b/sync/test/trackable_mock_invalidation.h index 758ff08..83208898 100644 --- a/sync/test/trackable_mock_invalidation.h +++ b/sync/test/trackable_mock_invalidation.h @@ -5,6 +5,8 @@ #ifndef SYNC_TEST_TRACKABLE_MOCK_INVALIDATION_H_ #define SYNC_TEST_TRACKABLE_MOCK_INVALIDATION_H_ +#include <string> + #include "sync/test/mock_invalidation.h" namespace syncer { diff --git a/sync/tools/null_invalidation_state_tracker.h b/sync/tools/null_invalidation_state_tracker.h index c444fd3..5525b8e 100644 --- a/sync/tools/null_invalidation_state_tracker.h +++ b/sync/tools/null_invalidation_state_tracker.h @@ -5,6 +5,8 @@ #ifndef SYNC_TOOLS_NULL_INVALIDATION_STATE_TRACKER_H_ #define SYNC_TOOLS_NULL_INVALIDATION_STATE_TRACKER_H_ +#include <string> + #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "components/invalidation/impl/invalidation_state_tracker.h" diff --git a/sync/tools/testserver/run_sync_testserver.cc b/sync/tools/testserver/run_sync_testserver.cc index 3ae89fc..414076a 100644 --- a/sync/tools/testserver/run_sync_testserver.cc +++ b/sync/tools/testserver/run_sync_testserver.cc @@ -25,7 +25,7 @@ static bool RunSyncTest( const base::FilePath::StringType& sync_test_script_name) { scoped_ptr<syncer::LocalSyncTestServer> test_server( new syncer::LocalSyncTestServer()); - if (!test_server->SetPythonPath()) { + if (!test_server->SetPythonPath()) { LOG(ERROR) << "Error trying to set python path. Exiting."; return false; } diff --git a/sync/util/get_session_name_win.cc b/sync/util/get_session_name_win.cc index 58980a3..80df90b 100644 --- a/sync/util/get_session_name_win.cc +++ b/sync/util/get_session_name_win.cc @@ -4,12 +4,12 @@ #include "sync/util/get_session_name_win.h" +#include <windows.h> + #include "base/logging.h" #include "base/macros.h" #include "base/strings/utf_string_conversions.h" -#include <windows.h> - namespace syncer { namespace internal { diff --git a/sync/util/nigori.cc b/sync/util/nigori.cc index 7a9702d..225e074 100644 --- a/sync/util/nigori.cc +++ b/sync/util/nigori.cc @@ -31,7 +31,8 @@ class NigoriStream { // followed by |value| itself to the stream. NigoriStream& operator<<(const std::string& value) { uint32 size = base::HostToNet32(value.size()); - stream_.write((char *) &size, sizeof(uint32)); + + stream_.write(reinterpret_cast<char*>(&size), sizeof(uint32)); stream_ << value; return *this; } @@ -41,9 +42,9 @@ class NigoriStream { // bits, to the stream. NigoriStream& operator<<(const Nigori::Type type) { uint32 size = base::HostToNet32(sizeof(uint32)); - stream_.write((char *) &size, sizeof(uint32)); + stream_.write(reinterpret_cast<char*>(&size), sizeof(uint32)); uint32 value = base::HostToNet32(type); - stream_.write((char *) &value, sizeof(uint32)); + stream_.write(reinterpret_cast<char*>(&value), sizeof(uint32)); return *this; } diff --git a/sync/util/nigori.h b/sync/util/nigori.h index cd67bf9..40e9692 100644 --- a/sync/util/nigori.h +++ b/sync/util/nigori.h @@ -24,7 +24,7 @@ namespace syncer { // for your secret (basically a map key), and |Encrypt| and |Decrypt| to store // and retrieve the secret. // -// TODO: Link to doc. +// https://www.cl.cam.ac.uk/~drt24/nigori/nigori-overview.pdf class SYNC_EXPORT Nigori { public: enum Type { diff --git a/sync/util/test_unrecoverable_error_handler.h b/sync/util/test_unrecoverable_error_handler.h index 1546783..ec045067 100644 --- a/sync/util/test_unrecoverable_error_handler.h +++ b/sync/util/test_unrecoverable_error_handler.h @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SYNC_INTERNAL_API_INCLUDES_TEST_UNRECOVERABLE_ERROR_HANDLER_H_ -#define SYNC_INTERNAL_API_INCLUDES_TEST_UNRECOVERABLE_ERROR_HANDLER_H_ +#ifndef SYNC_UTIL_TEST_UNRECOVERABLE_ERROR_HANDLER_H_ +#define SYNC_UTIL_TEST_UNRECOVERABLE_ERROR_HANDLER_H_ + +#include <string> #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" @@ -29,5 +31,4 @@ class TestUnrecoverableErrorHandler : public UnrecoverableErrorHandler { } // namespace syncer -#endif // SYNC_INTERNAL_API_INCLUDES_TEST_UNRECOVERABLE_ERROR_HANDLER_H_ - +#endif // SYNC_UTIL_TEST_UNRECOVERABLE_ERROR_HANDLER_H_ |