diff options
author | skym <skym@chromium.org> | 2015-10-09 11:44:33 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-09 18:45:19 +0000 |
commit | 9dbfbcfb190f3c0ba60925edd3548b195197ef63 (patch) | |
tree | a9d32745862d35fb2a4a1dd13ec3cf71671e3cd1 | |
parent | 281ba9363267522fdde63cc68a57ec47ae6d8cb7 (diff) | |
download | chromium_src-9dbfbcfb190f3c0ba60925edd3548b195197ef63.zip chromium_src-9dbfbcfb190f3c0ba60925edd3548b195197ef63.tar.gz chromium_src-9dbfbcfb190f3c0ba60925edd3548b195197ef63.tar.bz2 |
[Sync] Fixing sync_driver lint violations and adding PRESUBMIT lint check.
BUG=
Review URL: https://codereview.chromium.org/1380693004
Cr-Commit-Position: refs/heads/master@{#353340}
51 files changed, 209 insertions, 108 deletions
diff --git a/components/sync_driver/PRESUBMIT.py b/components/sync_driver/PRESUBMIT.py new file mode 100644 index 0000000..20db5fc --- /dev/null +++ b/components/sync_driver/PRESUBMIT.py @@ -0,0 +1,25 @@ +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Top-level presubmit script for the sync_driver component. + +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts +for more details about the presubmit API built into depot_tools. +""" + +import re + +SYNC_DRIVER_SOURCE_FILES=(r'^components[\\/]sync_driver[\\/].*\.(cc|h)$',) + +def CheckChangeLintsClean(input_api, output_api): + source_filter = lambda x: input_api.FilterSourceFile( + x, white_list=SYNC_DRIVER_SOURCE_FILES, black_list=None) + + return input_api.canned_checks.CheckChangeLintsClean( + input_api, output_api, source_filter, lint_filters=[], verbose_level=1) + +def CheckChangeOnUpload(input_api, output_api): + results = [] + results += CheckChangeLintsClean(input_api, output_api) + return results diff --git a/components/sync_driver/backend_migrator.cc b/components/sync_driver/backend_migrator.cc index 5293d08..2e56001 100644 --- a/components/sync_driver/backend_migrator.cc +++ b/components/sync_driver/backend_migrator.cc @@ -13,7 +13,7 @@ #include "sync/internal_api/public/configure_reason.h" #include "sync/internal_api/public/read_transaction.h" #include "sync/protocol/sync.pb.h" -#include "sync/syncable/directory.h" // TODO(tim): Bug 131130. +#include "sync/syncable/directory.h" // TODO(tim): Bug 131130. using syncer::ModelTypeSet; diff --git a/components/sync_driver/backend_migrator.h b/components/sync_driver/backend_migrator.h index a19bf62..89f5ec5 100644 --- a/components/sync_driver/backend_migrator.h +++ b/components/sync_driver/backend_migrator.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_BACKEND_MIGRATOR_H_ #define COMPONENTS_SYNC_DRIVER_BACKEND_MIGRATOR_H_ +#include <string> + #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" diff --git a/components/sync_driver/backup_rollback_controller.cc b/components/sync_driver/backup_rollback_controller.cc index 685cf6f..b33bd60 100644 --- a/components/sync_driver/backup_rollback_controller.cc +++ b/components/sync_driver/backup_rollback_controller.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/backup_rollback_controller.h" +#include <string> + #include "base/command_line.h" #include "base/location.h" #include "base/metrics/field_trial.h" diff --git a/components/sync_driver/backup_rollback_controller_unittest.cc b/components/sync_driver/backup_rollback_controller_unittest.cc index 4530a88..9b94f21 100644 --- a/components/sync_driver/backup_rollback_controller_unittest.cc +++ b/components/sync_driver/backup_rollback_controller_unittest.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/backup_rollback_controller.h" +#include <string> + #include "base/command_line.h" #include "base/location.h" #include "base/memory/scoped_ptr.h" diff --git a/components/sync_driver/change_processor_mock.h b/components/sync_driver/change_processor_mock.h index 7acf83f..5bb43606 100644 --- a/components/sync_driver/change_processor_mock.h +++ b/components/sync_driver/change_processor_mock.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_CHANGE_PROCESSOR_MOCK_H_ #define COMPONENTS_SYNC_DRIVER_CHANGE_PROCESSOR_MOCK_H_ +#include <string> + #include "components/sync_driver/change_processor.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/util/unrecoverable_error_handler.h" @@ -31,7 +33,6 @@ class ChangeProcessorMock syncer::SyncError(const tracked_objects::Location&, const std::string&, syncer::ModelType)); - }; } // namespace sync_driver diff --git a/components/sync_driver/data_type_controller.h b/components/sync_driver/data_type_controller.h index 6604c34..18b1d1a 100644 --- a/components/sync_driver/data_type_controller.h +++ b/components/sync_driver/data_type_controller.h @@ -36,20 +36,20 @@ class DataTypeController public DataTypeErrorHandler { public: enum State { - NOT_RUNNING, // The controller has never been started or has - // previously been stopped. Must be in this state to start. - MODEL_STARTING, // The controller is waiting on dependent services - // that need to be available before model - // association. - MODEL_LOADED, // The model has finished loading and can start - // associating now. - ASSOCIATING, // Model association is in progress. - RUNNING, // The controller is running and the data type is - // in sync with the cloud. - STOPPING, // The controller is in the process of stopping - // and is waiting for dependent services to stop. - DISABLED // The controller was started but encountered an error - // so it is disabled waiting for it to be stopped. + NOT_RUNNING, // The controller has never been started or has previously + // been stopped. Must be in this state to start. + MODEL_STARTING, // The controller is waiting on dependent services + // that need to be available before model + // association. + MODEL_LOADED, // The model has finished loading and can start + // associating now. + ASSOCIATING, // Model association is in progress. + RUNNING, // The controller is running and the data type is + // in sync with the cloud. + STOPPING, // The controller is in the process of stopping + // and is waiting for dependent services to stop. + DISABLED // The controller was started but encountered an error + // so it is disabled waiting for it to be stopped. }; // This enum is used for "Sync.*ConfigureFailre" histograms so the order diff --git a/components/sync_driver/data_type_encryption_handler.h b/components/sync_driver/data_type_encryption_handler.h index ebefd30..71e7018 100644 --- a/components/sync_driver/data_type_encryption_handler.h +++ b/components/sync_driver/data_type_encryption_handler.h @@ -24,6 +24,6 @@ class DataTypeEncryptionHandler { virtual syncer::ModelTypeSet GetEncryptedDataTypes() const = 0; }; -} // namespace sync_driver +} // namespace sync_driver #endif // COMPONENTS_SYNC_DRIVER_DATA_TYPE_ENCRYPTION_HANDLER_H_ diff --git a/components/sync_driver/data_type_error_handler_mock.h b/components/sync_driver/data_type_error_handler_mock.h index 2bb66f5..c7051e6 100644 --- a/components/sync_driver/data_type_error_handler_mock.h +++ b/components/sync_driver/data_type_error_handler_mock.h @@ -4,6 +4,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_DATA_TYPE_ERROR_HANDLER_MOCK_H__ #define COMPONENTS_SYNC_DRIVER_DATA_TYPE_ERROR_HANDLER_MOCK_H__ +#include <string> + #include "components/sync_driver/data_type_error_handler.h" #include "sync/internal_api/public/base/model_type.h" #include "testing/gmock/include/gmock/gmock.h" @@ -20,7 +22,6 @@ class DataTypeErrorHandlerMock : public DataTypeErrorHandler { syncer::SyncError(const tracked_objects::Location&, const std::string&, syncer::ModelType)); - }; } // namespace sync_driver diff --git a/components/sync_driver/data_type_manager_impl.cc b/components/sync_driver/data_type_manager_impl.cc index b98e880..4450bec 100644 --- a/components/sync_driver/data_type_manager_impl.cc +++ b/components/sync_driver/data_type_manager_impl.cc @@ -187,7 +187,7 @@ DataTypeManagerImpl::BuildDataTypeConfigStateMap( data_type_status_table_.GetFatalErrorTypes(); syncer::ModelTypeSet crypto_types = data_type_status_table_.GetCryptoErrorTypes(); - syncer::ModelTypeSet unready_types= + syncer::ModelTypeSet unready_types = data_type_status_table_.GetUnreadyErrorTypes(); // Types with persistence errors are only purged/resynced when they're diff --git a/components/sync_driver/data_type_manager_impl_unittest.cc b/components/sync_driver/data_type_manager_impl_unittest.cc index dd7028b..0374618 100644 --- a/components/sync_driver/data_type_manager_impl_unittest.cc +++ b/components/sync_driver/data_type_manager_impl_unittest.cc @@ -115,11 +115,11 @@ class FakeBackendDataTypeConfigurer : public BackendDataTypeConfigurer { void ActivateNonBlockingDataType( syncer::ModelType type, scoped_ptr<syncer_v2::ActivationContext> activation_context) override { - // TODO (stanisc): crbug.com/515962: Add test coverage. + // TODO(stanisc): crbug.com/515962: Add test coverage. } void DeactivateNonBlockingDataType(syncer::ModelType type) override { - // TODO (stanisc): crbug.com/515962: Add test coverage. + // TODO(stanisc): crbug.com/515962: Add test coverage. } base::Callback<void(ModelTypeSet, ModelTypeSet)> last_ready_task() const { @@ -228,7 +228,7 @@ FakeDataTypeEncryptionHandler::GetEncryptedDataTypes() const { return encrypted_types_; } -} // namespace +} // namespace class TestDataTypeManager : public DataTypeManagerImpl { public: @@ -279,13 +279,13 @@ class SyncDataTypeManagerImplTest : public testing::Test { protected: void SetUp() override { - dtm_.reset( - new TestDataTypeManager( - syncer::WeakHandle<syncer::DataTypeDebugInfoListener>(), - &configurer_, - &controllers_, - &encryption_handler_, - &observer_)); + dtm_.reset( + new TestDataTypeManager( + syncer::WeakHandle<syncer::DataTypeDebugInfoListener>(), + &configurer_, + &controllers_, + &encryption_handler_, + &observer_)); } void SetConfigureStartExpectation() { diff --git a/components/sync_driver/data_type_status_table.h b/components/sync_driver/data_type_status_table.h index f9d93bd..536c1eb 100644 --- a/components/sync_driver/data_type_status_table.h +++ b/components/sync_driver/data_type_status_table.h @@ -5,6 +5,7 @@ #ifndef COMPONENTS_SYNC_DRIVER_DATA_TYPE_STATUS_TABLE_H_ #define COMPONENTS_SYNC_DRIVER_DATA_TYPE_STATUS_TABLE_H_ +#include <map> #include <string> #include "components/sync_driver/data_type_manager.h" diff --git a/components/sync_driver/device_info_sync_service.h b/components/sync_driver/device_info_sync_service.h index 7476dcb..aadeff9 100644 --- a/components/sync_driver/device_info_sync_service.h +++ b/components/sync_driver/device_info_sync_service.h @@ -5,6 +5,9 @@ #ifndef COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SYNC_SERVICE_H_ #define COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SYNC_SERVICE_H_ +#include <map> +#include <string> + #include "base/observer_list.h" #include "components/sync_driver/device_info_tracker.h" #include "sync/api/sync_change_processor.h" diff --git a/components/sync_driver/device_info_sync_service_unittest.cc b/components/sync_driver/device_info_sync_service_unittest.cc index 1eb5116..350294a 100644 --- a/components/sync_driver/device_info_sync_service_unittest.cc +++ b/components/sync_driver/device_info_sync_service_unittest.cc @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/message_loop/message_loop.h" #include "components/sync_driver/device_info_sync_service.h" + +#include <string> + +#include "base/message_loop/message_loop.h" #include "components/sync_driver/local_device_info_provider_mock.h" #include "sync/api/sync_change.h" #include "sync/api/sync_change_processor.h" @@ -130,20 +133,20 @@ class DeviceInfoSyncServiceTest : public testing::Test, AttachmentServiceProxyForTest::Create()); } - void AddInitialData(SyncDataList& sync_data_list, + void AddInitialData(SyncDataList* sync_data_list, const std::string& client_id, const std::string& client_name) { SyncData sync_data = CreateRemoteData(client_id, client_name); - sync_data_list.push_back(sync_data); + sync_data_list->push_back(sync_data); } - void AddChange(SyncChangeList& change_list, + void AddChange(SyncChangeList* change_list, SyncChange::SyncChangeType change_type, const std::string& client_id, const std::string& client_name) { SyncData sync_data = CreateRemoteData(client_id, client_name); SyncChange sync_change(FROM_HERE, change_type, sync_data); - change_list.push_back(sync_change); + change_list->push_back(sync_change); } protected: @@ -196,7 +199,7 @@ TEST_F(DeviceInfoSyncServiceTest, StopSyncing) { // Sync with initial data matching the local device data. TEST_F(DeviceInfoSyncServiceTest, StartSyncMatchingInitialData) { SyncDataList sync_data; - AddInitialData(sync_data, "guid_1", "client_1"); + AddInitialData(&sync_data, "guid_1", "client_1"); SyncMergeResult merge_result = sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO, @@ -221,10 +224,10 @@ TEST_F(DeviceInfoSyncServiceTest, StartSyncMatchingInitialData) { // Sync with misc initial data. TEST_F(DeviceInfoSyncServiceTest, StartSync) { SyncDataList sync_data; - AddInitialData(sync_data, "guid_2", "foo"); - AddInitialData(sync_data, "guid_3", "bar"); + AddInitialData(&sync_data, "guid_2", "foo"); + AddInitialData(&sync_data, "guid_3", "bar"); // This guid matches the local device but the client name is different. - AddInitialData(sync_data, "guid_1", "baz"); + AddInitialData(&sync_data, "guid_1", "baz"); SyncMergeResult merge_result = sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO, @@ -267,7 +270,7 @@ TEST_F(DeviceInfoSyncServiceTest, ProcessAddChange) { // Add a new device info with a non-matching guid. SyncChangeList change_list; - AddChange(change_list, SyncChange::ACTION_ADD, "guid_2", "foo"); + AddChange(&change_list, SyncChange::ACTION_ADD, "guid_2", "foo"); SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list); EXPECT_FALSE(error.IsSet()); @@ -284,8 +287,8 @@ TEST_F(DeviceInfoSyncServiceTest, ProcessAddChange) { // Verify that callback is called multiple times. TEST_F(DeviceInfoSyncServiceTest, ProcessMultipleChanges) { SyncDataList sync_data; - AddInitialData(sync_data, "guid_2", "foo"); - AddInitialData(sync_data, "guid_3", "bar"); + AddInitialData(&sync_data, "guid_2", "foo"); + AddInitialData(&sync_data, "guid_3", "bar"); SyncMergeResult merge_result = sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO, @@ -297,7 +300,7 @@ TEST_F(DeviceInfoSyncServiceTest, ProcessMultipleChanges) { num_device_info_changed_callbacks_ = 0; SyncChangeList change_list; - AddChange(change_list, SyncChange::ACTION_UPDATE, "guid_2", "foo_2"); + AddChange(&change_list, SyncChange::ACTION_UPDATE, "guid_2", "foo_2"); SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list); EXPECT_FALSE(error.IsSet()); @@ -307,8 +310,8 @@ TEST_F(DeviceInfoSyncServiceTest, ProcessMultipleChanges) { EXPECT_EQ("foo_2", sync_service_->GetDeviceInfo("guid_2")->client_name()); change_list.clear(); - AddChange(change_list, SyncChange::ACTION_UPDATE, "guid_3", "bar_3"); - AddChange(change_list, SyncChange::ACTION_ADD, "guid_4", "baz_4"); + AddChange(&change_list, SyncChange::ACTION_UPDATE, "guid_3", "bar_3"); + AddChange(&change_list, SyncChange::ACTION_ADD, "guid_4", "baz_4"); error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list); EXPECT_FALSE(error.IsSet()); @@ -331,7 +334,7 @@ TEST_F(DeviceInfoSyncServiceTest, ProcessUpdateChangeMatchingLocalDevice) { num_device_info_changed_callbacks_ = 0; SyncChangeList change_list; - AddChange(change_list, SyncChange::ACTION_UPDATE, "guid_1", "foo_1"); + AddChange(&change_list, SyncChange::ACTION_UPDATE, "guid_1", "foo_1"); SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list); EXPECT_FALSE(error.IsSet()); @@ -345,8 +348,8 @@ TEST_F(DeviceInfoSyncServiceTest, ProcessUpdateChangeMatchingLocalDevice) { // Process sync change with ACTION_DELETE. TEST_F(DeviceInfoSyncServiceTest, ProcessDeleteChange) { SyncDataList sync_data; - AddInitialData(sync_data, "guid_2", "foo"); - AddInitialData(sync_data, "guid_3", "bar"); + AddInitialData(&sync_data, "guid_2", "foo"); + AddInitialData(&sync_data, "guid_3", "bar"); SyncMergeResult merge_result = sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO, @@ -358,7 +361,7 @@ TEST_F(DeviceInfoSyncServiceTest, ProcessDeleteChange) { num_device_info_changed_callbacks_ = 0; SyncChangeList change_list; - AddChange(change_list, SyncChange::ACTION_DELETE, "guid_2", "foo_2"); + AddChange(&change_list, SyncChange::ACTION_DELETE, "guid_2", "foo_2"); SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list); EXPECT_FALSE(error.IsSet()); @@ -380,7 +383,7 @@ TEST_F(DeviceInfoSyncServiceTest, ProcessInvalidChange) { num_device_info_changed_callbacks_ = 0; SyncChangeList change_list; - AddChange(change_list, (SyncChange::SyncChangeType)100, "guid_2", "foo_2"); + AddChange(&change_list, (SyncChange::SyncChangeType)100, "guid_2", "foo_2"); SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list); EXPECT_TRUE(error.IsSet()); @@ -402,7 +405,7 @@ TEST_F(DeviceInfoSyncServiceTest, ProcessChangesAfterUnsubscribing) { num_device_info_changed_callbacks_ = 0; SyncChangeList change_list; - AddChange(change_list, SyncChange::ACTION_ADD, "guid_2", "foo_2"); + AddChange(&change_list, SyncChange::ACTION_ADD, "guid_2", "foo_2"); // Unsubscribe observer before processing changes. sync_service_->RemoveObserver(this); diff --git a/components/sync_driver/device_info_tracker.h b/components/sync_driver/device_info_tracker.h index 4c90530..b15e738 100644 --- a/components/sync_driver/device_info_tracker.h +++ b/components/sync_driver/device_info_tracker.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_DEVICE_INFO_TRACKER_H_ #define COMPONENTS_SYNC_DRIVER_DEVICE_INFO_TRACKER_H_ +#include <string> + #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "components/sync_driver/device_info.h" diff --git a/components/sync_driver/fake_data_type_controller.cc b/components/sync_driver/fake_data_type_controller.cc index 639f6c5..fdc949c 100644 --- a/components/sync_driver/fake_data_type_controller.cc +++ b/components/sync_driver/fake_data_type_controller.cc @@ -46,7 +46,7 @@ void FakeDataTypeController::LoadModels( // MODEL_LOADED -> MODEL_STARTING. void FakeDataTypeController::StartAssociating( - const StartCallback& start_callback) { + const StartCallback& start_callback) { last_start_callback_ = start_callback; state_ = ASSOCIATING; } diff --git a/components/sync_driver/fake_data_type_controller.h b/components/sync_driver/fake_data_type_controller.h index 1d03788..3034a09 100644 --- a/components/sync_driver/fake_data_type_controller.h +++ b/components/sync_driver/fake_data_type_controller.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_FAKE_DATA_TYPE_CONTROLLER_H__ #define COMPONENTS_SYNC_DRIVER_FAKE_DATA_TYPE_CONTROLLER_H__ +#include <string> + #include "components/sync_driver/data_type_manager.h" #include "components/sync_driver/directory_data_type_controller.h" diff --git a/components/sync_driver/fake_generic_change_processor.h b/components/sync_driver/fake_generic_change_processor.h index 87cb8ab..f961839 100644 --- a/components/sync_driver/fake_generic_change_processor.h +++ b/components/sync_driver/fake_generic_change_processor.h @@ -5,8 +5,9 @@ #ifndef COMPONENTS_SYNC_DRIVER_FAKE_GENERIC_CHANGE_PROCESSOR_H_ #define COMPONENTS_SYNC_DRIVER_FAKE_GENERIC_CHANGE_PROCESSOR_H_ -#include "components/sync_driver/generic_change_processor.h" +#include <string> +#include "components/sync_driver/generic_change_processor.h" #include "components/sync_driver/generic_change_processor_factory.h" #include "components/sync_driver/sync_api_component_factory.h" #include "sync/api/sync_error.h" diff --git a/components/sync_driver/fake_sync_service.h b/components/sync_driver/fake_sync_service.h index dfd0e2c..441b0673 100644 --- a/components/sync_driver/fake_sync_service.h +++ b/components/sync_driver/fake_sync_service.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_FAKE_SYNC_SERVICE_H_ #define COMPONENTS_SYNC_DRIVER_FAKE_SYNC_SERVICE_H_ +#include <string> + #include "components/sync_driver/sync_service.h" #include "google_apis/gaia/google_service_auth_error.h" #include "sync/internal_api/public/sessions/sync_session_snapshot.h" diff --git a/components/sync_driver/favicon_cache.h b/components/sync_driver/favicon_cache.h index f5529d8..3c3d8d2 100644 --- a/components/sync_driver/favicon_cache.h +++ b/components/sync_driver/favicon_cache.h @@ -6,7 +6,9 @@ #define COMPONENTS_SYNC_DRIVER_FAVICON_CACHE_H_ #include <map> +#include <set> #include <string> +#include <vector> #include "base/basictypes.h" #include "base/compiler_specific.h" diff --git a/components/sync_driver/favicon_cache_unittest.cc b/components/sync_driver/favicon_cache_unittest.cc index b2a7ef6..e16f51d 100644 --- a/components/sync_driver/favicon_cache_unittest.cc +++ b/components/sync_driver/favicon_cache_unittest.cc @@ -570,7 +570,7 @@ TEST_F(SyncFaviconCacheTest, SyncExistingLocal) { syncer::SyncDataList(), CreateAndPassProcessor(), CreateAndPassSyncErrorFactory()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), cache()->GetAllSyncData(syncer::FAVICON_IMAGES).size()); syncer::SyncChangeList change_list = processor()->GetAndResetChangeList(); EXPECT_TRUE(VerifyChanges(syncer::FAVICON_IMAGES, @@ -588,7 +588,7 @@ TEST_F(SyncFaviconCacheTest, SyncExistingLocal) { syncer::SyncDataList(), CreateAndPassProcessor(), CreateAndPassSyncErrorFactory()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), cache()->GetAllSyncData(syncer::FAVICON_TRACKING).size()); change_list = processor()->GetAndResetChangeList(); EXPECT_TRUE(VerifyChanges(syncer::FAVICON_TRACKING, @@ -633,7 +633,7 @@ TEST_F(SyncFaviconCacheTest, SyncExistingRemote) { initial_image_data, CreateAndPassProcessor(), CreateAndPassSyncErrorFactory()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), cache()->GetAllSyncData(syncer::FAVICON_IMAGES).size()); EXPECT_EQ(0U, processor()->GetAndResetChangeList().size()); EXPECT_EQ(kFaviconBatchSize, merge_result.num_items_added()); @@ -647,7 +647,7 @@ TEST_F(SyncFaviconCacheTest, SyncExistingRemote) { initial_tracking_data, CreateAndPassProcessor(), CreateAndPassSyncErrorFactory()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), cache()->GetAllSyncData(syncer::FAVICON_TRACKING).size()); EXPECT_EQ(0U, processor()->GetAndResetChangeList().size()); EXPECT_EQ(0, merge_result.num_items_added()); @@ -712,10 +712,10 @@ TEST_F(SyncFaviconCacheTest, SyncMergesImages) { initial_image_data, CreateAndPassProcessor(), CreateAndPassSyncErrorFactory()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), cache()->GetAllSyncData(syncer::FAVICON_IMAGES).size()); syncer::SyncChangeList changes = processor()->GetAndResetChangeList(); - EXPECT_EQ((unsigned long)kFaviconBatchSize/2, changes.size()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize)/2, changes.size()); EXPECT_EQ(0, merge_result.num_items_added()); EXPECT_EQ(kFaviconBatchSize, merge_result.num_items_modified()); EXPECT_EQ(0, merge_result.num_items_deleted()); @@ -727,7 +727,7 @@ TEST_F(SyncFaviconCacheTest, SyncMergesImages) { initial_tracking_data, CreateAndPassProcessor(), CreateAndPassSyncErrorFactory()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), cache()->GetAllSyncData(syncer::FAVICON_TRACKING).size()); EXPECT_EQ(0U, processor()->GetAndResetChangeList().size()); EXPECT_EQ(0, merge_result.num_items_added()); @@ -797,7 +797,7 @@ TEST_F(SyncFaviconCacheTest, SyncMergesTracking) { initial_image_data, CreateAndPassProcessor(), CreateAndPassSyncErrorFactory()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), cache()->GetAllSyncData(syncer::FAVICON_IMAGES).size()); EXPECT_EQ(0U, processor()->GetAndResetChangeList().size()); EXPECT_EQ(0, merge_result.num_items_added()); @@ -811,10 +811,10 @@ TEST_F(SyncFaviconCacheTest, SyncMergesTracking) { initial_tracking_data, CreateAndPassProcessor(), CreateAndPassSyncErrorFactory()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), cache()->GetAllSyncData(syncer::FAVICON_TRACKING).size()); syncer::SyncChangeList changes = processor()->GetAndResetChangeList(); - EXPECT_EQ((unsigned long)kFaviconBatchSize/2, changes.size()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize)/2, changes.size()); EXPECT_EQ(0, merge_result.num_items_added()); EXPECT_EQ(kFaviconBatchSize, merge_result.num_items_modified()); EXPECT_EQ(0, merge_result.num_items_deleted()); @@ -874,7 +874,7 @@ TEST_F(SyncFaviconCacheTest, ReceiveStaleImages) { cache()->ProcessSyncChanges(FROM_HERE, stale_changes); syncer::SyncChangeList changes = processor()->GetAndResetChangeList(); ASSERT_TRUE(VerifyLocalIcons(expected_icons)); - ASSERT_EQ((unsigned long)kFaviconBatchSize, changes.size()); + ASSERT_EQ(static_cast<size_t>(kFaviconBatchSize), changes.size()); ASSERT_TRUE(VerifyChanges(syncer::FAVICON_IMAGES, expected_change_types, expected_icons, @@ -1019,7 +1019,7 @@ TEST_F(SyncFaviconCacheTest, ReceiveStaleTracking) { cache()->ProcessSyncChanges(FROM_HERE, stale_changes); syncer::SyncChangeList changes = processor()->GetAndResetChangeList(); ASSERT_TRUE(VerifyLocalIcons(expected_icons)); - ASSERT_EQ((unsigned long)kFaviconBatchSize, changes.size()); + ASSERT_EQ(static_cast<size_t>(kFaviconBatchSize), changes.size()); ASSERT_TRUE(VerifyChanges(syncer::FAVICON_TRACKING, expected_change_types, expected_icons, @@ -1162,10 +1162,10 @@ TEST_F(SyncFaviconCacheTest, DeleteFavicons) { // Now receive the tracking deletions. Since we'll still have orphan data, // the favicon count should remain the same. - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetFaviconCount()); cache()->ProcessSyncChanges(FROM_HERE, tracking_deletions); EXPECT_EQ(0U, processor()->GetAndResetChangeList().size()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetFaviconCount()); // Once the image deletions arrive, the favicon count should be 0 again. cache()->ProcessSyncChanges(FROM_HERE, image_deletions); @@ -1216,9 +1216,9 @@ TEST_F(SyncFaviconCacheTest, ExpireOnMergeData) { initial_image_data, CreateAndPassProcessor(), CreateAndPassSyncErrorFactory()); - EXPECT_EQ((unsigned long)kMaxSyncFavicons * 2, + EXPECT_EQ(static_cast<size_t>(kMaxSyncFavicons)*2, GetFaviconCount()); // Still have tracking. - EXPECT_EQ((unsigned long)kMaxSyncFavicons, + EXPECT_EQ(static_cast<size_t>(kMaxSyncFavicons), cache()->GetAllSyncData(syncer::FAVICON_IMAGES).size()); EXPECT_EQ(0U, processor()->GetAndResetChangeList().size()); EXPECT_EQ(kMaxSyncFavicons, merge_result.num_items_added()); @@ -1233,7 +1233,7 @@ TEST_F(SyncFaviconCacheTest, ExpireOnMergeData) { initial_tracking_data, CreateAndPassProcessor(), CreateAndPassSyncErrorFactory()); - EXPECT_EQ((unsigned long)kMaxSyncFavicons, + EXPECT_EQ(static_cast<size_t>(kMaxSyncFavicons), cache()->GetAllSyncData(syncer::FAVICON_TRACKING).size()); EXPECT_EQ(0U, processor()->GetAndResetChangeList().size()); EXPECT_EQ(0, merge_result.num_items_added()); @@ -1299,13 +1299,13 @@ TEST_F(SyncFaviconCacheTest, NoExpireOnProcessSyncChanges) { SetUpInitialSync(initial_image_data, initial_tracking_data); // Now receive the new icons as an update. - EXPECT_EQ((unsigned long)kMaxSyncFavicons, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kMaxSyncFavicons), GetFaviconCount()); cache()->ProcessSyncChanges(FROM_HERE, image_changes); EXPECT_EQ(0U, processor()->GetAndResetChangeList().size()); cache()->ProcessSyncChanges(FROM_HERE, tracking_changes); EXPECT_EQ(0U, processor()->GetAndResetChangeList().size()); EXPECT_TRUE(VerifyLocalIcons(expected_icons)); - EXPECT_GT(GetFaviconCount(), (unsigned long)kMaxSyncFavicons); + EXPECT_LT(static_cast<size_t>(kMaxSyncFavicons), GetFaviconCount()); } // Test that visiting a new page triggers a favicon load and a sync addition. @@ -1320,7 +1320,7 @@ TEST_F(SyncFaviconCacheTest, AddOnFaviconVisited) { cache()->OnFaviconVisited(test_data.page_url, test_data.icon_url); } - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetTaskCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetTaskCount()); for (int i = 0; i < kFaviconBatchSize; ++i) { TestFaviconData test_data = BuildFaviconData(i); @@ -1345,7 +1345,7 @@ TEST_F(SyncFaviconCacheTest, AddOnFaviconVisited) { } EXPECT_EQ(0U, GetTaskCount()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetFaviconCount()); } // Test that visiting a known page does not trigger a favicon load and just @@ -1382,7 +1382,7 @@ TEST_F(SyncFaviconCacheTest, UpdateOnFaviconVisited) { last_visit_time_ms(), 0); } EXPECT_EQ(0U, GetTaskCount()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetFaviconCount()); } // Ensure we properly expire old synced favicons as new ones are updated. @@ -1430,7 +1430,7 @@ TEST_F(SyncFaviconCacheTest, ExpireOnFaviconVisited) { } EXPECT_EQ(0U, GetTaskCount()); - EXPECT_EQ((unsigned long)kMaxSyncFavicons, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kMaxSyncFavicons), GetFaviconCount()); } // A full history clear notification should result in all synced favicons being @@ -1466,12 +1466,12 @@ TEST_F(SyncFaviconCacheTest, HistoryFullClear) { syncer::SyncChangeList changes = processor()->GetAndResetChangeList(); EXPECT_TRUE(changes.empty()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetFaviconCount()); cache()->OnURLsDeleted(nullptr, true, false, history::URLRows(), std::set<GURL>()); EXPECT_EQ(0U, GetFaviconCount()); changes = processor()->GetAndResetChangeList(); - ASSERT_EQ(changes.size(), (unsigned long)kFaviconBatchSize*2); + ASSERT_EQ(changes.size(), static_cast<size_t>(kFaviconBatchSize)*2); syncer::SyncChangeList changes_1, changes_2; for (int i = 0; i < kFaviconBatchSize; ++i) { changes_1.push_back(changes[i]); @@ -1524,12 +1524,12 @@ TEST_F(SyncFaviconCacheTest, HistorySubsetClear) { syncer::SyncChangeList changes = processor()->GetAndResetChangeList(); EXPECT_TRUE(changes.empty()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetFaviconCount()); cache()->OnURLsDeleted(nullptr, false, false, history::URLRows(), favicon_urls_to_delete); - EXPECT_EQ((unsigned long)kFaviconBatchSize/2, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize)/2, GetFaviconCount()); changes = processor()->GetAndResetChangeList(); - ASSERT_EQ(changes.size(), (unsigned long)kFaviconBatchSize); + ASSERT_EQ(changes.size(), static_cast<size_t>(kFaviconBatchSize)); syncer::SyncChangeList changes_1, changes_2; for (size_t i = 0; i < kFaviconBatchSize/2; ++i) { changes_1.push_back(changes[i]); @@ -1556,7 +1556,7 @@ TEST_F(SyncFaviconCacheTest, IgnoreDataScheme) { cache()->OnFaviconVisited(test_data.page_url, GURL()); } - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetTaskCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetTaskCount()); for (int i = 0; i < kFaviconBatchSize; ++i) { TestFaviconData test_data = BuildFaviconData(i); @@ -1584,7 +1584,7 @@ TEST_F(SyncFaviconCacheTest, ReuseCachedIconUrl) { cache()->OnFaviconVisited(test_data.page_url, test_data.icon_url); } - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetTaskCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetTaskCount()); for (int i = 0; i < kFaviconBatchSize; ++i) { TestFaviconData test_data = BuildFaviconData(i); @@ -1592,7 +1592,7 @@ TEST_F(SyncFaviconCacheTest, ReuseCachedIconUrl) { } processor()->GetAndResetChangeList(); EXPECT_EQ(0U, GetTaskCount()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetFaviconCount()); for (int i = 0; i < kFaviconBatchSize; ++i) { TestFaviconData test_data = BuildFaviconData(i); @@ -1655,7 +1655,7 @@ TEST_F(SyncFaviconCacheTest, UpdatedOrphans) { cache()->ProcessSyncChanges(FROM_HERE, initial_image_changes); cache()->ProcessSyncChanges(FROM_HERE, initial_tracking_changes); EXPECT_EQ(0U, processor()->GetAndResetChangeList().size()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetFaviconCount()); for (int i = 0; i < kFaviconBatchSize/2; ++i) { TestFaviconData test_data = BuildFaviconData(i); @@ -1696,7 +1696,7 @@ TEST_F(SyncFaviconCacheTest, UpdatedOrphans) { } EXPECT_EQ(0U, GetTaskCount()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetFaviconCount()); } // Verify that orphaned favicon images don't result in creating invalid @@ -1719,7 +1719,7 @@ TEST_F(SyncFaviconCacheTest, PartialAssociationInfo) { SetUpInitialSync(initial_image_data, initial_tracking_data); syncer::SyncChangeList change_list = processor()->GetAndResetChangeList(); EXPECT_TRUE(change_list.empty()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetFaviconCount()); } // Tests that we don't choke if a favicon visit node with a null visit time is @@ -1761,9 +1761,9 @@ TEST_F(SyncFaviconCacheTest, NullFaviconVisitTime) { initial_tracking_data, CreateAndPassProcessor(), CreateAndPassSyncErrorFactory()); - ASSERT_EQ((unsigned long)kFaviconBatchSize, + ASSERT_EQ(static_cast<size_t>(kFaviconBatchSize), processor()->GetAndResetChangeList().size()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetFaviconCount()); // Visit the favicons again. EXPECT_EQ(0U, GetTaskCount()); @@ -1783,7 +1783,7 @@ TEST_F(SyncFaviconCacheTest, NullFaviconVisitTime) { last_visit_time_ms(), 0); } EXPECT_EQ(0U, GetTaskCount()); - EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kFaviconBatchSize), GetFaviconCount()); } // If another synced client has a clock skewed towards the future, it's possible @@ -1843,7 +1843,7 @@ TEST_F(SyncFaviconCacheTest, VisitFaviconClockSkew) { ASSERT_EQ(changes[3].sync_data().GetDataType(), syncer::FAVICON_TRACKING); } EXPECT_EQ(0U, GetTaskCount()); - EXPECT_EQ((unsigned long)kMaxSyncFavicons, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kMaxSyncFavicons), GetFaviconCount()); } // Simulate a case where the set of tracking info and image info doesn't match, @@ -1891,7 +1891,7 @@ TEST_F(SyncFaviconCacheTest, MixedThreshold) { // Because the image and tracking data don't overlap, the total number of // favicons is still over the limit. - EXPECT_EQ((unsigned long)kMaxSyncFavicons + 5, GetFaviconCount()); + EXPECT_EQ(static_cast<size_t>(kMaxSyncFavicons)+5, GetFaviconCount()); // Trigger a tracking change for one of the favicons whose tracking info // was dropped, resulting in a tracking add and expiration of the orphaned diff --git a/components/sync_driver/frontend_data_type_controller_mock.h b/components/sync_driver/frontend_data_type_controller_mock.h index 7692917..1609850 100644 --- a/components/sync_driver/frontend_data_type_controller_mock.h +++ b/components/sync_driver/frontend_data_type_controller_mock.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_FRONTEND_DATA_TYPE_CONTROLLER_MOCK_H__ #define COMPONENTS_SYNC_DRIVER_FRONTEND_DATA_TYPE_CONTROLLER_MOCK_H__ +#include <string> + #include "components/sync_driver/frontend_data_type_controller.h" #include "sync/api/sync_error.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/components/sync_driver/generic_change_processor.cc b/components/sync_driver/generic_change_processor.cc index b86b920..90aa502 100644 --- a/components/sync_driver/generic_change_processor.cc +++ b/components/sync_driver/generic_change_processor.cc @@ -4,6 +4,9 @@ #include "components/sync_driver/generic_change_processor.h" +#include <algorithm> +#include <string> + #include "base/location.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" diff --git a/components/sync_driver/generic_change_processor.h b/components/sync_driver/generic_change_processor.h index 40c391c..7aeaf4a 100644 --- a/components/sync_driver/generic_change_processor.h +++ b/components/sync_driver/generic_change_processor.h @@ -5,6 +5,7 @@ #ifndef COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ #define COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ +#include <string> #include <vector> #include "base/compiler_specific.h" diff --git a/components/sync_driver/generic_change_processor_unittest.cc b/components/sync_driver/generic_change_processor_unittest.cc index 541342d..17ce3c4 100644 --- a/components/sync_driver/generic_change_processor_unittest.cc +++ b/components/sync_driver/generic_change_processor_unittest.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/generic_change_processor.h" +#include <string> + #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/message_loop/message_loop.h" diff --git a/components/sync_driver/glue/typed_url_model_associator.cc b/components/sync_driver/glue/typed_url_model_associator.cc index 51c3bd4..8da6d60 100644 --- a/components/sync_driver/glue/typed_url_model_associator.cc +++ b/components/sync_driver/glue/typed_url_model_associator.cc @@ -286,7 +286,7 @@ syncer::SyncError TypedUrlModelAssociator::DoAssociateModels( } // Should never be possible to delete all the items, since the // visit vector contains all the items in typed_url.visits. - DCHECK(visits.size() > 0); + DCHECK_GT(visits.size(), 0u); } DCHECK_EQ(new_url.last_visit().ToInternalValue(), visits.back().visit_time.ToInternalValue()); @@ -733,7 +733,7 @@ void TypedUrlModelAssociator::WriteToTypedUrlSpecifics( // the history DB has an inaccurate count for some reason (there's been // bugs in the history code in the past which has left users in the wild // with incorrect counts - http://crbug.com/84258). - DCHECK(typed_count > 0); + DCHECK_GT(typed_count, 0); if (typed_count > kMaxTypedUrlVisits) { only_typed = true; diff --git a/components/sync_driver/invalidation_adapter.h b/components/sync_driver/invalidation_adapter.h index 5fcb354..3377f54 100644 --- a/components/sync_driver/invalidation_adapter.h +++ b/components/sync_driver/invalidation_adapter.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_INVALIDATION_ADAPTER_H_ #define COMPONENTS_SYNC_DRIVER_INVALIDATION_ADAPTER_H_ +#include <string> + #include "components/invalidation/public/invalidation.h" #include "sync/internal_api/public/base/invalidation_interface.h" diff --git a/components/sync_driver/invalidation_helper.cc b/components/sync_driver/invalidation_helper.cc index 1eeb1de..d60f947 100644 --- a/components/sync_driver/invalidation_helper.cc +++ b/components/sync_driver/invalidation_helper.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/invalidation_helper.h" +#include <string> + #include "google/cacheinvalidation/types.pb.h" namespace syncer { diff --git a/components/sync_driver/local_device_info_provider_mock.cc b/components/sync_driver/local_device_info_provider_mock.cc index 644c1b1..604d194 100644 --- a/components/sync_driver/local_device_info_provider_mock.cc +++ b/components/sync_driver/local_device_info_provider_mock.cc @@ -61,4 +61,3 @@ void LocalDeviceInfoProviderMock::SetInitialized(bool is_initialized) { } } // namespace sync_driver - diff --git a/components/sync_driver/local_device_info_provider_mock.h b/components/sync_driver/local_device_info_provider_mock.h index 5cea163..14519c0 100644 --- a/components/sync_driver/local_device_info_provider_mock.h +++ b/components/sync_driver/local_device_info_provider_mock.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_MOCK_H_ #define COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_MOCK_H_ +#include <string> + #include "components/sync_driver/device_info.h" #include "components/sync_driver/local_device_info_provider.h" diff --git a/components/sync_driver/model_association_manager.h b/components/sync_driver/model_association_manager.h index b1491d8..6126280 100644 --- a/components/sync_driver/model_association_manager.h +++ b/components/sync_driver/model_association_manager.h @@ -86,7 +86,7 @@ class ModelAssociationManager { // Dependency injection. crbug.com/129212. base::OneShotTimer* GetTimerForTesting(); - State state() const { return state_; } + State state() const { return state_; } private: // Called at the end of association to reset state to prepare for next diff --git a/components/sync_driver/model_association_manager_unittest.cc b/components/sync_driver/model_association_manager_unittest.cc index 4d78870..f1e9e1e 100644 --- a/components/sync_driver/model_association_manager_unittest.cc +++ b/components/sync_driver/model_association_manager_unittest.cc @@ -35,7 +35,7 @@ FakeDataTypeController* GetController( if (it == controllers.end()) { return NULL; } - return (FakeDataTypeController*)(it->second.get()); + return static_cast<FakeDataTypeController*>(it->second.get()); } ACTION_P(VerifyResult, expected_result) { diff --git a/components/sync_driver/non_ui_data_type_controller.h b/components/sync_driver/non_ui_data_type_controller.h index 3a999f5..0b859d4 100644 --- a/components/sync_driver/non_ui_data_type_controller.h +++ b/components/sync_driver/non_ui_data_type_controller.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_NON_UI_DATA_TYPE_CONTROLLER_H_ #define COMPONENTS_SYNC_DRIVER_NON_UI_DATA_TYPE_CONTROLLER_H_ +#include <string> + #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" @@ -100,7 +102,6 @@ class NonUIDataTypeController : public DirectoryDataTypeController { void OnModelLoaded(); private: - // Posted on the backend thread by StartAssociationAsync(). void StartAssociationWithSharedChangeProcessor( const scoped_refptr<SharedChangeProcessor>& shared_change_processor); diff --git a/components/sync_driver/non_ui_data_type_controller_mock.h b/components/sync_driver/non_ui_data_type_controller_mock.h index 91cca69..9ba92a3 100644 --- a/components/sync_driver/non_ui_data_type_controller_mock.h +++ b/components/sync_driver/non_ui_data_type_controller_mock.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_NON_UI_DATA_TYPE_CONTROLLER_MOCK_H_ #define COMPONENTS_SYNC_DRIVER_NON_UI_DATA_TYPE_CONTROLLER_MOCK_H_ +#include <string> + #include "components/sync_driver/non_ui_data_type_controller.h" #include "sync/api/sync_error.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/components/sync_driver/non_ui_data_type_controller_unittest.cc b/components/sync_driver/non_ui_data_type_controller_unittest.cc index 3a3196b..61b5e23 100644 --- a/components/sync_driver/non_ui_data_type_controller_unittest.cc +++ b/components/sync_driver/non_ui_data_type_controller_unittest.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/non_ui_data_type_controller.h" +#include <vector> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" @@ -161,8 +163,6 @@ class NonUIDataTypeControllerFake private: ~NonUIDataTypeControllerFake() override {} - DISALLOW_COPY_AND_ASSIGN(NonUIDataTypeControllerFake); - struct PendingTask { PendingTask(const tracked_objects::Location& from_here, const base::Closure& task) @@ -177,6 +177,8 @@ class NonUIDataTypeControllerFake NonUIDataTypeControllerMock* mock_; scoped_refptr<SharedChangeProcessor> change_processor_; scoped_refptr<base::SingleThreadTaskRunner> backend_task_runner_; + + DISALLOW_COPY_AND_ASSIGN(NonUIDataTypeControllerFake); }; class SyncNonUIDataTypeControllerTest : public testing::Test, @@ -228,14 +230,14 @@ class SyncNonUIDataTypeControllerTest : public testing::Test, .WillOnce(Return(true)); EXPECT_CALL(*change_processor_.get(), SyncModelHasUserCreatedNodes(_)) .WillOnce(DoAll(SetArgumentPointee<0>(true), Return(true))); - EXPECT_CALL(*change_processor_.get(), GetAllSyncDataReturnError(_,_)) + EXPECT_CALL(*change_processor_.get(), GetAllSyncDataReturnError(_, _)) .WillOnce(Return(syncer::SyncError())); EXPECT_CALL(*change_processor_.get(), GetSyncCount()).WillOnce(Return(0)); EXPECT_CALL(*dtc_mock_.get(), RecordAssociationTime(_)); } void SetActivateExpectations(DataTypeController::ConfigureResult result) { - EXPECT_CALL(start_callback_, Run(result,_,_)); + EXPECT_CALL(start_callback_, Run(result, _, _)); } void SetStopExpectations() { @@ -293,7 +295,7 @@ TEST_F(SyncNonUIDataTypeControllerTest, StartFirstRun) { .WillOnce(Return(true)); EXPECT_CALL(*change_processor_.get(), SyncModelHasUserCreatedNodes(_)) .WillOnce(DoAll(SetArgumentPointee<0>(false), Return(true))); - EXPECT_CALL(*change_processor_.get(), GetAllSyncDataReturnError(_,_)) + EXPECT_CALL(*change_processor_.get(), GetAllSyncDataReturnError(_, _)) .WillOnce(Return(syncer::SyncError())); EXPECT_CALL(*dtc_mock_.get(), RecordAssociationTime(_)); SetActivateExpectations(DataTypeController::OK_FIRST_RUN); @@ -329,7 +331,7 @@ TEST_F(SyncNonUIDataTypeControllerTest, StartAssociationFailed) { .WillOnce(Return(true)); EXPECT_CALL(*change_processor_.get(), SyncModelHasUserCreatedNodes(_)) .WillOnce(DoAll(SetArgumentPointee<0>(true), Return(true))); - EXPECT_CALL(*change_processor_.get(), GetAllSyncDataReturnError(_,_)) + EXPECT_CALL(*change_processor_.get(), GetAllSyncDataReturnError(_, _)) .WillOnce(Return(syncer::SyncError())); EXPECT_CALL(*dtc_mock_.get(), RecordAssociationTime(_)); SetStartFailExpectations(DataTypeController::ASSOCIATION_FAILED); @@ -395,7 +397,7 @@ TEST_F(SyncNonUIDataTypeControllerTest, AbortDuringAssociation) { WaitOnEvent(&pause_db_thread), SetArgumentPointee<0>(true), Return(true))); - EXPECT_CALL(*change_processor_.get(), GetAllSyncDataReturnError(_,_)) + EXPECT_CALL(*change_processor_.get(), GetAllSyncDataReturnError(_, _)) .WillOnce( Return(syncer::SyncError(FROM_HERE, syncer::SyncError::DATATYPE_ERROR, diff --git a/components/sync_driver/pref_names.h b/components/sync_driver/pref_names.h index 0808b1f..785d0c3 100644 --- a/components/sync_driver/pref_names.h +++ b/components/sync_driver/pref_names.h @@ -4,6 +4,9 @@ // Constants for the names of various sync preferences, for easier changing. +#ifndef COMPONENTS_SYNC_DRIVER_PREF_NAMES_H_ +#define COMPONENTS_SYNC_DRIVER_PREF_NAMES_H_ + #include "build/build_config.h" namespace sync_driver { @@ -79,3 +82,5 @@ extern const char kSyncNigoriStateForPassphraseTransition[]; } // namespace prefs } // namespace sync_driver + +#endif // COMPONENTS_SYNC_DRIVER_PREF_NAMES_H_ diff --git a/components/sync_driver/profile_sync_auth_provider.h b/components/sync_driver/profile_sync_auth_provider.h index 032ca75..6b4b4aa 100644 --- a/components/sync_driver/profile_sync_auth_provider.h +++ b/components/sync_driver/profile_sync_auth_provider.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_PROFILE_SYNC_AUTH_PROVIDER_H_ #define COMPONENTS_SYNC_DRIVER_PROFILE_SYNC_AUTH_PROVIDER_H_ +#include <string> + #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "google_apis/gaia/oauth2_token_service.h" diff --git a/components/sync_driver/proxy_data_type_controller.h b/components/sync_driver/proxy_data_type_controller.h index 3065fa9..2f3127e5 100644 --- a/components/sync_driver/proxy_data_type_controller.h +++ b/components/sync_driver/proxy_data_type_controller.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_PROXY_DATA_TYPE_CONTROLLER_H__ #define COMPONENTS_SYNC_DRIVER_PROXY_DATA_TYPE_CONTROLLER_H__ +#include <string> + #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/single_thread_task_runner.h" diff --git a/components/sync_driver/shared_change_processor.h b/components/sync_driver/shared_change_processor.h index 0a7db5e..e8683a5 100644 --- a/components/sync_driver/shared_change_processor.h +++ b/components/sync_driver/shared_change_processor.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_SHARED_CHANGE_PROCESSOR_H_ #define COMPONENTS_SYNC_DRIVER_SHARED_CHANGE_PROCESSOR_H_ +#include <string> + #include "base/location.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" diff --git a/components/sync_driver/shared_change_processor_ref.h b/components/sync_driver/shared_change_processor_ref.h index 2924a05..0557009 100644 --- a/components/sync_driver/shared_change_processor_ref.h +++ b/components/sync_driver/shared_change_processor_ref.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 COMPONENTS_SYNC_DRIVER_SHARED_CHANGE_PROCESSOR_H_REF_H_ -#define COMPONENTS_SYNC_DRIVER_SHARED_CHANGE_PROCESSOR_H_REF_H_ +#ifndef COMPONENTS_SYNC_DRIVER_SHARED_CHANGE_PROCESSOR_REF_H_ +#define COMPONENTS_SYNC_DRIVER_SHARED_CHANGE_PROCESSOR_REF_H_ + +#include <string> #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" @@ -46,4 +48,4 @@ class SharedChangeProcessorRef : public syncer::SyncChangeProcessor, } // namespace sync_driver -#endif // COMPONENTS_SYNC_DRIVER_SHARED_CHANGE_PROCESSOR_H_REF_H_ +#endif // COMPONENTS_SYNC_DRIVER_SHARED_CHANGE_PROCESSOR_REF_H_ diff --git a/components/sync_driver/shared_change_processor_unittest.cc b/components/sync_driver/shared_change_processor_unittest.cc index a28d305..f16c268 100644 --- a/components/sync_driver/shared_change_processor_unittest.cc +++ b/components/sync_driver/shared_change_processor_unittest.cc @@ -5,6 +5,7 @@ #include "components/sync_driver/shared_change_processor.h" #include <cstddef> +#include <string> #include "base/bind.h" #include "base/bind_helpers.h" diff --git a/components/sync_driver/sync_api_component_factory.h b/components/sync_driver/sync_api_component_factory.h index 44029c4..25d308b 100644 --- a/components/sync_driver/sync_api_component_factory.h +++ b/components/sync_driver/sync_api_component_factory.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_ #define COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_ +#include <string> + #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "components/sync_driver/data_type_controller.h" diff --git a/components/sync_driver/sync_frontend.h b/components/sync_driver/sync_frontend.h index 17db8f5..155f1c1 100644 --- a/components/sync_driver/sync_frontend.h +++ b/components/sync_driver/sync_frontend.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_SYNC_FRONTEND_H_ #define COMPONENTS_SYNC_DRIVER_SYNC_FRONTEND_H_ +#include <string> + #include "base/basictypes.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/sync_encryption_handler.h" diff --git a/components/sync_driver/sync_prefs.h b/components/sync_driver/sync_prefs.h index e390bc7..c66564c 100644 --- a/components/sync_driver/sync_prefs.h +++ b/components/sync_driver/sync_prefs.h @@ -5,6 +5,9 @@ #ifndef COMPONENTS_SYNC_DRIVER_SYNC_PREFS_H_ #define COMPONENTS_SYNC_DRIVER_SYNC_PREFS_H_ +#include <map> +#include <string> + #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" diff --git a/components/sync_driver/sync_prefs_unittest.cc b/components/sync_driver/sync_prefs_unittest.cc index 814d85c..4ad8b5f 100644 --- a/components/sync_driver/sync_prefs_unittest.cc +++ b/components/sync_driver/sync_prefs_unittest.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/sync_prefs.h" +#include <map> + #include "base/command_line.h" #include "base/message_loop/message_loop.h" #include "base/prefs/pref_notifier_impl.h" diff --git a/components/sync_driver/sync_stopped_reporter.h b/components/sync_driver/sync_stopped_reporter.h index 6ae1d2b..8d7cd5c 100644 --- a/components/sync_driver/sync_stopped_reporter.h +++ b/components/sync_driver/sync_stopped_reporter.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_SYNC_STOPPED_REPORTER_H_ #define COMPONENTS_SYNC_DRIVER_SYNC_STOPPED_REPORTER_H_ +#include <string> + #include "base/callback.h" #include "base/timer/timer.h" #include "net/url_request/url_fetcher.h" diff --git a/components/sync_driver/sync_stopped_reporter_unittest.cc b/components/sync_driver/sync_stopped_reporter_unittest.cc index ca334b8..d218c8ec 100644 --- a/components/sync_driver/sync_stopped_reporter_unittest.cc +++ b/components/sync_driver/sync_stopped_reporter_unittest.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/sync_stopped_reporter.h" +#include <string> + #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/test/test_simple_task_runner.h" diff --git a/components/sync_driver/system_encryptor.h b/components/sync_driver/system_encryptor.h index 7b08a54..50c6a20 100644 --- a/components/sync_driver/system_encryptor.h +++ b/components/sync_driver/system_encryptor.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SYNC_DRIVER_SYSTEM_ENCRYPTOR_H_ #define COMPONENTS_SYNC_DRIVER_SYSTEM_ENCRYPTOR_H_ +#include <string> + #include "base/compiler_specific.h" #include "sync/util/encryptor.h" diff --git a/components/sync_driver/system_encryptor_unittest.cc b/components/sync_driver/system_encryptor_unittest.cc index f4f73a3..f0a6e93 100644 --- a/components/sync_driver/system_encryptor_unittest.cc +++ b/components/sync_driver/system_encryptor_unittest.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/system_encryptor.h" +#include <string> + #include "components/os_crypt/os_crypt.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/components/sync_driver/tab_node_pool_unittest.cc b/components/sync_driver/tab_node_pool_unittest.cc index de7df81..71f4d93 100644 --- a/components/sync_driver/tab_node_pool_unittest.cc +++ b/components/sync_driver/tab_node_pool_unittest.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/tab_node_pool.h" +#include <vector> + #include "sync/api/sync_change.h" #include "sync/protocol/session_specifics.pb.h" #include "sync/protocol/sync.pb.h" diff --git a/components/sync_driver/ui_data_type_controller.h b/components/sync_driver/ui_data_type_controller.h index f935f54..55641a6 100644 --- a/components/sync_driver/ui_data_type_controller.h +++ b/components/sync_driver/ui_data_type_controller.h @@ -124,8 +124,9 @@ class UIDataTypeController : public DirectoryDataTypeController { base::WeakPtr<syncer::SyncableService> local_service_; scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; + private: - // Associate the sync model with the service's model, then start syncing. + // Associate the sync model with the service's model, then start syncing. virtual void Associate(); virtual void AbortModelLoad(); |