Sync ModelTypeController: Rename delegate_on_disk/delegate_in_memory
These have evolved to mean something different, so those names weren't
appropriate anymore. They're now called delegate_for_full_sync_mode/
delegate_for_transport_mode.
Similarly, the StorageOption enum is renamed to SyncMode and its
entries from STORAGE_ON_DISK/STORAGE_IN_MEMORY to kFull/kTransportOnly.
TBRing trivial changes (renaming some parameters) in
autofill_wallet_model_type_controller.h/cc
[email protected]
Bug: 999980
Change-Id: I21ecfb6620ac42d323b91fc284e0593d19ff4379
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795605
Commit-Queue: Marc Treib <[email protected]>
Reviewed-by: Mohamed Amir Yosef <[email protected]>
Reviewed-by: Mikel Astiz <[email protected]>
Cr-Commit-Position: refs/heads/master@{#697552}
diff --git a/components/sync/driver/async_directory_type_controller.cc b/components/sync/driver/async_directory_type_controller.cc
index b9fe01617..626458f8 100644
--- a/components/sync/driver/async_directory_type_controller.cc
+++ b/components/sync/driver/async_directory_type_controller.cc
@@ -50,7 +50,7 @@
const ConfigureContext& configure_context,
const ModelLoadCallback& model_load_callback) {
DCHECK(CalledOnValidThread());
- DCHECK_EQ(configure_context.storage_option, STORAGE_ON_DISK)
+ DCHECK_EQ(configure_context.sync_mode, SyncMode::kFull)
<< " for type " << ModelTypeToString(type());
model_load_callback_ = model_load_callback;
diff --git a/components/sync/driver/configure_context.h b/components/sync/driver/configure_context.h
index b144a526..ffd9315 100644
--- a/components/sync/driver/configure_context.h
+++ b/components/sync/driver/configure_context.h
@@ -7,7 +7,7 @@
#include <string>
-#include "components/sync/base/storage_option.h"
+#include "components/sync/base/sync_mode.h"
#include "components/sync/engine/configure_reason.h"
#include "google_apis/gaia/core_account_id.h"
@@ -22,7 +22,7 @@
struct ConfigureContext {
CoreAccountId authenticated_account_id;
std::string cache_guid;
- StorageOption storage_option = STORAGE_ON_DISK;
+ SyncMode sync_mode = SyncMode::kFull;
ConfigureReason reason = CONFIGURE_REASON_UNKNOWN;
base::Time configuration_start_time;
// TODO(mastiz): Consider adding |requested_types| here, but currently there
diff --git a/components/sync/driver/data_type_manager_impl.cc b/components/sync/driver/data_type_manager_impl.cc
index 1fee0960..1e15945f 100644
--- a/components/sync/driver/data_type_manager_impl.cc
+++ b/components/sync/driver/data_type_manager_impl.cc
@@ -623,11 +623,11 @@
// response will be sent.
ModelTypeSet types_to_purge;
- // If we're using in-memory storage, don't clear any old data. The reason is
+ // If we're using transport-only mode, don't clear any old data. The reason is
// that if a user temporarily disables Sync, we don't want to wipe (and later
// redownload) all their data, just because Sync restarted in transport-only
// mode.
- if (last_requested_context_.storage_option == STORAGE_ON_DISK) {
+ if (last_requested_context_.sync_mode == SyncMode::kFull) {
types_to_purge = Difference(ModelTypeSet::All(), downloaded_types_);
// Include clean_types in types_to_purge, they are part of
// |downloaded_types_|, but still need to be cleared.
@@ -663,7 +663,7 @@
base::Bind(&DataTypeManagerImpl::DownloadReady,
weak_ptr_factory_.GetWeakPtr(), download_types_queue_.front());
params->is_sync_feature_enabled =
- last_requested_context_.storage_option == STORAGE_ON_DISK;
+ last_requested_context_.sync_mode == SyncMode::kFull;
DCHECK(Intersection(active_types, types_to_purge).Empty());
DCHECK(Intersection(active_types, fatal_types).Empty());
diff --git a/components/sync/driver/data_type_manager_impl_unittest.cc b/components/sync/driver/data_type_manager_impl_unittest.cc
index 9f521fec..9985f112 100644
--- a/components/sync/driver/data_type_manager_impl_unittest.cc
+++ b/components/sync/driver/data_type_manager_impl_unittest.cc
@@ -11,7 +11,7 @@
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "components/sync/base/model_type.h"
-#include "components/sync/base/storage_option.h"
+#include "components/sync/base/sync_mode.h"
#include "components/sync/driver/configure_context.h"
#include "components/sync/driver/data_type_encryption_handler.h"
#include "components/sync/driver/data_type_manager_observer.h"
@@ -34,12 +34,11 @@
return Union(ControlTypes(), types);
}
-ConfigureContext BuildConfigureContext(
- ConfigureReason reason,
- StorageOption storage_option = STORAGE_ON_DISK) {
+ConfigureContext BuildConfigureContext(ConfigureReason reason,
+ SyncMode sync_mode = SyncMode::kFull) {
ConfigureContext context;
context.reason = reason;
- context.storage_option = storage_option;
+ context.sync_mode = sync_mode;
return context;
}
@@ -276,10 +275,9 @@
}
void Configure(ModelTypeSet desired_types,
- StorageOption storage_option,
+ SyncMode sync_mode,
ConfigureReason reason = CONFIGURE_REASON_RECONFIGURATION) {
- dtm_->Configure(desired_types,
- BuildConfigureContext(reason, storage_option));
+ dtm_->Configure(desired_types, BuildConfigureContext(reason, sync_mode));
}
// Finish downloading for the given DTM. Should be done only after
@@ -1889,7 +1887,7 @@
SetConfigureStartExpectation();
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable());
- Configure(ModelTypeSet(BOOKMARKS, AUTOFILL_WALLET_DATA), STORAGE_ON_DISK);
+ Configure(ModelTypeSet(BOOKMARKS, AUTOFILL_WALLET_DATA), SyncMode::kFull);
ASSERT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
FinishDownload(ModelTypeSet(), ModelTypeSet());
@@ -1910,7 +1908,7 @@
// Now we restart with a reduced set of data types.
SetConfigureStartExpectation();
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable());
- Configure(ModelTypeSet(AUTOFILL_WALLET_DATA), STORAGE_ON_DISK);
+ Configure(ModelTypeSet(AUTOFILL_WALLET_DATA), SyncMode::kFull);
ASSERT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
FinishDownload(ModelTypeSet(), ModelTypeSet());
@@ -1937,7 +1935,7 @@
SetConfigureStartExpectation();
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable());
- Configure(ModelTypeSet(BOOKMARKS, AUTOFILL_WALLET_DATA), STORAGE_ON_DISK);
+ Configure(ModelTypeSet(BOOKMARKS, AUTOFILL_WALLET_DATA), SyncMode::kFull);
ASSERT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
FinishDownload(ModelTypeSet(), ModelTypeSet());
@@ -1958,7 +1956,7 @@
// Now we restart in ephemeral mode, with a reduced set of data types.
SetConfigureStartExpectation();
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable());
- Configure(ModelTypeSet(AUTOFILL_WALLET_DATA), STORAGE_IN_MEMORY);
+ Configure(ModelTypeSet(AUTOFILL_WALLET_DATA), SyncMode::kTransportOnly);
ASSERT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
FinishDownload(ModelTypeSet(), ModelTypeSet());
@@ -1982,7 +1980,7 @@
SetConfigureStartExpectation();
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable());
- Configure(ModelTypeSet(BOOKMARKS, AUTOFILL_WALLET_DATA), STORAGE_ON_DISK);
+ Configure(ModelTypeSet(BOOKMARKS, AUTOFILL_WALLET_DATA), SyncMode::kFull);
ASSERT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
FinishDownload(ModelTypeSet(), ModelTypeSet());
@@ -1997,7 +1995,7 @@
// Now we reconfigure with a reduced set of data types.
SetConfigureStartExpectation();
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable());
- Configure(ModelTypeSet(AUTOFILL_WALLET_DATA), STORAGE_ON_DISK);
+ Configure(ModelTypeSet(AUTOFILL_WALLET_DATA), SyncMode::kFull);
ASSERT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
FinishDownload(ModelTypeSet(), ModelTypeSet());
@@ -2020,7 +2018,7 @@
SetConfigureStartExpectation();
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable());
- Configure(ModelTypeSet(BOOKMARKS, AUTOFILL_WALLET_DATA), STORAGE_ON_DISK);
+ Configure(ModelTypeSet(BOOKMARKS, AUTOFILL_WALLET_DATA), SyncMode::kFull);
ASSERT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
FinishDownload(ModelTypeSet(), ModelTypeSet());
@@ -2035,7 +2033,7 @@
// Now we reconfigure into ephemeral mode, with a reduced set of data types.
SetConfigureStartExpectation();
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable());
- Configure(ModelTypeSet(AUTOFILL_WALLET_DATA), STORAGE_IN_MEMORY);
+ Configure(ModelTypeSet(AUTOFILL_WALLET_DATA), SyncMode::kTransportOnly);
ASSERT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
FinishDownload(ModelTypeSet(), ModelTypeSet());
@@ -2060,7 +2058,7 @@
SetConfigureStartExpectation();
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable());
- Configure(ModelTypeSet(BOOKMARKS), STORAGE_ON_DISK,
+ Configure(ModelTypeSet(BOOKMARKS), SyncMode::kFull,
CONFIGURE_REASON_NEW_CLIENT);
FinishDownload(ModelTypeSet(), ModelTypeSet());
@@ -2078,7 +2076,7 @@
SetConfigureStartExpectation();
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable());
- Configure(ModelTypeSet(BOOKMARKS), STORAGE_ON_DISK,
+ Configure(ModelTypeSet(BOOKMARKS), SyncMode::kFull,
CONFIGURE_REASON_RECONFIGURATION);
FinishDownload(ModelTypeSet(), ModelTypeSet());
diff --git a/components/sync/driver/frontend_data_type_controller.cc b/components/sync/driver/frontend_data_type_controller.cc
index 55a5c9b5..5ab8d202 100644
--- a/components/sync/driver/frontend_data_type_controller.cc
+++ b/components/sync/driver/frontend_data_type_controller.cc
@@ -31,7 +31,7 @@
const ConfigureContext& configure_context,
const ModelLoadCallback& model_load_callback) {
DCHECK(CalledOnValidThread());
- DCHECK_EQ(configure_context.storage_option, STORAGE_ON_DISK);
+ DCHECK_EQ(configure_context.sync_mode, SyncMode::kFull);
model_load_callback_ = model_load_callback;
diff --git a/components/sync/driver/glue/sync_engine_backend.cc b/components/sync/driver/glue/sync_engine_backend.cc
index 2469a38..4507524 100644
--- a/components/sync/driver/glue/sync_engine_backend.cc
+++ b/components/sync/driver/glue/sync_engine_backend.cc
@@ -696,8 +696,8 @@
configure_context.authenticated_account_id = authenticated_account_id_;
configure_context.cache_guid = sync_manager_->cache_guid();
// TODO(crbug.com/922900): investigate whether we want to use
- // STORAGE_IN_MEMORY in Butter mode.
- configure_context.storage_option = STORAGE_ON_DISK;
+ // kTransportOnly in Butter mode.
+ configure_context.sync_mode = SyncMode::kFull;
configure_context.configuration_start_time = base::Time::Now();
nigori_controller_->LoadModels(configure_context, base::DoNothing());
DCHECK_EQ(nigori_controller_->state(), DataTypeController::MODEL_LOADED);
diff --git a/components/sync/driver/model_association_manager.cc b/components/sync/driver/model_association_manager.cc
index 2ad4465..895f4762 100644
--- a/components/sync/driver/model_association_manager.cc
+++ b/components/sync/driver/model_association_manager.cc
@@ -114,8 +114,7 @@
// |desired_types| must be a subset of |preferred_types|.
DCHECK(preferred_types.HasAll(desired_types));
- bool storage_option_changed =
- configure_context_.storage_option != context.storage_option;
+ bool sync_mode_changed = configure_context_.sync_mode != context.sync_mode;
configure_context_ = context;
@@ -145,8 +144,7 @@
// We generally stop all data types which are not desired. When the storage
// option changes, we need to restart all data types so that they can
// re-wire to the correct storage.
- bool should_stop =
- !desired_types_.Has(dtc->type()) || storage_option_changed;
+ bool should_stop = !desired_types_.Has(dtc->type()) || sync_mode_changed;
// If the datatype is already STOPPING, we also wait for it to stop, to make
// sure it's ready to start again (if appropriate).
if ((should_stop && dtc->state() != DataTypeController::NOT_RUNNING) ||
@@ -155,12 +153,12 @@
// means we'll clear it.
ShutdownReason reason =
preferred_types.Has(dtc->type()) ? STOP_SYNC : DISABLE_SYNC;
- // If we're switchingt o in-memory storage, don't clear any old data. The
- // reason is that if a user temporarily disables Sync, we don't want to
- // wipe (and later redownload) all their data, just because Sync restarted
- // in transport-only mode.
- if (storage_option_changed &&
- configure_context_.storage_option == STORAGE_IN_MEMORY) {
+ // If we're switching to transport-only mode, don't clear any old data.
+ // The reason is that if a user temporarily disables Sync, we don't want
+ // to wipe (and later redownload) all their data, just because Sync
+ // restarted in transport-only mode.
+ if (sync_mode_changed &&
+ configure_context_.sync_mode == SyncMode::kTransportOnly) {
reason = STOP_SYNC;
}
types_to_stop[dtc] = reason;
diff --git a/components/sync/driver/model_association_manager_unittest.cc b/components/sync/driver/model_association_manager_unittest.cc
index f845304..56e9821 100644
--- a/components/sync/driver/model_association_manager_unittest.cc
+++ b/components/sync/driver/model_association_manager_unittest.cc
@@ -733,7 +733,7 @@
ModelTypeSet desired_types = preferred_types;
ConfigureContext configure_context;
- configure_context.storage_option = STORAGE_ON_DISK;
+ configure_context.sync_mode = SyncMode::kFull;
EXPECT_CALL(delegate_, OnSingleDataTypeWillStart(BOOKMARKS));
EXPECT_CALL(delegate_, OnSingleDataTypeWillStart(APPS));
@@ -757,7 +757,7 @@
testing::Mock::VerifyAndClearExpectations(&delegate_);
// Switch to in-memory storage.
- configure_context.storage_option = STORAGE_IN_MEMORY;
+ configure_context.sync_mode = SyncMode::kTransportOnly;
desired_types.Remove(APPS);
preferred_types.Remove(APPS);
@@ -786,7 +786,7 @@
}
TEST_F(SyncModelAssociationManagerTest,
- SwitchFromInMemoryToOnDiskRestartsTypes) {
+ SwitchFromTransportOnlyToFullSyncRestartsTypes) {
// Associate model with two data types.
controllers_[BOOKMARKS] = std::make_unique<FakeDataTypeController>(BOOKMARKS);
controllers_[APPS] = std::make_unique<FakeDataTypeController>(APPS);
@@ -795,7 +795,7 @@
ModelTypeSet desired_types = preferred_types;
ConfigureContext configure_context;
- configure_context.storage_option = STORAGE_IN_MEMORY;
+ configure_context.sync_mode = SyncMode::kTransportOnly;
EXPECT_CALL(delegate_, OnSingleDataTypeWillStart(BOOKMARKS));
EXPECT_CALL(delegate_, OnSingleDataTypeWillStart(APPS));
@@ -818,8 +818,8 @@
DataTypeController::RUNNING);
testing::Mock::VerifyAndClearExpectations(&delegate_);
- // Switch to on-disk storage.
- configure_context.storage_option = STORAGE_ON_DISK;
+ // Switch to full-sync mode.
+ configure_context.sync_mode = SyncMode::kFull;
desired_types.Remove(APPS);
preferred_types.Remove(APPS);
diff --git a/components/sync/driver/model_type_controller.cc b/components/sync/driver/model_type_controller.cc
index 04caaec..1fbf4f15 100644
--- a/components/sync/driver/model_type_controller.cc
+++ b/components/sync/driver/model_type_controller.cc
@@ -45,17 +45,19 @@
ModelTypeController::ModelTypeController(
ModelType type,
- std::unique_ptr<ModelTypeControllerDelegate> delegate_on_disk)
+ std::unique_ptr<ModelTypeControllerDelegate> delegate_for_full_sync_mode)
: DataTypeController(type) {
- delegate_map_.emplace(STORAGE_ON_DISK, std::move(delegate_on_disk));
+ delegate_map_.emplace(SyncMode::kFull,
+ std::move(delegate_for_full_sync_mode));
}
ModelTypeController::ModelTypeController(
ModelType type,
- std::unique_ptr<ModelTypeControllerDelegate> delegate_on_disk,
- std::unique_ptr<ModelTypeControllerDelegate> delegate_in_memory)
- : ModelTypeController(type, std::move(delegate_on_disk)) {
- delegate_map_.emplace(STORAGE_IN_MEMORY, std::move(delegate_in_memory));
+ std::unique_ptr<ModelTypeControllerDelegate> delegate_for_full_sync_mode,
+ std::unique_ptr<ModelTypeControllerDelegate> delegate_for_transport_mode)
+ : ModelTypeController(type, std::move(delegate_for_full_sync_mode)) {
+ delegate_map_.emplace(SyncMode::kTransportOnly,
+ std::move(delegate_for_transport_mode));
}
ModelTypeController::~ModelTypeController() {}
@@ -84,7 +86,7 @@
DCHECK(model_load_callback);
DCHECK_EQ(NOT_RUNNING, state_);
- auto it = delegate_map_.find(configure_context.storage_option);
+ auto it = delegate_map_.find(configure_context.sync_mode);
DCHECK(it != delegate_map_.end());
delegate_ = it->second.get();
DCHECK(delegate_);
@@ -100,7 +102,7 @@
base::AsWeakPtr(this), SyncError::DATATYPE_ERROR));
request.authenticated_account_id = configure_context.authenticated_account_id;
request.cache_guid = configure_context.cache_guid;
- request.storage_option = configure_context.storage_option;
+ request.sync_mode = configure_context.sync_mode;
request.configuration_start_time = configure_context.configuration_start_time;
// Note that |request.authenticated_account_id| may be empty for local sync.
diff --git a/components/sync/driver/model_type_controller.h b/components/sync/driver/model_type_controller.h
index 8787373..4f29a348 100644
--- a/components/sync/driver/model_type_controller.h
+++ b/components/sync/driver/model_type_controller.h
@@ -14,7 +14,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "components/sync/base/model_type.h"
-#include "components/sync/base/storage_option.h"
+#include "components/sync/base/sync_mode.h"
#include "components/sync/driver/configure_context.h"
#include "components/sync/driver/data_type_controller.h"
#include "components/sync/model/model_error.h"
@@ -30,12 +30,12 @@
public:
ModelTypeController(
ModelType type,
- std::unique_ptr<ModelTypeControllerDelegate> delegate_on_disk);
+ std::unique_ptr<ModelTypeControllerDelegate> delegate_for_full_sync_mode);
// For datatypes that have support for STORAGE_IN_MEMORY.
ModelTypeController(
ModelType type,
- std::unique_ptr<ModelTypeControllerDelegate> delegate_on_disk,
- std::unique_ptr<ModelTypeControllerDelegate> delegate_in_memory);
+ std::unique_ptr<ModelTypeControllerDelegate> delegate_for_full_sync_mode,
+ std::unique_ptr<ModelTypeControllerDelegate> delegate_for_transport_mode);
~ModelTypeController() override;
// Steals the activation response, only used for Nigori.
@@ -71,7 +71,7 @@
std::unique_ptr<DataTypeActivationResponse> activation_response);
void TriggerCompletionCallbacks(const SyncError& error);
- base::flat_map<StorageOption, std::unique_ptr<ModelTypeControllerDelegate>>
+ base::flat_map<SyncMode, std::unique_ptr<ModelTypeControllerDelegate>>
delegate_map_;
// State of this datatype controller.
diff --git a/components/sync/driver/model_type_controller_unittest.cc b/components/sync/driver/model_type_controller_unittest.cc
index 53c6f96..d4c99d69 100644
--- a/components/sync/driver/model_type_controller_unittest.cc
+++ b/components/sync/driver/model_type_controller_unittest.cc
@@ -132,8 +132,9 @@
class TestModelTypeController : public ModelTypeController {
public:
explicit TestModelTypeController(
- std::unique_ptr<ModelTypeControllerDelegate> delegate_on_disk)
- : ModelTypeController(kTestModelType, std::move(delegate_on_disk)) {}
+ std::unique_ptr<ModelTypeControllerDelegate> delegate_for_full_sync_mode)
+ : ModelTypeController(kTestModelType,
+ std::move(delegate_for_full_sync_mode)) {}
~TestModelTypeController() override {}
using ModelTypeController::ReportModelError;
@@ -555,19 +556,19 @@
EXPECT_EQ(DataTypeController::FAILED, controller()->state());
}
-// Tests that StorageOption is honored when the controller has been constructed
+// Tests that SyncMode is honored when the controller has been constructed
// with two delegates.
-TEST(ModelTypeControllerWithMultiDelegateTest, ToggleStorageOption) {
+TEST(ModelTypeControllerWithMultiDelegateTest, ToggleSyncMode) {
base::test::SingleThreadTaskEnvironment task_environment;
- NiceMock<MockDelegate> delegate_on_disk;
- NiceMock<MockDelegate> delegate_in_memory;
+ NiceMock<MockDelegate> delegate_for_full_sync_mode;
+ NiceMock<MockDelegate> delegate_for_transport_mode;
ModelTypeController controller(
kTestModelType,
std::make_unique<ForwardingModelTypeControllerDelegate>(
- &delegate_on_disk),
+ &delegate_for_full_sync_mode),
std::make_unique<ForwardingModelTypeControllerDelegate>(
- &delegate_in_memory));
+ &delegate_for_transport_mode));
ConfigureContext context;
context.authenticated_account_id = kAccountId;
@@ -575,14 +576,14 @@
ModelTypeControllerDelegate::StartCallback start_callback;
- // Start sync with STORAGE_IN_MEMORY.
- EXPECT_CALL(delegate_on_disk, OnSyncStarting(_, _)).Times(0);
- EXPECT_CALL(delegate_in_memory, OnSyncStarting(_, _))
+ // Start sync with SyncMode::kTransportOnly.
+ EXPECT_CALL(delegate_for_full_sync_mode, OnSyncStarting(_, _)).Times(0);
+ EXPECT_CALL(delegate_for_transport_mode, OnSyncStarting(_, _))
.WillOnce([&](const DataTypeActivationRequest& request,
ModelTypeControllerDelegate::StartCallback callback) {
start_callback = std::move(callback);
});
- context.storage_option = STORAGE_IN_MEMORY;
+ context.sync_mode = SyncMode::kTransportOnly;
controller.LoadModels(context, base::DoNothing());
ASSERT_EQ(DataTypeController::MODEL_STARTING, controller.state());
@@ -593,19 +594,19 @@
ASSERT_EQ(DataTypeController::MODEL_LOADED, controller.state());
// Stop sync.
- EXPECT_CALL(delegate_on_disk, OnSyncStopping(_)).Times(0);
- EXPECT_CALL(delegate_in_memory, OnSyncStopping(_));
+ EXPECT_CALL(delegate_for_full_sync_mode, OnSyncStopping(_)).Times(0);
+ EXPECT_CALL(delegate_for_transport_mode, OnSyncStopping(_));
controller.Stop(DISABLE_SYNC, base::DoNothing());
ASSERT_EQ(DataTypeController::NOT_RUNNING, controller.state());
- // Start sync with STORAGE_ON_DISK.
- EXPECT_CALL(delegate_in_memory, OnSyncStarting(_, _)).Times(0);
- EXPECT_CALL(delegate_on_disk, OnSyncStarting(_, _))
+ // Start sync with SyncMode::kFull.
+ EXPECT_CALL(delegate_for_transport_mode, OnSyncStarting(_, _)).Times(0);
+ EXPECT_CALL(delegate_for_full_sync_mode, OnSyncStarting(_, _))
.WillOnce([&](const DataTypeActivationRequest& request,
ModelTypeControllerDelegate::StartCallback callback) {
start_callback = std::move(callback);
});
- context.storage_option = STORAGE_ON_DISK;
+ context.sync_mode = SyncMode::kFull;
controller.LoadModels(context, base::DoNothing());
ASSERT_EQ(DataTypeController::MODEL_STARTING, controller.state());
@@ -616,8 +617,8 @@
ASSERT_EQ(DataTypeController::MODEL_LOADED, controller.state());
// Stop sync.
- EXPECT_CALL(delegate_in_memory, OnSyncStopping(_)).Times(0);
- EXPECT_CALL(delegate_on_disk, OnSyncStopping(_));
+ EXPECT_CALL(delegate_for_transport_mode, OnSyncStopping(_)).Times(0);
+ EXPECT_CALL(delegate_for_full_sync_mode, OnSyncStopping(_));
controller.Stop(DISABLE_SYNC, base::DoNothing());
ASSERT_EQ(DataTypeController::NOT_RUNNING, controller.state());
}
diff --git a/components/sync/driver/profile_sync_service.cc b/components/sync/driver/profile_sync_service.cc
index 558194c..61b71b8 100644
--- a/components/sync/driver/profile_sync_service.cc
+++ b/components/sync/driver/profile_sync_service.cc
@@ -1230,7 +1230,7 @@
configure_context.authenticated_account_id =
GetAuthenticatedAccountInfo().account_id;
configure_context.cache_guid = sync_prefs_.GetCacheGuid();
- configure_context.storage_option = STORAGE_ON_DISK;
+ configure_context.sync_mode = SyncMode::kFull;
configure_context.reason = reason;
configure_context.configuration_start_time = base::Time::Now();
@@ -1283,7 +1283,7 @@
}
types = Intersection(types, allowed_types);
- configure_context.storage_option = STORAGE_IN_MEMORY;
+ configure_context.sync_mode = SyncMode::kTransportOnly;
}
data_type_manager_->Configure(types, configure_context);