diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-03-08 10:28:10 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-03-20 13:40:30 +0000 |
commit | e733310db58160074f574c429d48f8308c0afe17 (patch) | |
tree | f8aef4b7e62a69928dbcf880620eece20f98c6df /chromium/components/browser_sync | |
parent | 2f583e4aec1ae3a86fa047829c96b310dc12ecdf (diff) | |
download | qtwebengine-chromium-e733310db58160074f574c429d48f8308c0afe17.tar.gz |
BASELINE: Update Chromium to 56.0.2924.122
Change-Id: I4e04de8f47e47e501c46ed934c76a431c6337ced
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/components/browser_sync')
22 files changed, 440 insertions, 316 deletions
diff --git a/chromium/components/browser_sync/BUILD.gn b/chromium/components/browser_sync/BUILD.gn index 7a42726915e..1949c1cf71b 100644 --- a/chromium/components/browser_sync/BUILD.gn +++ b/chromium/components/browser_sync/BUILD.gn @@ -36,8 +36,8 @@ static_library("browser_sync") { "//components/signin/core/browser", "//components/strings", "//components/sync_bookmarks", + "//components/sync_preferences", "//components/sync_sessions", - "//components/syncable_prefs", "//components/variations", "//components/version_info", "//components/version_info:generate_version_info", @@ -78,13 +78,14 @@ source_set("unit_tests") { "//components/signin/core/common:common", "//components/strings", "//components/sync", - "//components/sync:test_support_sync_core_impl", - "//components/sync:test_support_sync_driver", + "//components/sync:test_support_driver", + "//components/sync:test_support_engine", + "//components/sync:test_support_model", "//components/sync_bookmarks:sync_bookmarks", + "//components/sync_preferences", + "//components/sync_preferences:test_support", "//components/sync_sessions", "//components/sync_sessions:test_support", - "//components/syncable_prefs", - "//components/syncable_prefs:test_support", "//components/version_info", "//components/version_info:generate_version_info", "//components/webdata_services:test_support", @@ -123,11 +124,10 @@ static_library("test_support") { "//components/signin/core/browser:browser", "//components/signin/core/browser:test_support", "//components/sync", - "//components/sync:test_support_sync_core", - "//components/sync:test_support_sync_core_impl", - "//components/sync:test_support_sync_driver", + "//components/sync:test_support_driver", + "//components/sync:test_support_engine", + "//components/sync_preferences:test_support", "//components/sync_sessions:test_support", - "//components/syncable_prefs:test_support", "//google_apis", "//net:test_support", "//testing/gmock", diff --git a/chromium/components/browser_sync/DEPS b/chromium/components/browser_sync/DEPS index ed67f1144df..14709a958de 100644 --- a/chromium/components/browser_sync/DEPS +++ b/chromium/components/browser_sync/DEPS @@ -14,7 +14,7 @@ include_rules = [ "+components/signin/core/browser", "+components/signin/core/common", "+components/sync", - "+components/syncable_prefs", + "+components/sync_preferences", "+components/sync_bookmarks", "+components/sync_sessions", "+components/strings", diff --git a/chromium/components/browser_sync/PRESUBMIT.py b/chromium/components/browser_sync/PRESUBMIT.py new file mode 100644 index 00000000000..ae61c433007 --- /dev/null +++ b/chromium/components/browser_sync/PRESUBMIT.py @@ -0,0 +1,31 @@ +# Copyright 2016 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. + +"""Presubmit script for browser_sync 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 + +BROWSER_SYNC_SOURCE_FILES = (r'^components[\\/]browser_sync[\\/].*\.(cc|h)$',) + +def CheckChangeLintsClean(input_api, output_api): + source_filter = lambda x: input_api.FilterSourceFile( + x, white_list=BROWSER_SYNC_SOURCE_FILES, black_list=None) + return input_api.canned_checks.CheckChangeLintsClean( + input_api, output_api, source_filter, lint_filters=[], verbose_level=1) + +def CheckChanges(input_api, output_api): + results = [] + results += CheckChangeLintsClean(input_api, output_api) + results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) + return results + +def CheckChangeOnUpload(input_api, output_api): + return CheckChanges(input_api, output_api) + +def CheckChangeOnCommit(input_api, output_api): + return CheckChanges(input_api, output_api) diff --git a/chromium/components/browser_sync/abstract_profile_sync_service_test.cc b/chromium/components/browser_sync/abstract_profile_sync_service_test.cc index c1def134bb6..153962eb4c3 100644 --- a/chromium/components/browser_sync/abstract_profile_sync_service_test.cc +++ b/chromium/components/browser_sync/abstract_profile_sync_service_test.cc @@ -14,12 +14,12 @@ #include "base/run_loop.h" #include "components/browser_sync/test_http_bridge_factory.h" #include "components/browser_sync/test_profile_sync_service.h" -#include "components/sync/core/test/sync_manager_factory_for_profile_sync_test.h" -#include "components/sync/core/test/test_internal_components_factory.h" -#include "components/sync/core/test/test_user_share.h" #include "components/sync/driver/glue/sync_backend_host_core.h" #include "components/sync/driver/sync_api_component_factory_mock.h" +#include "components/sync/engine/sync_manager_factory_for_profile_sync_test.h" +#include "components/sync/engine/test_engine_components_factory.h" #include "components/sync/protocol/sync.pb.h" +#include "components/sync/syncable/test_user_share.h" #include "google_apis/gaia/gaia_constants.h" using syncer::SyncBackendHostImpl; @@ -86,25 +86,23 @@ SyncBackendHostForProfileSyncTest::~SyncBackendHostForProfileSyncTest() {} void SyncBackendHostForProfileSyncTest::InitCore( std::unique_ptr<syncer::DoInitializeOptions> options) { - options->http_bridge_factory = - std::unique_ptr<syncer::HttpPostProviderFactory>( - new TestHttpBridgeFactory()); - options->sync_manager_factory.reset( - new syncer::SyncManagerFactoryForProfileSyncTest(callback_)); + options->http_bridge_factory = base::MakeUnique<TestHttpBridgeFactory>(); + options->sync_manager_factory = + base::MakeUnique<syncer::SyncManagerFactoryForProfileSyncTest>(callback_); options->credentials.email = "testuser@gmail.com"; options->credentials.sync_token = "token"; options->credentials.scope_set.insert(GaiaConstants::kChromeSyncOAuth2Scope); options->restored_key_for_bootstrapping.clear(); - // It'd be nice if we avoided creating the InternalComponentsFactory in the + // It'd be nice if we avoided creating the EngineComponentsFactory in the // first place, but SyncBackendHost will have created one by now so we must // free it. Grab the switches to pass on first. - syncer::InternalComponentsFactory::Switches factory_switches = - options->internal_components_factory->GetSwitches(); - options->internal_components_factory.reset( - new syncer::TestInternalComponentsFactory( - factory_switches, - syncer::InternalComponentsFactory::STORAGE_IN_MEMORY, nullptr)); + syncer::EngineComponentsFactory::Switches factory_switches = + options->engine_components_factory->GetSwitches(); + options->engine_components_factory = + base::MakeUnique<syncer::TestEngineComponentsFactory>( + factory_switches, syncer::EngineComponentsFactory::STORAGE_IN_MEMORY, + nullptr); SyncBackendHostImpl::InitCore(std::move(options)); } diff --git a/chromium/components/browser_sync/abstract_profile_sync_service_test.h b/chromium/components/browser_sync/abstract_profile_sync_service_test.h index 4fc8cd3c746..dc2fc7c976b 100644 --- a/chromium/components/browser_sync/abstract_profile_sync_service_test.h +++ b/chromium/components/browser_sync/abstract_profile_sync_service_test.h @@ -16,7 +16,7 @@ #include "base/test/test_message_loop.h" #include "components/browser_sync/profile_sync_test_util.h" #include "components/sync/base/model_type.h" -#include "components/sync/core/change_record.h" +#include "components/sync/syncable/change_record.h" #include "testing/gtest/include/gtest/gtest.h" namespace syncer { diff --git a/chromium/components/browser_sync/browser_sync_switches.cc b/chromium/components/browser_sync/browser_sync_switches.cc index b354cdb91c3..d15ad5f2c0c 100644 --- a/chromium/components/browser_sync/browser_sync_switches.cc +++ b/chromium/components/browser_sync/browser_sync_switches.cc @@ -19,4 +19,12 @@ const char kDisableSyncTypes[] = "disable-sync-types"; // Enables synchronizing WiFi credentials across devices, using Chrome Sync. const char kEnableWifiCredentialSync[] = "enable-wifi-credential-sync"; +// Enabled the local sync backend implemented by the LoopbackServer. +const char kEnableLocalSyncBackend[] = "enable-local-sync-backend"; + +// Specifies the local sync backend directory. The name is chosen to mimic +// user-data-dir etc. This flag only matters if the enable-local-sync-backend +// flag is present. +const char kLocalSyncBackendDir[] = "local-sync-backend-dir"; + } // namespace switches diff --git a/chromium/components/browser_sync/browser_sync_switches.h b/chromium/components/browser_sync/browser_sync_switches.h index d2376a42e96..9df89c54192 100644 --- a/chromium/components/browser_sync/browser_sync_switches.h +++ b/chromium/components/browser_sync/browser_sync_switches.h @@ -12,6 +12,8 @@ namespace switches { extern const char kDisableSync[]; extern const char kDisableSyncTypes[]; extern const char kEnableWifiCredentialSync[]; +extern const char kEnableLocalSyncBackend[]; +extern const char kLocalSyncBackendDir[]; } // namespace switches diff --git a/chromium/components/browser_sync/profile_sync_components_factory_impl.cc b/chromium/components/browser_sync/profile_sync_components_factory_impl.cc index 7aab9bc8a91..f71096c80b0 100644 --- a/chromium/components/browser_sync/profile_sync_components_factory_impl.cc +++ b/chromium/components/browser_sync/profile_sync_components_factory_impl.cc @@ -26,14 +26,10 @@ #include "components/password_manager/core/browser/password_store.h" #include "components/password_manager/sync/browser/password_data_type_controller.h" #include "components/prefs/pref_service.h" -#include "components/sync/core/attachments/attachment_downloader.h" -#include "components/sync/core/attachments/attachment_service.h" -#include "components/sync/core/attachments/attachment_service_impl.h" -#include "components/sync/core/attachments/attachment_uploader_impl.h" +#include "components/sync/base/report_unrecoverable_error.h" #include "components/sync/device_info/device_info_data_type_controller.h" #include "components/sync/device_info/local_device_info_provider_impl.h" #include "components/sync/driver/data_type_manager_impl.h" -#include "components/sync/driver/glue/chrome_report_unrecoverable_error.h" #include "components/sync/driver/glue/sync_backend_host.h" #include "components/sync/driver/glue/sync_backend_host_impl.h" #include "components/sync/driver/model_type_controller.h" @@ -41,6 +37,9 @@ #include "components/sync/driver/sync_client.h" #include "components/sync/driver/sync_driver_switches.h" #include "components/sync/driver/ui_data_type_controller.h" +#include "components/sync/engine/attachments/attachment_downloader.h" +#include "components/sync/engine/attachments/attachment_uploader.h" +#include "components/sync/model/attachments/attachment_service.h" #include "components/sync_bookmarks/bookmark_change_processor.h" #include "components/sync_bookmarks/bookmark_data_type_controller.h" #include "components/sync_bookmarks/bookmark_model_associator.h" @@ -82,13 +81,6 @@ syncer::ModelTypeSet GetEnabledTypesFromCommandLine( return syncer::ModelTypeSet(); } -// Used to gate syncing preferences, see crbug.com/374865 for more information. -// Has always been on for desktop/ChromeOS, so default to on. This feature is -// mainly to give us a kill switch should something go wrong with starting to -// sync prefs on mobile. -const base::Feature kSyncPreferencesFeature{"SyncPreferences", - base::FEATURE_ENABLED_BY_DEFAULT}; - } // namespace ProfileSyncComponentsFactoryImpl::ProfileSyncComponentsFactoryImpl( @@ -143,7 +135,7 @@ void ProfileSyncComponentsFactoryImpl::RegisterCommonDataTypes( syncer::ModelTypeSet disabled_types, syncer::ModelTypeSet enabled_types) { base::Closure error_callback = - base::Bind(&syncer::ChromeReportUnrecoverableError, channel_); + base::Bind(&syncer::ReportUnrecoverableError, channel_); // TODO(stanisc): can DEVICE_INFO be one of disabled datatypes? if (base::FeatureList::IsEnabled(switches::kSyncUSSDeviceInfo)) { @@ -257,8 +249,7 @@ void ProfileSyncComponentsFactoryImpl::RegisterCommonDataTypes( sync_client_->GetPasswordStateChangedCallback(), password_store_)); } - if (!disabled_types.Has(syncer::PREFERENCES) && - base::FeatureList::IsEnabled(kSyncPreferencesFeature)) { + if (!disabled_types.Has(syncer::PREFERENCES)) { if (!override_prefs_controller_to_uss_for_test_) { sync_service->RegisterDataTypeController( base::MakeUnique<UIDataTypeController>(syncer::PREFERENCES, @@ -367,11 +358,11 @@ ProfileSyncComponentsFactoryImpl::CreateAttachmentService( // TODO(maniscalco): Use shared (one per profile) thread-safe instances of // AttachmentUploader and AttachmentDownloader instead of creating a new one // per AttachmentService (bug 369536). - attachment_uploader.reset(new syncer::AttachmentUploaderImpl( + attachment_uploader = syncer::AttachmentUploader::Create( sync_service_url_, url_request_context_getter_, user_share.sync_credentials.account_id, user_share.sync_credentials.scope_set, token_service_provider, - store_birthday, model_type)); + store_birthday, model_type); token_service_provider = new TokenServiceProvider(ui_thread_, token_service_); @@ -389,12 +380,10 @@ ProfileSyncComponentsFactoryImpl::CreateAttachmentService( const base::TimeDelta initial_backoff_delay = base::TimeDelta::FromMinutes(30); const base::TimeDelta max_backoff_delay = base::TimeDelta::FromHours(4); - std::unique_ptr<syncer::AttachmentService> attachment_service( - new syncer::AttachmentServiceImpl( - std::move(attachment_store), std::move(attachment_uploader), - std::move(attachment_downloader), delegate, initial_backoff_delay, - max_backoff_delay)); - return attachment_service; + return syncer::AttachmentService::Create( + std::move(attachment_store), std::move(attachment_uploader), + std::move(attachment_downloader), delegate, initial_backoff_delay, + max_backoff_delay); } syncer::SyncApiComponentFactory::SyncComponents diff --git a/chromium/components/browser_sync/profile_sync_service.cc b/chromium/components/browser_sync/profile_sync_service.cc index ab636d3a00a..222bf630f96 100644 --- a/chromium/components/browser_sync/profile_sync_service.cc +++ b/chromium/components/browser_sync/profile_sync_service.cc @@ -20,6 +20,7 @@ #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" #include "base/metrics/histogram.h" +#include "base/path_service.h" #include "base/profiler/scoped_tracker.h" #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" @@ -37,47 +38,48 @@ #include "components/signin/core/browser/signin_manager.h" #include "components/signin/core/browser/signin_metrics.h" #include "components/strings/grit/components_strings.h" -#include "components/sync/api/model_type_store.h" -#include "components/sync/api/sync_error.h" +#include "components/sync/base/bind_to_task_runner.h" #include "components/sync/base/cryptographer.h" #include "components/sync/base/passphrase_type.h" +#include "components/sync/base/pref_names.h" +#include "components/sync/base/report_unrecoverable_error.h" #include "components/sync/base/stop_source.h" -#include "components/sync/base/sync_db_util.h" -#include "components/sync/core/configure_reason.h" -#include "components/sync/core/http_bridge_network_resources.h" -#include "components/sync/core/network_resources.h" -#include "components/sync/core/shared_model_type_processor.h" -#include "components/sync/core/sync_encryption_handler.h" +#include "components/sync/base/system_encryptor.h" #include "components/sync/device_info/device_info.h" -#include "components/sync/device_info/device_info_service.h" +#include "components/sync/device_info/device_info_sync_bridge.h" #include "components/sync/device_info/device_info_sync_service.h" #include "components/sync/device_info/device_info_tracker.h" #include "components/sync/driver/backend_migrator.h" -#include "components/sync/driver/change_processor.h" #include "components/sync/driver/directory_data_type_controller.h" -#include "components/sync/driver/glue/chrome_report_unrecoverable_error.h" #include "components/sync/driver/glue/sync_backend_host_impl.h" -#include "components/sync/driver/pref_names.h" #include "components/sync/driver/signin_manager_wrapper.h" #include "components/sync/driver/sync_api_component_factory.h" #include "components/sync/driver/sync_driver_switches.h" #include "components/sync/driver/sync_error_controller.h" #include "components/sync/driver/sync_type_preference_provider.h" #include "components/sync/driver/sync_util.h" -#include "components/sync/driver/system_encryptor.h" #include "components/sync/driver/user_selectable_sync_type.h" +#include "components/sync/engine/configure_reason.h" #include "components/sync/engine/cycle/model_neutral_state.h" #include "components/sync/engine/cycle/type_debug_info_observer.h" +#include "components/sync/engine/net/http_bridge_network_resources.h" +#include "components/sync/engine/net/network_resources.h" +#include "components/sync/engine/sync_encryption_handler.h" #include "components/sync/engine/sync_string_conversions.h" #include "components/sync/js/js_event_details.h" +#include "components/sync/model/change_processor.h" +#include "components/sync/model/model_type_change_processor.h" +#include "components/sync/model/model_type_store.h" +#include "components/sync/model/sync_error.h" #include "components/sync/protocol/sync.pb.h" #include "components/sync/syncable/directory.h" +#include "components/sync/syncable/sync_db_util.h" #include "components/sync/syncable/syncable_read_transaction.h" +#include "components/sync_preferences/pref_service_syncable.h" #include "components/sync_sessions/favicon_cache.h" #include "components/sync_sessions/session_data_type_controller.h" #include "components/sync_sessions/sessions_sync_manager.h" #include "components/sync_sessions/sync_sessions_client.h" -#include "components/syncable_prefs/pref_service_syncable.h" #include "components/version_info/version_info_values.h" #include "net/cookies/cookie_monster.h" #include "net/url_request/url_request_context_getter.h" @@ -85,7 +87,7 @@ #include "ui/base/l10n/time_format.h" #if defined(OS_ANDROID) -#include "components/sync/core/read_transaction.h" +#include "components/sync/syncable/read_transaction.h" #endif using sync_sessions::SessionsSyncManager; @@ -94,7 +96,7 @@ using syncer::ChangeProcessor; using syncer::DataTypeController; using syncer::DataTypeManager; using syncer::DataTypeStatusTable; -using syncer::DeviceInfoService; +using syncer::DeviceInfoSyncBridge; using syncer::DeviceInfoSyncService; using syncer::JsBackend; using syncer::JsController; @@ -102,10 +104,10 @@ using syncer::JsEventDetails; using syncer::JsEventHandler; using syncer::ModelSafeRoutingInfo; using syncer::ModelType; +using syncer::ModelTypeChangeProcessor; using syncer::ModelTypeSet; using syncer::ModelTypeStore; using syncer::ProtocolEventObserver; -using syncer::SharedModelTypeProcessor; using syncer::SyncBackendHost; using syncer::SyncCredentials; using syncer::SyncProtocolError; @@ -150,6 +152,11 @@ static const base::FilePath::CharType kSyncDataFolderName[] = static const base::FilePath::CharType kLevelDBFolderName[] = FILE_PATH_LITERAL("LevelDB"); +#if defined(OS_WIN) +static const base::FilePath::CharType kLoopbackServerBackendFilename[] = + FILE_PATH_LITERAL("profile.pb"); +#endif + namespace { // Perform the actual sync data folder deletion. @@ -163,13 +170,6 @@ void DeleteSyncDataFolder(const base::FilePath& directory_path) { } // namespace -bool ShouldShowActionOnUI(const syncer::SyncProtocolError& error) { - return (error.action != syncer::UNKNOWN_ACTION && - error.action != syncer::DISABLE_SYNC_ON_CLIENT && - error.action != syncer::STOP_SYNC_FOR_DISABLED_ACCOUNT && - error.action != syncer::RESET_LOCAL_SYNC_DATA); -} - ProfileSyncService::InitParams::InitParams() = default; ProfileSyncService::InitParams::~InitParams() = default; ProfileSyncService::InitParams::InitParams(InitParams&& other) // NOLINT @@ -184,8 +184,6 @@ ProfileSyncService::InitParams::InitParams(InitParams&& other) // NOLINT url_request_context(std::move(other.url_request_context)), debug_identifier(std::move(other.debug_identifier)), channel(other.channel), - db_thread(std::move(other.db_thread)), - file_thread(std::move(other.file_thread)), blocking_pool(other.blocking_pool) {} ProfileSyncService::ProfileSyncService(InitParams init_params) @@ -203,8 +201,6 @@ ProfileSyncService::ProfileSyncService(InitParams init_params) url_request_context_(init_params.url_request_context), debug_identifier_(std::move(init_params.debug_identifier)), channel_(init_params.channel), - db_thread_(init_params.db_thread), - file_thread_(init_params.file_thread), blocking_pool_(init_params.blocking_pool), is_first_time_sync_configure_(false), backend_initialized_(false), @@ -262,26 +258,26 @@ void ProfileSyncService::Initialize() { // We don't pass StartupController an Unretained reference to future-proof // against the controller impl changing to post tasks. - startup_controller_.reset(new syncer::StartupController( + startup_controller_ = base::MakeUnique<syncer::StartupController>( &sync_prefs_, base::Bind(&ProfileSyncService::CanBackendStart, base::Unretained(this)), base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, - weak_factory_.GetWeakPtr()))); + weak_factory_.GetWeakPtr())); std::unique_ptr<sync_sessions::LocalSessionEventRouter> router( sync_client_->GetSyncSessionsClient()->GetLocalSessionEventRouter()); local_device_ = sync_client_->GetSyncApiComponentFactory() ->CreateLocalDeviceInfoProvider(); - sync_stopped_reporter_.reset(new syncer::SyncStoppedReporter( + sync_stopped_reporter_ = base::MakeUnique<syncer::SyncStoppedReporter>( sync_service_url_, local_device_->GetSyncUserAgent(), - url_request_context_, syncer::SyncStoppedReporter::ResultCallback())); - sessions_sync_manager_.reset(new SessionsSyncManager( + url_request_context_, syncer::SyncStoppedReporter::ResultCallback()); + sessions_sync_manager_ = base::MakeUnique<SessionsSyncManager>( sync_client_->GetSyncSessionsClient(), &sync_prefs_, local_device_.get(), std::move(router), base::Bind(&ProfileSyncService::NotifyForeignSessionUpdated, sync_enabled_weak_factory_.GetWeakPtr()), base::Bind(&ProfileSyncService::TriggerRefresh, sync_enabled_weak_factory_.GetWeakPtr(), - syncer::ModelTypeSet(syncer::SESSIONS)))); + syncer::ModelTypeSet(syncer::SESSIONS))); if (base::FeatureList::IsEnabled(switches::kSyncUSSDeviceInfo)) { scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( @@ -291,16 +287,16 @@ void ProfileSyncService::Initialize() { // TODO(skym): Stop creating leveldb files when signed out. // TODO(skym): Verify using AsUTF8Unsafe is okay here. Should work as long // as the Local State file is guaranteed to be UTF-8. - device_info_service_.reset(new DeviceInfoService( + device_info_service_ = base::MakeUnique<DeviceInfoSyncBridge>( local_device_.get(), base::Bind(&ModelTypeStore::CreateStore, syncer::DEVICE_INFO, directory_path_.Append(base::FilePath(kLevelDBFolderName)) .AsUTF8Unsafe(), blocking_task_runner), - base::Bind(&SharedModelTypeProcessor::CreateAsChangeProcessor))); + base::Bind(&ModelTypeChangeProcessor::Create)); } else { - device_info_sync_service_.reset( - new DeviceInfoSyncService(local_device_.get())); + device_info_sync_service_ = + base::MakeUnique<DeviceInfoSyncService>(local_device_.get()); } syncer::SyncApiComponentFactory::RegisterDataTypesMethod @@ -363,15 +359,15 @@ void ProfileSyncService::Initialize() { #endif #if !defined(OS_ANDROID) - DCHECK(sync_error_controller_ == NULL) + DCHECK(sync_error_controller_ == nullptr) << "Initialize() called more than once."; - sync_error_controller_.reset(new syncer::SyncErrorController(this)); + sync_error_controller_ = base::MakeUnique<syncer::SyncErrorController>(this); AddObserver(sync_error_controller_.get()); #endif - memory_pressure_listener_.reset(new base::MemoryPressureListener( + memory_pressure_listener_ = base::MakeUnique<base::MemoryPressureListener>( base::Bind(&ProfileSyncService::OnMemoryPressure, - sync_enabled_weak_factory_.GetWeakPtr()))); + sync_enabled_weak_factory_.GetWeakPtr())); startup_controller_->Reset(GetRegisteredDataTypes()); // Auto-start means means the first time the profile starts up, sync should @@ -428,9 +424,11 @@ bool ProfileSyncService::IsDataTypeControllerRunning( } sync_sessions::OpenTabsUIDelegate* ProfileSyncService::GetOpenTabsUIDelegate() { - if (!IsDataTypeControllerRunning(syncer::SESSIONS)) - return NULL; - return sessions_sync_manager_.get(); + // Although the backing data actually is of type |SESSIONS|, the desire to use + // open tabs functionality is tracked by the state of the |PROXY_TABS| type. + return IsDataTypeControllerRunning(syncer::PROXY_TABS) + ? sessions_sync_manager_.get() + : nullptr; } sync_sessions::FaviconCache* ProfileSyncService::GetFaviconCache() { @@ -496,11 +494,48 @@ void ProfileSyncService::InitializeBackend(bool delete_stale_data) { return; } + if (!sync_thread_) { + sync_thread_ = base::MakeUnique<base::Thread>("Chrome_SyncThread"); + base::Thread::Options options; + options.timer_slack = base::TIMER_SLACK_MAXIMUM; + CHECK(sync_thread_->StartWithOptions(options)); + } + SyncCredentials credentials = GetCredentials(); if (delete_stale_data) ClearStaleErrors(); + bool enable_local_sync_backend = false; + base::FilePath local_sync_backend_folder; +#if defined(OS_WIN) + enable_local_sync_backend = base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableLocalSyncBackend); + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kLocalSyncBackendDir)) { + local_sync_backend_folder = + base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( + switches::kLocalSyncBackendDir); + } else { + // TODO(pastarmovj): Add DIR_ROAMING_USER_DATA to PathService to simplify + // this code and move the logic in its right place. See crbug/657810. + CHECK( + base::PathService::Get(base::DIR_APP_DATA, &local_sync_backend_folder)); + local_sync_backend_folder = + local_sync_backend_folder.Append(FILE_PATH_LITERAL("Chrome/User Data")); + } + // This code as it is now will assume the same profile order is present on all + // machines, which is not a given. It is to be defined if only the Default + // profile should get this treatment or all profile as is the case now. The + // solution for now will be to assume profiles are created in the same order + // on all machines and in the future decide if only the Default one should be + // considered roamed. + local_sync_backend_folder = + local_sync_backend_folder.Append(base_directory_.BaseName()); + local_sync_backend_folder = + local_sync_backend_folder.Append(kLoopbackServerBackendFilename); +#endif // defined(OS_WIN) + SyncBackendHost::HttpPostProviderFactoryGetter http_post_provider_factory_getter = base::Bind(&syncer::NetworkResources::GetHttpPostProviderFactory, @@ -508,13 +543,12 @@ void ProfileSyncService::InitializeBackend(bool delete_stale_data) { url_request_context_, network_time_update_callback_); backend_->Initialize( - this, std::move(sync_thread_), db_thread_, file_thread_, - GetJsEventHandler(), sync_service_url_, local_device_->GetSyncUserAgent(), - credentials, delete_stale_data, - std::unique_ptr<syncer::SyncManagerFactory>( - new syncer::SyncManagerFactory()), + this, sync_thread_.get(), GetJsEventHandler(), sync_service_url_, + local_device_->GetSyncUserAgent(), credentials, delete_stale_data, + enable_local_sync_backend, local_sync_backend_folder, + base::MakeUnique<syncer::SyncManagerFactory>(), MakeWeakHandle(sync_enabled_weak_factory_.GetWeakPtr()), - base::Bind(syncer::ChromeReportUnrecoverableError, channel_), + base::Bind(syncer::ReportUnrecoverableError, channel_), http_post_provider_factory_getter, std::move(saved_nigori_state_)); } @@ -528,29 +562,29 @@ bool ProfileSyncService::IsEncryptedDatatypeEnabled() const { } void ProfileSyncService::OnProtocolEvent(const syncer::ProtocolEvent& event) { - FOR_EACH_OBSERVER(ProtocolEventObserver, protocol_event_observers_, - OnProtocolEvent(event)); + for (auto& observer : protocol_event_observers_) + observer.OnProtocolEvent(event); } void ProfileSyncService::OnDirectoryTypeCommitCounterUpdated( syncer::ModelType type, const syncer::CommitCounters& counters) { - FOR_EACH_OBSERVER(syncer::TypeDebugInfoObserver, type_debug_info_observers_, - OnCommitCountersUpdated(type, counters)); + for (auto& observer : type_debug_info_observers_) + observer.OnCommitCountersUpdated(type, counters); } void ProfileSyncService::OnDirectoryTypeUpdateCounterUpdated( syncer::ModelType type, const syncer::UpdateCounters& counters) { - FOR_EACH_OBSERVER(syncer::TypeDebugInfoObserver, type_debug_info_observers_, - OnUpdateCountersUpdated(type, counters)); + for (auto& observer : type_debug_info_observers_) + observer.OnUpdateCountersUpdated(type, counters); } -void ProfileSyncService::OnDirectoryTypeStatusCounterUpdated( +void ProfileSyncService::OnDatatypeStatusCounterUpdated( syncer::ModelType type, const syncer::StatusCounters& counters) { - FOR_EACH_OBSERVER(syncer::TypeDebugInfoObserver, type_debug_info_observers_, - OnStatusCountersUpdated(type, counters)); + for (auto& observer : type_debug_info_observers_) + observer.OnStatusCountersUpdated(type, counters); } void ProfileSyncService::OnDataTypeRequestsSyncStartup(syncer::ModelType type) { @@ -756,7 +790,7 @@ void ProfileSyncService::ShutdownImpl(syncer::ShutdownReason reason) { // shutting it down. std::unique_ptr<SyncBackendHost> doomed_backend(backend_.release()); if (doomed_backend) { - sync_thread_ = doomed_backend->Shutdown(reason); + doomed_backend->Shutdown(reason); doomed_backend.reset(); } base::TimeDelta shutdown_time = base::Time::Now() - shutdown_start_time; @@ -830,17 +864,18 @@ void ProfileSyncService::UpdateLastSyncedTime() { } void ProfileSyncService::NotifyObservers() { - FOR_EACH_OBSERVER(syncer::SyncServiceObserver, observers_, OnStateChanged()); + for (auto& observer : observers_) + observer.OnStateChanged(); } void ProfileSyncService::NotifySyncCycleCompleted() { - FOR_EACH_OBSERVER(syncer::SyncServiceObserver, observers_, - OnSyncCycleCompleted()); + for (auto& observer : observers_) + observer.OnSyncCycleCompleted(); } void ProfileSyncService::NotifyForeignSessionUpdated() { - FOR_EACH_OBSERVER(syncer::SyncServiceObserver, observers_, - OnForeignSessionUpdated()); + for (auto& observer : observers_) + observer.OnForeignSessionUpdated(); } void ProfileSyncService::ClearStaleErrors() { @@ -1133,7 +1168,6 @@ void ProfileSyncService::OnPassphraseRequired( << syncer::PassphraseRequiredReasonToString(reason); passphrase_required_reason_ = reason; - // TODO(stanisc): http://crbug.com/351005: Does this support USS types? const syncer::ModelTypeSet types = GetPreferredDataTypes(); if (data_type_manager_) { // Reconfigure without the encrypted types (excluded implicitly via the @@ -1161,7 +1195,6 @@ void ProfileSyncService::OnPassphraseAccepted() { // Make sure the data types that depend on the passphrase are started at // this time. - // TODO(stanisc): http://crbug.com/351005: Does this support USS types? const syncer::ModelTypeSet types = GetPreferredDataTypes(); if (data_type_manager_) { // Re-enable any encrypted types if necessary. @@ -1265,8 +1298,8 @@ void ProfileSyncService::OnLocalSetPassphraseEncryption( // At this point the user has set a custom passphrase and we have received the // updated nigori state. Time to cache the nigori state, and catch up the // active data types. - sync_prefs_.SetSavedNigoriStateForPassphraseEncryptionTransition( - nigori_state); + sync_prefs_.SetNigoriSpecificsForPassphraseTransition( + nigori_state.nigori_specifics); sync_prefs_.SetPassphraseEncryptionTransitionInProgress(true); BeginConfigureCatchUpBeforeClear(); } @@ -1275,7 +1308,9 @@ void ProfileSyncService::BeginConfigureCatchUpBeforeClear() { DCHECK(data_type_manager_); DCHECK(!saved_nigori_state_); saved_nigori_state_ = - sync_prefs_.GetSavedNigoriStateForPassphraseEncryptionTransition(); + base::MakeUnique<syncer::SyncEncryptionHandler::NigoriState>(); + sync_prefs_.GetNigoriSpecificsForPassphraseTransition( + &saved_nigori_state_->nigori_specifics); const syncer::ModelTypeSet types = GetActiveDataTypes(); catch_up_configure_in_progress_ = true; data_type_manager_->Configure(types, syncer::CONFIGURE_REASON_CATCH_UP); @@ -1326,8 +1361,8 @@ void ProfileSyncService::OnConfigureDone( } // Notify listeners that configuration is done. - FOR_EACH_OBSERVER(syncer::SyncServiceObserver, observers_, - OnSyncConfigurationCompleted()); + for (auto& observer : observers_) + observer.OnSyncConfigurationCompleted(); DVLOG(1) << "PSS OnConfigureDone called with status: " << configure_status_; // The possible status values: @@ -1750,10 +1785,10 @@ void ProfileSyncService::ConfigureDataTypeManager() { this)); // We create the migrator at the same time. - migrator_.reset(new BackendMigrator( + migrator_ = base::MakeUnique<BackendMigrator>( debug_identifier_, GetUserShare(), this, data_type_manager_.get(), base::Bind(&ProfileSyncService::StartSyncingWithServer, - base::Unretained(this)))); + base::Unretained(this))); } syncer::ModelTypeSet types; @@ -1779,7 +1814,7 @@ syncer::UserShare* ProfileSyncService::GetUserShare() const { return backend_->GetUserShare(); } NOTREACHED(); - return NULL; + return nullptr; } syncer::SyncCycleSnapshot ProfileSyncService::GetLastCycleSnapshot() const { @@ -1809,7 +1844,7 @@ void ProfileSyncService::GetModelSafeRoutingInfo( } } -base::Value* ProfileSyncService::GetTypeStatusMap() const { +base::Value* ProfileSyncService::GetTypeStatusMap() { std::unique_ptr<base::ListValue> result(new base::ListValue()); if (!backend_.get() || !backend_initialized_) { @@ -1833,6 +1868,7 @@ base::Value* ProfileSyncService::GetTypeStatusMap() const { SyncBackendHost::Status detailed_status = backend_->GetDetailedStatus(); ModelTypeSet& throttled_types(detailed_status.throttled_types); + ModelTypeSet& backed_off_types(detailed_status.backed_off_types); ModelTypeSet registered = GetRegisteredDataTypes(); std::unique_ptr<base::DictionaryValue> type_status_header( new base::DictionaryValue()); @@ -1848,7 +1884,7 @@ base::Value* ProfileSyncService::GetTypeStatusMap() const { for (ModelTypeSet::Iterator it = registered.First(); it.Good(); it.Inc()) { ModelType type = it.Get(); - type_status.reset(new base::DictionaryValue()); + type_status = base::MakeUnique<base::DictionaryValue>(); type_status->SetString("name", ModelTypeToString(type)); if (error_map.find(type) != error_map.end()) { @@ -1877,12 +1913,18 @@ base::Value* ProfileSyncService::GetTypeStatusMap() const { } else if (throttled_types.Has(type) && passive_types.Has(type)) { type_status->SetString("status", "warning"); type_status->SetString("value", "Passive, Throttled"); + } else if (backed_off_types.Has(type) && passive_types.Has(type)) { + type_status->SetString("status", "warning"); + type_status->SetString("value", "Passive, Backed off"); } else if (passive_types.Has(type)) { type_status->SetString("status", "warning"); type_status->SetString("value", "Passive"); } else if (throttled_types.Has(type)) { type_status->SetString("status", "warning"); type_status->SetString("value", "Throttled"); + } else if (backed_off_types.Has(type)) { + type_status->SetString("status", "warning"); + type_status->SetString("value", "Backed off"); } else if (active_types.Has(type)) { type_status->SetString("status", "ok"); type_status->SetString( @@ -1892,11 +1934,15 @@ base::Value* ProfileSyncService::GetTypeStatusMap() const { type_status->SetString("value", "Disabled by User"); } - int live_count = detailed_status.num_entries_by_type[type] - - detailed_status.num_to_delete_entries_by_type[type]; - type_status->SetInteger("num_entries", - detailed_status.num_entries_by_type[type]); - type_status->SetInteger("num_live", live_count); + const auto& dtc_iter = data_type_controllers_.find(type); + if (dtc_iter != data_type_controllers_.end()) { + // OnDatatypeStatusCounterUpdated that posts back to the UI thread so that + // real results can't get overwritten by the empty counters set at the end + // of this method. + dtc_iter->second->GetStatusCounters(BindToCurrentThread( + base::Bind(&ProfileSyncService::OnDatatypeStatusCounterUpdated, + base::Unretained(this)))); + } result->Append(std::move(type_status)); } @@ -1931,7 +1977,7 @@ void ProfileSyncService::ConsumeCachedPassphraseIfPossible() { void ProfileSyncService::RequestAccessToken() { // Only one active request at a time. - if (access_token_request_ != NULL) + if (access_token_request_ != nullptr) return; request_access_token_retry_timer_.Stop(); OAuth2TokenService::ScopeSet oauth2_scopes; @@ -2216,7 +2262,6 @@ void GetAllNodesRequestHelper::OnReceivedNodesForType( void ProfileSyncService::GetAllNodes( const base::Callback<void(std::unique_ptr<base::ListValue>)>& callback) { - // TODO(stanisc): crbug.com/328606: Make this work for USS datatypes. ModelTypeSet all_types = GetActiveDataTypes(); all_types.PutAll(syncer::ControlTypes()); scoped_refptr<GetAllNodesRequestHelper> helper = @@ -2285,7 +2330,7 @@ bool ProfileSyncService::IsSyncRequested() const { SigninManagerBase* ProfileSyncService::signin() const { if (!signin_) - return NULL; + return nullptr; return signin_->GetOriginal(); } @@ -2365,7 +2410,7 @@ syncer::SyncableService* ProfileSyncService::GetDeviceInfoSyncableService() { return device_info_sync_service_.get(); } -syncer::ModelTypeService* ProfileSyncService::GetDeviceInfoService() { +syncer::ModelTypeSyncBridge* ProfileSyncService::GetDeviceInfoSyncBridge() { return device_info_service_.get(); } @@ -2388,7 +2433,7 @@ void ProfileSyncService::OverrideNetworkResourcesForTest( } bool ProfileSyncService::HasSyncingBackend() const { - return backend_ != NULL; + return backend_ != nullptr; } void ProfileSyncService::UpdateFirstSyncTimePref() { @@ -2401,7 +2446,7 @@ void ProfileSyncService::UpdateFirstSyncTimePref() { } void ProfileSyncService::FlushDirectory() const { - // backend_initialized_ implies backend_ isn't NULL and the manager exists. + // backend_initialized_ implies backend_ isn't null and the manager exists. // If sync is not initialized yet, we fail silently. if (backend_initialized_) backend_->FlushDirectory(); @@ -2414,10 +2459,8 @@ base::FilePath ProfileSyncService::GetDirectoryPathForTest() const { base::MessageLoop* ProfileSyncService::GetSyncLoopForTest() const { if (sync_thread_) { return sync_thread_->message_loop(); - } else if (backend_) { - return backend_->GetSyncLoopForTesting(); } else { - return NULL; + return nullptr; } } diff --git a/chromium/components/browser_sync/profile_sync_service.h b/chromium/components/browser_sync/profile_sync_service.h index f0fb9945b8d..9ef6d1869fc 100644 --- a/chromium/components/browser_sync/profile_sync_service.h +++ b/chromium/components/browser_sync/profile_sync_service.h @@ -28,26 +28,26 @@ #include "components/signin/core/browser/signin_manager_base.h" #include "components/sync/base/experiments.h" #include "components/sync/base/model_type.h" +#include "components/sync/base/sync_prefs.h" #include "components/sync/base/unrecoverable_error_handler.h" -#include "components/sync/core/network_time_update_callback.h" -#include "components/sync/core/shutdown_reason.h" -#include "components/sync/core/sync_manager_factory.h" -#include "components/sync/core/user_share.h" #include "components/sync/device_info/local_device_info_provider.h" #include "components/sync/driver/data_type_controller.h" #include "components/sync/driver/data_type_manager.h" #include "components/sync/driver/data_type_manager_observer.h" #include "components/sync/driver/data_type_status_table.h" #include "components/sync/driver/glue/sync_backend_host.h" -#include "components/sync/driver/protocol_event_observer.h" #include "components/sync/driver/startup_controller.h" #include "components/sync/driver/sync_client.h" #include "components/sync/driver/sync_frontend.h" -#include "components/sync/driver/sync_prefs.h" #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_stopped_reporter.h" +#include "components/sync/engine/events/protocol_event_observer.h" #include "components/sync/engine/model_safe_worker.h" +#include "components/sync/engine/net/network_time_update_callback.h" +#include "components/sync/engine/shutdown_reason.h" +#include "components/sync/engine/sync_manager_factory.h" #include "components/sync/js/sync_js_controller.h" +#include "components/sync/syncable/user_share.h" #include "components/version_info/version_info.h" #include "google_apis/gaia/google_service_auth_error.h" #include "google_apis/gaia/oauth2_token_service.h" @@ -72,7 +72,7 @@ namespace syncer { class BackendMigrator; class BaseTransaction; class DataTypeManager; -class DeviceInfoService; +class DeviceInfoSyncBridge; class DeviceInfoSyncService; class DeviceInfoTracker; class LocalDeviceInfoProvider; @@ -245,8 +245,6 @@ class ProfileSyncService : public syncer::SyncService, scoped_refptr<net::URLRequestContextGetter> url_request_context; std::string debug_identifier; version_info::Channel channel = version_info::Channel::UNKNOWN; - scoped_refptr<base::SingleThreadTaskRunner> db_thread; - scoped_refptr<base::SingleThreadTaskRunner> file_thread; base::SequencedWorkerPool* blocking_pool = nullptr; private: @@ -310,7 +308,7 @@ class ProfileSyncService : public syncer::SyncService, base::string16 GetLastSyncedTimeString() const override; std::string GetBackendInitializationStateString() const override; syncer::SyncCycleSnapshot GetLastCycleSnapshot() const override; - base::Value* GetTypeStatusMap() const override; + base::Value* GetTypeStatusMap() override; const GURL& sync_service_url() const override; std::string unrecoverable_error_message() const override; tracked_objects::Location unrecoverable_error_location() const override; @@ -345,8 +343,8 @@ class ProfileSyncService : public syncer::SyncService, // Returns the SyncableService for syncer::DEVICE_INFO. virtual syncer::SyncableService* GetDeviceInfoSyncableService(); - // Returns the ModelTypeService for syncer::DEVICE_INFO. - virtual syncer::ModelTypeService* GetDeviceInfoService(); + // Returns the ModelTypeSyncBridge for syncer::DEVICE_INFO. + virtual syncer::ModelTypeSyncBridge* GetDeviceInfoSyncBridge(); // Returns synced devices tracker. virtual syncer::DeviceInfoTracker* GetDeviceInfoTracker() const; @@ -374,7 +372,7 @@ class ProfileSyncService : public syncer::SyncService, void OnDirectoryTypeUpdateCounterUpdated( syncer::ModelType type, const syncer::UpdateCounters& counters) override; - void OnDirectoryTypeStatusCounterUpdated( + void OnDatatypeStatusCounterUpdated( syncer::ModelType type, const syncer::StatusCounters& counters) override; void OnConnectionStatusChange(syncer::ConnectionStatus status) override; @@ -468,7 +466,7 @@ class ProfileSyncService : public syncer::SyncService, // server. bool HasUnsyncedItems() const; - // Used by ProfileSyncServiceHarness. May return NULL. + // Used by ProfileSyncServiceHarness. May return null. syncer::BackendMigrator* GetBackendMigratorForTest(); // Used by tests to inspect interaction with OAuth2TokenService. @@ -826,8 +824,6 @@ class ProfileSyncService : public syncer::SyncService, version_info::Channel channel_; // Threading context. - scoped_refptr<base::SingleThreadTaskRunner> db_thread_; - scoped_refptr<base::SingleThreadTaskRunner> file_thread_; base::SequencedWorkerPool* blocking_pool_; // Indicates if this is the first time sync is being configured. This value @@ -921,11 +917,10 @@ class ProfileSyncService : public syncer::SyncService, // and association information. syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; - // A thread where all the sync operations happen. - // OWNERSHIP Notes: - // * Created when backend starts for the first time. - // * If sync is disabled, PSS claims ownership from backend. - // * If sync is reenabled, PSS passes ownership to new backend. + // The thread where all the sync operations happen. This thread is kept alive + // until browser shutdown and reused if sync is turned off and on again. It is + // joined during the shutdown process, but there is an abort mechanism in + // place to prevent slow HTTP requests from blocking browser shutdown. std::unique_ptr<base::Thread> sync_thread_; // ProfileSyncService uses this service to get access tokens. @@ -958,10 +953,10 @@ class ProfileSyncService : public syncer::SyncService, std::unique_ptr<syncer::LocalDeviceInfoProvider> local_device_; - // Locally owned SyncableService and ModelTypeService implementations. + // Locally owned SyncableService and ModelTypeSyncBridge implementations. std::unique_ptr<sync_sessions::SessionsSyncManager> sessions_sync_manager_; std::unique_ptr<syncer::DeviceInfoSyncService> device_info_sync_service_; - std::unique_ptr<syncer::DeviceInfoService> device_info_service_; + std::unique_ptr<syncer::DeviceInfoSyncBridge> device_info_service_; std::unique_ptr<syncer::NetworkResources> network_resources_; diff --git a/chromium/components/browser_sync/profile_sync_service_autofill_unittest.cc b/chromium/components/browser_sync/profile_sync_service_autofill_unittest.cc index 3b322cc2681..7304cdae651 100644 --- a/chromium/components/browser_sync/profile_sync_service_autofill_unittest.cc +++ b/chromium/components/browser_sync/profile_sync_service_autofill_unittest.cc @@ -42,18 +42,18 @@ #include "components/browser_sync/profile_sync_service.h" #include "components/browser_sync/test_profile_sync_service.h" #include "components/sync/base/model_type.h" -#include "components/sync/core/data_type_debug_info_listener.h" -#include "components/sync/core/read_node.h" -#include "components/sync/core/read_transaction.h" -#include "components/sync/core/write_node.h" -#include "components/sync/core/write_transaction.h" #include "components/sync/driver/data_type_controller.h" #include "components/sync/driver/data_type_manager_impl.h" #include "components/sync/driver/sync_api_component_factory_mock.h" +#include "components/sync/engine/data_type_debug_info_listener.h" #include "components/sync/protocol/autofill_specifics.pb.h" #include "components/sync/syncable/mutable_entry.h" +#include "components/sync/syncable/read_node.h" +#include "components/sync/syncable/read_transaction.h" #include "components/sync/syncable/syncable_write_transaction.h" -#include "components/syncable_prefs/pref_service_syncable.h" +#include "components/sync/syncable/write_node.h" +#include "components/sync/syncable/write_transaction.h" +#include "components/sync_preferences/pref_service_syncable.h" #include "components/version_info/version_info.h" #include "components/webdata/common/web_database.h" #include "components/webdata_services/web_data_service_test_util.h" @@ -152,7 +152,7 @@ class AutofillTableMock : public AutofillTable { MOCK_METHOD1(UpdateAutofillEntries, bool(const std::vector<AutofillEntry>&)); // NOLINT MOCK_METHOD1(GetAutofillProfiles, - bool(std::vector<AutofillProfile*>*)); // NOLINT + bool(std::vector<std::unique_ptr<AutofillProfile>>*)); // NOLINT MOCK_METHOD1(UpdateAutofillProfile, bool(const AutofillProfile&)); // NOLINT MOCK_METHOD1(AddAutofillProfile, bool(const AutofillProfile&)); // NOLINT MOCK_METHOD1(RemoveAutofillProfile, bool(const std::string&)); // NOLINT @@ -162,6 +162,12 @@ MATCHER_P(MatchProfiles, profile, "") { return (profile.Compare(arg) == 0); } +ACTION_P(LoadAutofillProfiles, datafunc) { + std::vector<std::unique_ptr<AutofillProfile>> profiles = + std::move(datafunc()); + arg0->swap(profiles); +} + class WebDatabaseFake : public WebDatabase { public: explicit WebDatabaseFake(AutofillTable* autofill_table) { @@ -234,7 +240,7 @@ class TokenWebDataServiceFake : public TokenWebData { WebDataServiceConsumer* consumer) override { // TODO(tim): It would be nice if WebDataService was injected on // construction of ProfileOAuth2TokenService rather than fetched by - // Initialize so that this isn't necessary (we could pass a NULL service). + // Initialize so that this isn't necessary (we could pass a null service). // We currently do return it via EXPECT_CALLs, but without depending on // order-of-initialization (which seems way more fragile) we can't tell // which component is asking at what time, and some components in these @@ -254,9 +260,9 @@ class WebDataServiceFake : public AutofillWebDataService { const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, const scoped_refptr<base::SingleThreadTaskRunner>& db_thread) : AutofillWebDataService(ui_thread, db_thread), - web_database_(NULL), - autocomplete_syncable_service_(NULL), - autofill_profile_syncable_service_(NULL), + web_database_(nullptr), + autocomplete_syncable_service_(nullptr), + autofill_profile_syncable_service_(nullptr), syncable_service_created_or_destroyed_( base::WaitableEvent::ResetPolicy::AUTOMATIC, base::WaitableEvent::InitialState::NOT_SIGNALED), @@ -327,8 +333,8 @@ class WebDataServiceFake : public AutofillWebDataService { const base::Callback<void(syncer::ModelType)>& on_sync_started) { ASSERT_TRUE(db_thread_->RunsTasksOnCurrentThread()); // These services are deleted in DestroySyncableService(). - backend_.reset(new MockAutofillBackend(GetDatabase(), on_changed_callback, - on_sync_started, ui_thread_.get())); + backend_ = base::MakeUnique<MockAutofillBackend>( + GetDatabase(), on_changed_callback, on_sync_started, ui_thread_.get()); AutocompleteSyncableService::CreateForWebDataServiceAndBackend( this, backend_.get()); AutofillProfileSyncableService::CreateForWebDataServiceAndBackend( @@ -344,8 +350,8 @@ class WebDataServiceFake : public AutofillWebDataService { void DestroySyncableService() { ASSERT_TRUE(db_thread_->RunsTasksOnCurrentThread()); - autocomplete_syncable_service_ = NULL; - autofill_profile_syncable_service_ = NULL; + autocomplete_syncable_service_ = nullptr; + autofill_profile_syncable_service_ = nullptr; backend_.reset(); syncable_service_created_or_destroyed_.Signal(); } @@ -402,7 +408,7 @@ class ProfileSyncServiceAutofillTest profile_sync_service_bundle()->set_db_thread( data_type_thread()->task_runner()); - web_database_.reset(new WebDatabaseFake(&autofill_table_)); + web_database_ = base::MakeUnique<WebDatabaseFake>(&autofill_table_); web_data_wrapper_ = base::MakeUnique<MockWebDataServiceWrapper>( new WebDataServiceFake(base::ThreadTaskRunnerHandle::Get(), data_type_thread()->task_runner()), @@ -842,24 +848,25 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeEntriesEmptySync) { std::vector<AutofillEntry> sync_entries; std::vector<AutofillProfile> sync_profiles; ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); - ASSERT_EQ(1U, entries.size()); - EXPECT_TRUE(entries[0] == sync_entries[0]); + ASSERT_EQ(1U, sync_entries.size()); + EXPECT_EQ(entries[0], sync_entries[0]); EXPECT_EQ(0U, sync_profiles.size()); } TEST_F(ProfileSyncServiceAutofillTest, HasProfileEmptySync) { - std::vector<AutofillProfile*> profiles; + std::vector<std::unique_ptr<AutofillProfile>> profiles; std::vector<AutofillProfile> expected_profiles; - // Owned by GetAutofillProfiles caller. - AutofillProfile* profile0 = new AutofillProfile; + std::unique_ptr<AutofillProfile> profile0 = + base::MakeUnique<AutofillProfile>(); autofill::test::SetProfileInfoWithGuid( - profile0, "54B3F9AA-335E-4F71-A27D-719C41564230", "Billing", "Mitchell", - "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", - "Hollywood", "CA", "91601", "US", "12345678910"); - profiles.push_back(profile0); + profile0.get(), "54B3F9AA-335E-4F71-A27D-719C41564230", "Billing", + "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", + "unit 5", "Hollywood", "CA", "91601", "US", "12345678910"); expected_profiles.push_back(*profile0); + profiles.push_back(std::move(profile0)); + auto profile_returner = [&profiles]() { return std::move(profiles); }; EXPECT_CALL(autofill_table(), GetAutofillProfiles(_)) - .WillOnce(DoAll(SetArgumentPointee<0>(profiles), Return(true))); + .WillOnce(DoAll(LoadAutofillProfiles(profile_returner), Return(true))); EXPECT_CALL(personal_data_manager(), Refresh()); SetIdleChangeProcessorExpectations(); CreateRootHelper create_root(this, AUTOFILL_PROFILE); @@ -924,7 +931,7 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncNoMerge) { std::set<AutofillEntry> new_sync_entries_set(new_sync_entries.begin(), new_sync_entries.end()); - EXPECT_TRUE(expected_entries == new_sync_entries_set); + EXPECT_EQ(expected_entries, new_sync_entries_set); } TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeEntry) { @@ -953,7 +960,7 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeEntry) { ASSERT_TRUE( GetAutofillEntriesFromSyncDB(&new_sync_entries, &new_sync_profiles)); ASSERT_EQ(1U, new_sync_entries.size()); - EXPECT_TRUE(merged_entry == new_sync_entries[0]); + EXPECT_EQ(merged_entry, new_sync_entries[0]); } TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeProfile) { @@ -963,16 +970,20 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeProfile) { "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910"); - AutofillProfile* native_profile = new AutofillProfile; + std::unique_ptr<AutofillProfile> native_profile = + base::MakeUnique<AutofillProfile>(); autofill::test::SetProfileInfoWithGuid( - native_profile, "23355099-1170-4B71-8ED4-144470CC9EBE", "Billing", + native_profile.get(), "23355099-1170-4B71-8ED4-144470CC9EBE", "Billing", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549"); - std::vector<AutofillProfile*> native_profiles; - native_profiles.push_back(native_profile); + std::vector<std::unique_ptr<AutofillProfile>> native_profiles; + native_profiles.push_back(std::move(native_profile)); + auto profile_returner = [&native_profiles]() { + return std::move(native_profiles); + }; EXPECT_CALL(autofill_table(), GetAutofillProfiles(_)) - .WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true))); + .WillOnce(DoAll(LoadAutofillProfiles(profile_returner), Return(true))); std::vector<AutofillProfile> sync_profiles; sync_profiles.push_back(sync_profile); @@ -1007,9 +1018,10 @@ TEST_F( "unit 5", "Hollywood", "CA", "91601", "US", "12345678910"); sync_profile.set_use_date(base::Time::FromTimeT(4321)); - AutofillProfile* native_profile = new AutofillProfile; + std::unique_ptr<AutofillProfile> native_profile = + base::MakeUnique<AutofillProfile>(); autofill::test::SetProfileInfoWithGuid( - native_profile, "23355099-1170-4B71-8ED4-144470CC9EBF", "Billing", + native_profile.get(), "23355099-1170-4B71-8ED4-144470CC9EBF", "Billing", "Mitchell", "Morrison", "johnwayne@me.xyz", "", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910"); native_profile->set_use_date(base::Time::FromTimeT(1234)); @@ -1019,10 +1031,13 @@ TEST_F( ASCIIToUTF16("Billing Mitchell Morrison")); expected_profile.set_use_count(1); - std::vector<AutofillProfile*> native_profiles; - native_profiles.push_back(native_profile); + std::vector<std::unique_ptr<AutofillProfile>> native_profiles; + native_profiles.push_back(std::move(native_profile)); + auto profile_returner = [&native_profiles]() { + return std::move(native_profiles); + }; EXPECT_CALL(autofill_table(), GetAutofillProfiles(_)) - .WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true))); + .WillOnce(DoAll(LoadAutofillProfiles(profile_returner), Return(true))); EXPECT_CALL(autofill_table(), AddAutofillProfile(MatchProfiles(expected_profile))) .WillOnce(Return(true)); @@ -1067,9 +1082,10 @@ TEST_F(ProfileSyncServiceAutofillTest, "unit 5", "Hollywood", "CA", "91601", "US", "12345678910"); sync_profile.set_use_date(base::Time::FromTimeT(1234)); - AutofillProfile* native_profile = new AutofillProfile; + std::unique_ptr<AutofillProfile> native_profile = + base::MakeUnique<AutofillProfile>(); autofill::test::SetProfileInfoWithGuid( - native_profile, "23355099-1170-4B71-8ED4-144470CC9EBF", "Billing", + native_profile.get(), "23355099-1170-4B71-8ED4-144470CC9EBF", "Billing", "Mitchell", "Morrison", "johnwayne@me.xyz", "", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910"); native_profile->set_use_date(base::Time::FromTimeT(4321)); @@ -1080,10 +1096,13 @@ TEST_F(ProfileSyncServiceAutofillTest, expected_profile.set_use_count(1); expected_profile.set_use_date(native_profile->use_date()); - std::vector<AutofillProfile*> native_profiles; - native_profiles.push_back(native_profile); + std::vector<std::unique_ptr<AutofillProfile>> native_profiles; + native_profiles.push_back(std::move(native_profile)); + auto profile_returner = [&native_profiles]() { + return std::move(native_profiles); + }; EXPECT_CALL(autofill_table(), GetAutofillProfiles(_)) - .WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true))); + .WillOnce(DoAll(LoadAutofillProfiles(profile_returner), Return(true))); EXPECT_CALL(autofill_table(), AddAutofillProfile(MatchProfiles(expected_profile))) .WillOnce(Return(true)); @@ -1130,9 +1149,10 @@ TEST_F(ProfileSyncServiceAutofillTest, "Hollywood", "CA", "91601", "US", "12345678910"); sync_profile.set_use_date(base::Time::FromTimeT(4321)); - AutofillProfile* native_profile = new AutofillProfile; + std::unique_ptr<AutofillProfile> native_profile = + base::MakeUnique<AutofillProfile>(); autofill::test::SetProfileInfoWithGuid( - native_profile, "23355099-1170-4B71-8ED4-144470CC9EBF", "Billing", + native_profile.get(), "23355099-1170-4B71-8ED4-144470CC9EBF", "Billing", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910"); native_profile->set_use_date(base::Time::FromTimeT(1234)); @@ -1143,10 +1163,13 @@ TEST_F(ProfileSyncServiceAutofillTest, expected_profile.set_use_date(sync_profile.use_date()); expected_profile.set_use_count(1); - std::vector<AutofillProfile*> native_profiles; - native_profiles.push_back(native_profile); + std::vector<std::unique_ptr<AutofillProfile>> native_profiles; + native_profiles.push_back(std::move(native_profile)); + auto profile_returner = [&native_profiles]() { + return std::move(native_profiles); + }; EXPECT_CALL(autofill_table(), GetAutofillProfiles(_)) - .WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true))); + .WillOnce(DoAll(LoadAutofillProfiles(profile_returner), Return(true))); EXPECT_CALL(autofill_table(), AddAutofillProfile(MatchProfiles(expected_profile))) .WillOnce(Return(true)); @@ -1168,7 +1191,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ASSERT_EQ(1U, new_sync_profiles.size()); // Check that key fields are the same. EXPECT_TRUE(new_sync_profiles[0].IsSubsetOf(expected_profile, "en-US")); - // Make sure the addtional information of the native profile was saved into + // Make sure the additional information of the native profile was saved into // the sync profile. EXPECT_EQ(ASCIIToUTF16("Fox"), new_sync_profiles[0].GetRawInfo(ServerFieldType::COMPANY_NAME)); @@ -1188,17 +1211,21 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSync_DifferentPrimaryInfo) { "unit 5", "Hollywood", "CA", "91601", "US", "12345678910"); sync_profile.set_use_date(base::Time::FromTimeT(4321)); - AutofillProfile* native_profile = new AutofillProfile; + std::unique_ptr<AutofillProfile> native_profile = + base::MakeUnique<AutofillProfile>(); autofill::test::SetProfileInfoWithGuid( - native_profile, "23355099-1170-4B71-8ED4-144470CC9EBF", "Billing", "John", - "Smith", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", - "CA", "91601", "US", "12345678910"); + native_profile.get(), "23355099-1170-4B71-8ED4-144470CC9EBF", "Billing", + "John", "Smith", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", + "Hollywood", "CA", "91601", "US", "12345678910"); native_profile->set_use_date(base::Time::FromTimeT(1234)); - std::vector<AutofillProfile*> native_profiles; - native_profiles.push_back(native_profile); + std::vector<std::unique_ptr<AutofillProfile>> native_profiles; + native_profiles.push_back(std::move(native_profile)); + auto profile_returner = [&native_profiles]() { + return std::move(native_profiles); + }; EXPECT_CALL(autofill_table(), GetAutofillProfiles(_)) - .WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true))); + .WillOnce(DoAll(LoadAutofillProfiles(profile_returner), Return(true))); EXPECT_CALL(autofill_table(), AddAutofillProfile(MatchProfiles(sync_profile))) .WillOnce(Return(true)); std::vector<AutofillProfile> sync_profiles; @@ -1231,18 +1258,22 @@ TEST_F(ProfileSyncServiceAutofillTest, MergeProfileWithDifferentGuid) { sync_profile.set_use_date(base::Time::FromTimeT(1234)); std::string native_guid = "EDC609ED-7EEE-4F27-B00C-423242A9C44B"; - AutofillProfile* native_profile = new AutofillProfile; + std::unique_ptr<AutofillProfile> native_profile = + base::MakeUnique<AutofillProfile>(); autofill::test::SetProfileInfoWithGuid( - native_profile, native_guid.c_str(), "Billing", "Mitchell", "Morrison", - "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", - "91601", "US", "12345678910"); + native_profile.get(), native_guid.c_str(), "Billing", "Mitchell", + "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", + "Hollywood", "CA", "91601", "US", "12345678910"); native_profile->set_use_count(5); native_profile->set_use_date(base::Time::FromTimeT(4321)); - std::vector<AutofillProfile*> native_profiles; - native_profiles.push_back(native_profile); + std::vector<std::unique_ptr<AutofillProfile>> native_profiles; + native_profiles.push_back(std::move(native_profile)); + auto profile_returner = [&native_profiles]() { + return std::move(native_profiles); + }; EXPECT_CALL(autofill_table(), GetAutofillProfiles(_)) - .WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true))); + .WillOnce(DoAll(LoadAutofillProfiles(profile_returner), Return(true))); std::vector<AutofillProfile> sync_profiles; sync_profiles.push_back(sync_profile); @@ -1295,7 +1326,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddEntry) { ASSERT_TRUE( GetAutofillEntriesFromSyncDB(&new_sync_entries, &new_sync_profiles)); ASSERT_EQ(1U, new_sync_entries.size()); - EXPECT_TRUE(added_entry == new_sync_entries[0]); + EXPECT_EQ(added_entry, new_sync_entries[0]); } TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfile) { @@ -1352,7 +1383,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateEntry) { ASSERT_TRUE( GetAutofillEntriesFromSyncDB(&new_sync_entries, &new_sync_profiles)); ASSERT_EQ(1U, new_sync_entries.size()); - EXPECT_TRUE(updated_entry == new_sync_entries[0]); + EXPECT_EQ(updated_entry, new_sync_entries[0]); } TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveEntry) { @@ -1385,16 +1416,20 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveProfile) { &sync_profile, "3BA5FA1B-1EC4-4BB3-9B57-EC92BE3C1A09", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549"); - AutofillProfile* native_profile = new AutofillProfile; + std::unique_ptr<AutofillProfile> native_profile = + base::MakeUnique<AutofillProfile>(); autofill::test::SetProfileInfoWithGuid( - native_profile, "3BA5FA1B-1EC4-4BB3-9B57-EC92BE3C1A09", "Josephine", + native_profile.get(), "3BA5FA1B-1EC4-4BB3-9B57-EC92BE3C1A09", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549"); - std::vector<AutofillProfile*> native_profiles; - native_profiles.push_back(native_profile); + std::vector<std::unique_ptr<AutofillProfile>> native_profiles; + native_profiles.push_back(std::move(native_profile)); + auto profile_returner = [&native_profiles]() { + return std::move(native_profiles); + }; EXPECT_CALL(autofill_table(), GetAutofillProfiles(_)) - .WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true))); + .WillOnce(DoAll(LoadAutofillProfiles(profile_returner), Return(true))); std::vector<AutofillProfile> sync_profiles; sync_profiles.push_back(sync_profile); @@ -1404,7 +1439,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveProfile) { ASSERT_TRUE(add_autofill.success()); AutofillProfileChange change(AutofillProfileChange::REMOVE, - sync_profile.guid(), NULL); + sync_profile.guid(), nullptr); web_data_service()->OnAutofillProfileChanged(change); std::vector<AutofillProfile> new_sync_profiles; diff --git a/chromium/components/browser_sync/profile_sync_service_bookmark_unittest.cc b/chromium/components/browser_sync/profile_sync_service_bookmark_unittest.cc index ff90423810f..caecac85917 100644 --- a/chromium/components/browser_sync/profile_sync_service_bookmark_unittest.cc +++ b/chromium/components/browser_sync/profile_sync_service_bookmark_unittest.cc @@ -37,22 +37,22 @@ #include "components/bookmarks/test/bookmark_test_helpers.h" #include "components/bookmarks/test/test_bookmark_client.h" #include "components/browser_sync/profile_sync_test_util.h" -#include "components/sync/api/data_type_error_handler.h" -#include "components/sync/api/data_type_error_handler_mock.h" -#include "components/sync/api/sync_error.h" -#include "components/sync/api/sync_merge_result.h" -#include "components/sync/core/change_record.h" -#include "components/sync/core/read_node.h" -#include "components/sync/core/read_transaction.h" -#include "components/sync/core/test/test_user_share.h" -#include "components/sync/core/write_node.h" -#include "components/sync/core/write_transaction.h" -#include "components/sync/core_impl/syncapi_internal.h" #include "components/sync/driver/fake_sync_client.h" +#include "components/sync/engine/engine_util.h" +#include "components/sync/model/data_type_error_handler.h" +#include "components/sync/model/data_type_error_handler_mock.h" +#include "components/sync/model/sync_error.h" +#include "components/sync/model/sync_merge_result.h" +#include "components/sync/syncable/change_record.h" #include "components/sync/syncable/mutable_entry.h" +#include "components/sync/syncable/read_node.h" +#include "components/sync/syncable/read_transaction.h" #include "components/sync/syncable/syncable_id.h" #include "components/sync/syncable/syncable_util.h" #include "components/sync/syncable/syncable_write_transaction.h" +#include "components/sync/syncable/test_user_share.h" +#include "components/sync/syncable/write_node.h" +#include "components/sync/syncable/write_transaction.h" #include "components/sync_bookmarks/bookmark_change_processor.h" #include "components/sync_bookmarks/bookmark_model_associator.h" #include "testing/gmock/include/gmock/gmock.h" @@ -118,7 +118,7 @@ class FakeServerChange { EXPECT_EQ(BaseNode::INIT_OK, parent.InitByIdLookup(parent_id)); syncer::WriteNode node(trans_); if (predecessor_id == 0) { - EXPECT_TRUE(node.InitBookmarkByCreation(parent, NULL)); + EXPECT_TRUE(node.InitBookmarkByCreation(parent, nullptr)); } else { syncer::ReadNode predecessor(trans_); EXPECT_EQ(BaseNode::INIT_OK, predecessor.InitByIdLookup(predecessor_id)); @@ -151,7 +151,7 @@ class FakeServerChange { bool is_folder, int64_t parent_id, int64_t predecessor_id) { - return AddWithMetaInfo(title, url, NULL, is_folder, parent_id, + return AddWithMetaInfo(title, url, nullptr, is_folder, parent_id, predecessor_id); } @@ -235,7 +235,7 @@ class FakeServerChange { EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id)); int64_t old_parent_id = node.GetParentId(); if (predecessor_id == 0) { - EXPECT_TRUE(node.SetPosition(parent, NULL)); + EXPECT_TRUE(node.SetPosition(parent, nullptr)); } else { syncer::ReadNode predecessor(trans_); EXPECT_EQ(BaseNode::INIT_OK, predecessor.InitByIdLookup(predecessor_id)); @@ -399,7 +399,7 @@ class ProfileSyncServiceBookmarkTest : public testing::Test { bookmark_bar.InitByTagLookupForBookmarks("bookmark_bar")); syncer::WriteNode node(trans); - EXPECT_TRUE(node.InitBookmarkByCreation(bookmark_bar, NULL)); + EXPECT_TRUE(node.InitBookmarkByCreation(bookmark_bar, nullptr)); node.SetIsFolder(true); node.SetTitle(title); @@ -428,7 +428,7 @@ class ProfileSyncServiceBookmarkTest : public testing::Test { specifics.set_title(title); syncer::WriteNode node(trans); - EXPECT_TRUE(node.InitBookmarkByCreation(parent, NULL)); + EXPECT_TRUE(node.InitBookmarkByCreation(parent, nullptr)); node.SetIsFolder(false); node.SetTitle(title); node.SetBookmarkSpecifics(specifics); @@ -524,7 +524,7 @@ class ProfileSyncServiceBookmarkTest : public testing::Test { // If it doesn't exist, create the permanent node at the end of the // ordering. syncer::ReadNode predecessor_node(&trans); - syncer::ReadNode* predecessor = NULL; + syncer::ReadNode* predecessor = nullptr; if (last_child_id != syncer::kInvalidId) { EXPECT_EQ(BaseNode::INIT_OK, predecessor_node.InitByIdLookup(last_child_id)); @@ -546,10 +546,10 @@ class ProfileSyncServiceBookmarkTest : public testing::Test { DCHECK(!model_associator_); // Set up model associator. - model_associator_.reset(new BookmarkModelAssociator( + model_associator_ = base::MakeUnique<BookmarkModelAssociator>( model_.get(), sync_client_.get(), test_user_share_.user_share(), base::MakeUnique<syncer::DataTypeErrorHandlerMock>(), - kExpectMobileBookmarks)); + kExpectMobileBookmarks); local_merge_result_ = syncer::SyncMergeResult(syncer::BOOKMARKS); syncer_merge_result_ = syncer::SyncMergeResult(syncer::BOOKMARKS); @@ -662,7 +662,7 @@ class ProfileSyncServiceBookmarkTest : public testing::Test { } // Note: the managed node is the last child of the root_node but isn't // synced; if CanSyncNode() is false then there is no next node to sync. - const BookmarkNode* bnext = NULL; + const BookmarkNode* bnext = nullptr; if (browser_index + 1 < bnode->parent()->child_count()) bnext = bnode->parent()->GetChild(browser_index + 1); if (!bnext || !CanSyncNode(bnext)) { @@ -994,7 +994,7 @@ TEST_F(ProfileSyncServiceBookmarkTest, // Create sync folders matching native folders above. int64_t parent_id = 0; syncer::WriteTransaction trans(FROM_HERE, test_user_share()->user_share()); - // Create in reverse order because AddFolderToShare passes NULL for + // Create in reverse order because AddFolderToShare passes null for // |predecessor| argument. for (int i = kNumFolders - 1; i >= 0; i--) { int64_t id = AddFolderToShare(&trans, "folder"); @@ -1014,7 +1014,7 @@ TEST_F(ProfileSyncServiceBookmarkTest, } // Create sync bookmark matching native bookmarks above in reverse order - // because AddBookmarkToShare passes NULL for |predecessor| argument. + // because AddBookmarkToShare passes null for |predecessor| argument. for (int i = kNumBookmarks - 1; i >= 0; i--) { int id = AddBookmarkToShare(&trans, parent_id, "bookmark", "http://www.google.com/"); @@ -1694,9 +1694,9 @@ namespace { static TestData kBookmarkBarChildren[] = { {"u2", "http://www.u2.com/"}, - {"f1", NULL}, + {"f1", nullptr}, {"u1", "http://www.u1.com/"}, - {"f2", NULL}, + {"f2", nullptr}, }; static TestData kF1Children[] = { {"f1u4", "http://www.f1u4.com/"}, @@ -1711,12 +1711,12 @@ static TestData kF2Children[] = { {"f2u1", "http://www.f2u1.com/"}, }; -static TestData kOtherBookmarkChildren[] = {{"f3", NULL}, +static TestData kOtherBookmarkChildren[] = {{"f3", nullptr}, {"u4", "http://www.u4.com/"}, {"u3", "http://www.u3.com/"}, - {"f4", NULL}, - {"dup", NULL}, - {"dup", NULL}, + {"f4", nullptr}, + {"dup", nullptr}, + {"dup", nullptr}, {" ls ", "http://www.ls.com/"}}; static TestData kF3Children[] = { {"f3u4", "http://www.f3u4.com/"}, @@ -1738,8 +1738,8 @@ static TestData kDup2Children[] = { }; static TestData kMobileBookmarkChildren[] = { - {"f5", NULL}, - {"f6", NULL}, + {"f5", nullptr}, + {"f6", nullptr}, {"u5", "http://www.u5.com/"}, }; static TestData kF5Children[] = { @@ -1771,7 +1771,7 @@ void ProfileSyncServiceBookmarkTestWithData::PopulateFromTestData( start_time_ + base::TimeDelta::FromMinutes(*running_count); model()->AddURLWithCreationTimeAndMetaInfo( node, i, base::UTF8ToUTF16(item.title), GURL(item.url), add_time, - NULL); + nullptr); } else { model()->AddFolder(node, i, base::UTF8ToUTF16(item.title)); } @@ -1791,7 +1791,7 @@ void ProfileSyncServiceBookmarkTestWithData::CompareWithTestData( for (int i = 0; i < size; ++i) { const BookmarkNode* child_node = node->GetChild(i); const TestData& item = data[i]; - GURL url = GURL(item.url == NULL ? "" : item.url); + GURL url = GURL(item.url == nullptr ? "" : item.url); BookmarkNode test_node(url); test_node.SetTitle(base::UTF8ToUTF16(item.title)); EXPECT_EQ(child_node->GetTitle(), test_node.GetTitle()); diff --git a/chromium/components/browser_sync/profile_sync_service_mock.h b/chromium/components/browser_sync/profile_sync_service_mock.h index 3ddb30f54e9..eea90410608 100644 --- a/chromium/components/browser_sync/profile_sync_service_mock.h +++ b/chromium/components/browser_sync/profile_sync_service_mock.h @@ -13,8 +13,8 @@ #include "components/browser_sync/profile_sync_service.h" #include "components/sync/base/model_type.h" #include "components/sync/device_info/device_info.h" -#include "components/sync/driver/change_processor.h" #include "components/sync/driver/data_type_controller.h" +#include "components/sync/model/change_processor.h" #include "components/sync/protocol/sync_protocol_error.h" #include "google_apis/gaia/google_service_auth_error.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/chromium/components/browser_sync/profile_sync_service_startup_unittest.cc b/chromium/components/browser_sync/profile_sync_service_startup_unittest.cc index a608d123c4b..8a421875e11 100644 --- a/chromium/components/browser_sync/profile_sync_service_startup_unittest.cc +++ b/chromium/components/browser_sync/profile_sync_service_startup_unittest.cc @@ -5,6 +5,7 @@ #include "components/browser_sync/profile_sync_service.h" #include "base/files/file_util.h" +#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_task_runner_handle.h" #include "components/browser_sync/profile_sync_test_util.h" @@ -14,13 +15,13 @@ #include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/signin_manager.h" #include "components/signin/core/common/signin_pref_names.h" +#include "components/sync/base/pref_names.h" #include "components/sync/driver/data_type_manager_mock.h" #include "components/sync/driver/fake_data_type_controller.h" #include "components/sync/driver/glue/sync_backend_host_mock.h" -#include "components/sync/driver/pref_names.h" #include "components/sync/driver/sync_api_component_factory_mock.h" #include "components/sync/driver/sync_service_observer.h" -#include "components/syncable_prefs/pref_service_syncable.h" +#include "components/sync_preferences/pref_service_syncable.h" #include "google_apis/gaia/gaia_auth_consumer.h" #include "google_apis/gaia/gaia_constants.h" #include "net/url_request/url_request_test_util.h" @@ -90,7 +91,8 @@ class ProfileSyncServiceStartupTest : public testing::Test { profile_sync_service_bundle_.CreateBasicInitParams(start_behavior, builder.Build()); - sync_service_.reset(new ProfileSyncService(std::move(init_params))); + sync_service_ = + base::MakeUnique<ProfileSyncService>(std::move(init_params)); sync_service_->RegisterDataTypeController( base::MakeUnique<syncer::FakeDataTypeController>(syncer::BOOKMARKS)); sync_service_->AddObserver(&observer_); diff --git a/chromium/components/browser_sync/profile_sync_service_typed_url_unittest.cc b/chromium/components/browser_sync/profile_sync_service_typed_url_unittest.cc index cded15d4c9c..bab7b5be9de 100644 --- a/chromium/components/browser_sync/profile_sync_service_typed_url_unittest.cc +++ b/chromium/components/browser_sync/profile_sync_service_typed_url_unittest.cc @@ -32,13 +32,13 @@ #include "components/history/core/browser/history_service.h" #include "components/history/core/browser/typed_url_data_type_controller.h" #include "components/signin/core/browser/signin_manager.h" -#include "components/sync/api/data_type_error_handler_mock.h" -#include "components/sync/core/read_node.h" -#include "components/sync/core/read_transaction.h" -#include "components/sync/core/write_node.h" -#include "components/sync/core/write_transaction.h" #include "components/sync/driver/data_type_manager_impl.h" +#include "components/sync/model/data_type_error_handler_mock.h" #include "components/sync/protocol/typed_url_specifics.pb.h" +#include "components/sync/syncable/read_node.h" +#include "components/sync/syncable/read_transaction.h" +#include "components/sync/syncable/write_node.h" +#include "components/sync/syncable/write_transaction.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" @@ -124,7 +124,7 @@ class HistoryServiceMock : public history::HistoryService { private: void RunTaskOnDBThread(history::HistoryDBTask* task) { - EXPECT_TRUE(task->RunOnDBThread(backend_.get(), NULL)); + EXPECT_TRUE(task->RunOnDBThread(backend_.get(), nullptr)); } scoped_refptr<base::SingleThreadTaskRunner> task_runner_; @@ -512,7 +512,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, HasNativeHasSyncNoMerge) { history::URLRows new_sync_entries; GetTypedUrlsFromSyncDB(&new_sync_entries); - EXPECT_TRUE(new_sync_entries.size() == expected.size()); + EXPECT_EQ(expected.size(), new_sync_entries.size()); for (history::URLRows::iterator entry = new_sync_entries.begin(); entry != new_sync_entries.end(); ++entry) { EXPECT_TRUE(URLsEqual(expected[entry->url().spec()], *entry)); diff --git a/chromium/components/browser_sync/profile_sync_service_unittest.cc b/chromium/components/browser_sync/profile_sync_service_unittest.cc index 86368bd3ad1..6832d2cc173 100644 --- a/chromium/components/browser_sync/profile_sync_service_unittest.cc +++ b/chromium/components/browser_sync/profile_sync_service_unittest.cc @@ -9,6 +9,7 @@ #include "base/callback.h" #include "base/command_line.h" #include "base/feature_list.h" +#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" @@ -24,21 +25,23 @@ #include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/fake_signin_manager.h" #include "components/strings/grit/components_strings.h" +#include "components/sync/base/pref_names.h" #include "components/sync/driver/fake_data_type_controller.h" #include "components/sync/driver/glue/sync_backend_host_mock.h" -#include "components/sync/driver/pref_names.h" #include "components/sync/driver/sync_api_component_factory_mock.h" #include "components/sync/driver/sync_driver_switches.h" #include "components/sync/driver/sync_service_observer.h" #include "components/sync/driver/sync_util.h" -#include "components/syncable_prefs/testing_pref_service_syncable.h" +#include "components/sync_preferences/testing_pref_service_syncable.h" #include "components/version_info/version_info_values.h" #include "google_apis/gaia/gaia_constants.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" +using syncer::DataTypeController; using syncer::SyncBackendHostMock; +using syncer::SyncMergeResult; using testing::Return; namespace browser_sync { @@ -102,14 +105,14 @@ class TestSyncServiceObserver : public syncer::SyncServiceObserver { class SyncBackendHostNoReturn : public SyncBackendHostMock { void Initialize( syncer::SyncFrontend* frontend, - std::unique_ptr<base::Thread> sync_thread, - const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, - const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, + base::Thread* sync_thread, const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, const GURL& service_url, const std::string& sync_user_agent, const syncer::SyncCredentials& credentials, bool delete_sync_data_folder, + bool enable_local_sync_backend, + const base::FilePath& local_sync_backend_folder, std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory, const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& unrecoverable_error_handler, @@ -127,14 +130,14 @@ class SyncBackendHostMockCollectDeleteDirParam : public SyncBackendHostMock { void Initialize( syncer::SyncFrontend* frontend, - std::unique_ptr<base::Thread> sync_thread, - const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, - const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, + base::Thread* sync_thread, const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, const GURL& service_url, const std::string& sync_user_agent, const syncer::SyncCredentials& credentials, bool delete_sync_data_folder, + bool enable_local_sync_backend, + const base::FilePath& local_sync_backend_folder, std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory, const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& unrecoverable_error_handler, @@ -144,11 +147,11 @@ class SyncBackendHostMockCollectDeleteDirParam : public SyncBackendHostMock { saved_nigori_state) override { delete_dir_param_->push_back(delete_sync_data_folder); SyncBackendHostMock::Initialize( - frontend, std::move(sync_thread), db_thread, file_thread, event_handler, - service_url, sync_user_agent, credentials, delete_sync_data_folder, - std::move(sync_manager_factory), unrecoverable_error_handler, - report_unrecoverable_error_function, http_post_provider_factory_getter, - std::move(saved_nigori_state)); + frontend, sync_thread, event_handler, service_url, sync_user_agent, + credentials, delete_sync_data_folder, enable_local_sync_backend, + local_sync_backend_folder, std::move(sync_manager_factory), + unrecoverable_error_handler, report_unrecoverable_error_function, + http_post_provider_factory_getter, std::move(saved_nigori_state)); } private: @@ -198,6 +201,10 @@ ACTION_P(ReturnNewMockHostCaptureClearServerData, captured_callback) { &OnClearServerDataCalled, base::Unretained(captured_callback))); } +void DoNothing(DataTypeController::ConfigureResult ignored1, + const SyncMergeResult& ignored2, + const SyncMergeResult& ignored3) {} + // A test harness that uses a real ProfileSyncService and in most cases a // MockSyncBackendHost. // @@ -236,7 +243,7 @@ class ProfileSyncServiceTest : public ::testing::Test { profile_sync_service_bundle_.CreateBasicInitParams(behavior, builder.Build()); - service_.reset(new ProfileSyncService(std::move(init_params))); + service_ = base::MakeUnique<ProfileSyncService>(std::move(init_params)); service_->RegisterDataTypeController( base::MakeUnique<syncer::FakeDataTypeController>(syncer::BOOKMARKS)); } @@ -354,7 +361,7 @@ class ProfileSyncServiceTest : public ::testing::Test { ProfileSyncService* service() { return service_.get(); } - syncable_prefs::TestingPrefServiceSyncable* prefs() { + sync_preferences::TestingPrefServiceSyncable* prefs() { return profile_sync_service_bundle_.pref_service(); } @@ -951,5 +958,21 @@ TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { service()->OnSyncCycleCompleted(); } +// The OpenTabsUIDelegate should only be accessable when PROXY_TABS is enabled. +TEST_F(ProfileSyncServiceTest, GetOpenTabsUIDelegate) { + CreateService(ProfileSyncService::AUTO_START); + InitializeForNthSync(); + EXPECT_EQ(nullptr, service()->GetOpenTabsUIDelegate()); + + auto controller = + base::MakeUnique<syncer::FakeDataTypeController>(syncer::PROXY_TABS); + // Progress the controller to RUNNING first, which is how the service + // determines whether a type is enabled. + controller->StartAssociating(base::Bind(&DoNothing)); + controller->FinishStart(DataTypeController::OK_FIRST_RUN); + service()->RegisterDataTypeController(std::move(controller)); + EXPECT_NE(nullptr, service()->GetOpenTabsUIDelegate()); +} + } // namespace } // namespace browser_sync diff --git a/chromium/components/browser_sync/profile_sync_test_util.cc b/chromium/components/browser_sync/profile_sync_test_util.cc index 1732fcda728..abf769319b8 100644 --- a/chromium/components/browser_sync/profile_sync_test_util.cc +++ b/chromium/components/browser_sync/profile_sync_test_util.cc @@ -9,12 +9,13 @@ #include "base/memory/ptr_util.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/history/core/browser/history_model_worker.h" +#include "components/history/core/browser/history_service.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/signin/core/browser/signin_manager_base.h" +#include "components/sync/base/sync_prefs.h" #include "components/sync/driver/glue/browser_thread_model_worker.h" #include "components/sync/driver/glue/ui_model_worker.h" #include "components/sync/driver/signin_manager_wrapper.h" -#include "components/sync/driver/sync_prefs.h" #include "components/sync/engine/passive_model_worker.h" #include "net/url_request/url_request_test_util.h" @@ -47,8 +48,7 @@ class BundleSyncClient : public syncer::FakeSyncClient { syncer::ModelType type) override; syncer::SyncService* GetSyncService() override; scoped_refptr<syncer::ModelSafeWorker> CreateModelWorkerForGroup( - syncer::ModelSafeGroup group, - syncer::WorkerLoopDestructionObserver* observer) override; + syncer::ModelSafeGroup group) override; history::HistoryService* GetHistoryService() override; bookmarks::BookmarkModel* GetBookmarkModel() override; @@ -122,31 +122,26 @@ syncer::SyncService* BundleSyncClient::GetSyncService() { } scoped_refptr<syncer::ModelSafeWorker> -BundleSyncClient::CreateModelWorkerForGroup( - syncer::ModelSafeGroup group, - syncer::WorkerLoopDestructionObserver* observer) { +BundleSyncClient::CreateModelWorkerForGroup(syncer::ModelSafeGroup group) { if (!db_thread_) - return FakeSyncClient::CreateModelWorkerForGroup(group, observer); + return FakeSyncClient::CreateModelWorkerForGroup(group); DCHECK(file_thread_) << "DB thread was specified but FILE thread was not."; switch (group) { case syncer::GROUP_DB: - return new syncer::BrowserThreadModelWorker(db_thread_, syncer::GROUP_DB, - observer); + return new syncer::BrowserThreadModelWorker(db_thread_, syncer::GROUP_DB); case syncer::GROUP_FILE: return new syncer::BrowserThreadModelWorker(file_thread_, - syncer::GROUP_FILE, observer); + syncer::GROUP_FILE); case syncer::GROUP_UI: - return new syncer::UIModelWorker(base::ThreadTaskRunnerHandle::Get(), - observer); + return new syncer::UIModelWorker(base::ThreadTaskRunnerHandle::Get()); case syncer::GROUP_PASSIVE: - return new syncer::PassiveModelWorker(observer); + return new syncer::PassiveModelWorker(); case syncer::GROUP_HISTORY: { history::HistoryService* history_service = GetHistoryService(); if (!history_service) return nullptr; return new HistoryModelWorker(history_service->AsWeakPtr(), - base::ThreadTaskRunnerHandle::Get(), - observer); + base::ThreadTaskRunnerHandle::Get()); } default: return nullptr; @@ -265,8 +260,6 @@ ProfileSyncService::InitParams ProfileSyncServiceBundle::CreateBasicInitParams( init_params.url_request_context = url_request_context(); init_params.debug_identifier = "dummyDebugName"; init_params.channel = version_info::Channel::UNKNOWN; - init_params.db_thread = db_thread_; - init_params.file_thread = base::ThreadTaskRunnerHandle::Get(); init_params.blocking_pool = worker_pool_owner_.pool().get(); return init_params; diff --git a/chromium/components/browser_sync/profile_sync_test_util.h b/chromium/components/browser_sync/profile_sync_test_util.h index 1c573a74abc..48e7d1935ff 100644 --- a/chromium/components/browser_sync/profile_sync_test_util.h +++ b/chromium/components/browser_sync/profile_sync_test_util.h @@ -21,8 +21,8 @@ #include "components/signin/core/browser/test_signin_client.h" #include "components/sync/driver/fake_sync_client.h" #include "components/sync/driver/sync_api_component_factory_mock.h" +#include "components/sync_preferences/testing_pref_service_syncable.h" #include "components/sync_sessions/fake_sync_sessions_client.h" -#include "components/syncable_prefs/testing_pref_service_syncable.h" namespace base { class Time; @@ -137,7 +137,7 @@ class ProfileSyncServiceBundle { return url_request_context_.get(); } - syncable_prefs::TestingPrefServiceSyncable* pref_service() { + sync_preferences::TestingPrefServiceSyncable* pref_service() { return &pref_service_; } @@ -169,7 +169,7 @@ class ProfileSyncServiceBundle { private: scoped_refptr<base::SingleThreadTaskRunner> db_thread_; base::SequencedWorkerPoolOwner worker_pool_owner_; - syncable_prefs::TestingPrefServiceSyncable pref_service_; + sync_preferences::TestingPrefServiceSyncable pref_service_; TestSigninClient signin_client_; AccountTrackerService account_tracker_; FakeSigninManagerType signin_manager_; diff --git a/chromium/components/browser_sync/signin_confirmation_helper.cc b/chromium/components/browser_sync/signin_confirmation_helper.cc index 0a59831753c..1300ae0384b 100644 --- a/chromium/components/browser_sync/signin_confirmation_helper.cc +++ b/chromium/components/browser_sync/signin_confirmation_helper.cc @@ -6,6 +6,7 @@ #include <memory> +#include "base/single_thread_task_runner.h" #include "base/strings/string16.h" #include "base/threading/thread_task_runner_handle.h" #include "components/history/core/browser/history_backend.h" diff --git a/chromium/components/browser_sync/signin_confirmation_helper.h b/chromium/components/browser_sync/signin_confirmation_helper.h index 27bd62ef1bf..c006653df91 100644 --- a/chromium/components/browser_sync/signin_confirmation_helper.h +++ b/chromium/components/browser_sync/signin_confirmation_helper.h @@ -11,6 +11,10 @@ #include "base/memory/ref_counted.h" #include "base/task/cancelable_task_tracker.h" +namespace base { +class SingleThreadTaskRunner; +} + namespace history { class HistoryService; class QueryResults; diff --git a/chromium/components/browser_sync/test_http_bridge_factory.h b/chromium/components/browser_sync/test_http_bridge_factory.h index e2c229a3bda..e786f6a58a0 100644 --- a/chromium/components/browser_sync/test_http_bridge_factory.h +++ b/chromium/components/browser_sync/test_http_bridge_factory.h @@ -8,8 +8,8 @@ #include <string> #include "base/compiler_specific.h" -#include "components/sync/core/http_post_provider_factory.h" -#include "components/sync/core/http_post_provider_interface.h" +#include "components/sync/engine/net/http_post_provider_factory.h" +#include "components/sync/engine/net/http_post_provider_interface.h" namespace browser_sync { diff --git a/chromium/components/browser_sync/test_profile_sync_service.h b/chromium/components/browser_sync/test_profile_sync_service.h index c1f8dc27708..59a5ca989ca 100644 --- a/chromium/components/browser_sync/test_profile_sync_service.h +++ b/chromium/components/browser_sync/test_profile_sync_service.h @@ -38,7 +38,7 @@ class TestProfileSyncService : public ProfileSyncService { syncer::SyncPrefs* sync_prefs() { return &sync_prefs_; } protected: - // Return NULL handle to use in backend initialization to avoid receiving + // Return null handle to use in backend initialization to avoid receiving // js messages on UI loop when it's being destroyed, which are not deleted // and cause memory leak in test. syncer::WeakHandle<syncer::JsEventHandler> GetJsEventHandler() override; |