summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-22 17:39:04 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-22 17:39:04 +0000
commitd2c04f2ddc3f9b4d59e1d9e4cdb5c7ba5d4fa26c (patch)
tree92bc2afcef01445a2bdf6306e0726f0847be1950
parente7a0909b42856893f4c54fb8460901fa1fcb88ce (diff)
downloadchromium_src-d2c04f2ddc3f9b4d59e1d9e4cdb5c7ba5d4fa26c.zip
chromium_src-d2c04f2ddc3f9b4d59e1d9e4cdb5c7ba5d4fa26c.tar.gz
chromium_src-d2c04f2ddc3f9b4d59e1d9e4cdb5c7ba5d4fa26c.tar.bz2
sync: fetch encryption information before OnBackendInitialized
BUG=none TEST= Review URL: http://codereview.chromium.org/7184033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90050 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sync/engine/configure_reason.h6
-rw-r--r--chrome/browser/sync/engine/sync_scheduler.cc2
-rw-r--r--chrome/browser/sync/engine/syncapi.cc4
-rw-r--r--chrome/browser/sync/engine/syncapi.h3
-rw-r--r--chrome/browser/sync/glue/sync_backend_host.cc103
-rw-r--r--chrome/browser/sync/glue/sync_backend_host.h25
-rw-r--r--chrome/browser/sync/glue/sync_backend_host_unittest.cc3
-rw-r--r--chrome/browser/sync/profile_sync_service.cc13
-rw-r--r--chrome/browser/sync/sync_setup_flow.cc4
-rw-r--r--chrome/browser/sync/sync_setup_wizard_unittest.cc5
-rw-r--r--chrome/browser/sync/test_profile_sync_service.cc9
11 files changed, 115 insertions, 62 deletions
diff --git a/chrome/browser/sync/engine/configure_reason.h b/chrome/browser/sync/engine/configure_reason.h
index d5173cf..5deb402 100644
--- a/chrome/browser/sync/engine/configure_reason.h
+++ b/chrome/browser/sync/engine/configure_reason.h
@@ -21,7 +21,11 @@ enum ConfigureReason {
CONFIGURE_REASON_RECONFIGURATION,
// The client is configuring because the client is being asked to migrate.
- CONFIGURE_REASON_MIGRATION
+ CONFIGURE_REASON_MIGRATION,
+
+ // Setting up sync performs an initial config to download NIGORI data, and
+ // also a config to download initial data once the user selects types.
+ CONFIGURE_REASON_NEW_CLIENT,
};
} // namespace sync_api
diff --git a/chrome/browser/sync/engine/sync_scheduler.cc b/chrome/browser/sync/engine/sync_scheduler.cc
index 10a2d79..f87d83a 100644
--- a/chrome/browser/sync/engine/sync_scheduler.cc
+++ b/chrome/browser/sync/engine/sync_scheduler.cc
@@ -109,6 +109,8 @@ GetUpdatesCallerInfo::GetUpdatesSource GetSourceFromReason(
return GetUpdatesCallerInfo::RECONFIGURATION;
case sync_api::CONFIGURE_REASON_MIGRATION:
return GetUpdatesCallerInfo::MIGRATION;
+ case sync_api::CONFIGURE_REASON_NEW_CLIENT:
+ return GetUpdatesCallerInfo::NEW_CLIENT;
default:
NOTREACHED();
}
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc
index c5864aa..d408169 100644
--- a/chrome/browser/sync/engine/syncapi.cc
+++ b/chrome/browser/sync/engine/syncapi.cc
@@ -1411,9 +1411,11 @@ class SyncManager::SyncInternal
syncable::ModelType model_type = b.GetModelType();
// Suppress updates to items that aren't tracked by any browser model.
if (model_type == syncable::UNSPECIFIED ||
- model_type == syncable::TOP_LEVEL_FOLDER) {
+ model_type == syncable::TOP_LEVEL_FOLDER ||
+ !a.ref(syncable::UNIQUE_SERVER_TAG).empty()) {
return false;
}
+
if (a.ref(syncable::NON_UNIQUE_NAME) != b.Get(syncable::NON_UNIQUE_NAME))
return true;
if (a.ref(syncable::IS_DIR) != b.Get(syncable::IS_DIR))
diff --git a/chrome/browser/sync/engine/syncapi.h b/chrome/browser/sync/engine/syncapi.h
index 94d7e36..9286c6a 100644
--- a/chrome/browser/sync/engine/syncapi.h
+++ b/chrome/browser/sync/engine/syncapi.h
@@ -891,9 +891,6 @@ class SyncManager {
syncable::AutofillMigrationDebugInfo::PropertyToSet property_to_set,
const syncable::AutofillMigrationDebugInfo& info);
- // Migrate tokens from user settings DB to the token service.
- void MigrateTokens();
-
// Update tokens that we're using in Sync. Email must stay the same.
void UpdateCredentials(const SyncCredentials& credentials);
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index 837077a..30e49cd 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -62,23 +62,23 @@ using sync_api::SyncCredentials;
SyncBackendHost::SyncBackendHost(Profile* profile)
: core_(new Core(profile->GetDebugName(),
ALLOW_THIS_IN_INITIALIZER_LIST(this))),
+ initialization_state_(NOT_INITIALIZED),
sync_thread_("Chrome_SyncThread"),
frontend_loop_(MessageLoop::current()),
profile_(profile),
frontend_(NULL),
sync_data_folder_path_(
profile_->GetPath().Append(kSyncDataFolderName)),
- last_auth_error_(AuthError::None()),
- sync_manager_initialized_(false) {
+ last_auth_error_(AuthError::None()) {
}
SyncBackendHost::SyncBackendHost()
- : sync_thread_("Chrome_SyncThread"),
+ : initialization_state_(NOT_INITIALIZED),
+ sync_thread_("Chrome_SyncThread"),
frontend_loop_(MessageLoop::current()),
profile_(NULL),
frontend_(NULL),
- last_auth_error_(AuthError::None()),
- sync_manager_initialized_(false) {
+ last_auth_error_(AuthError::None()) {
}
SyncBackendHost::~SyncBackendHost() {
@@ -99,12 +99,6 @@ void SyncBackendHost::Initialize(
frontend_ = frontend;
DCHECK(frontend);
- // Create a worker for the UI thread and route bookmark changes to it.
- // TODO(tim): Pull this into a method to reuse. For now we don't even
- // need to lock because we init before the syncapi exists and we tear down
- // after the syncapi is destroyed. Make sure to NULL-check workers_ indices
- // when a new type is synced as the worker may already exist and you just
- // need to update routing_info_.
registrar_.workers[GROUP_DB] = new DatabaseModelWorker();
registrar_.workers[GROUP_UI] = new UIModelWorker();
registrar_.workers[GROUP_PASSIVE] = new ModelSafeWorker();
@@ -113,12 +107,15 @@ void SyncBackendHost::Initialize(
// Any datatypes that we want the syncer to pull down must
// be in the routing_info map. We set them to group passive, meaning that
- // updates will be applied, but not dispatched to the UI thread yet.
+ // updates will be applied to sync, but not dispatched to the native models.
for (syncable::ModelTypeSet::const_iterator it = types.begin();
it != types.end(); ++it) {
registrar_.routing_info[(*it)] = GROUP_PASSIVE;
}
+ if (profile_->GetPrefs()->GetBoolean(prefs::kSyncHasSetupCompleted))
+ registrar_.routing_info[syncable::NIGORI] = GROUP_PASSIVE;
+
PasswordStore* password_store =
profile_->GetPasswordStore(Profile::IMPLICIT_ACCESS);
if (password_store) {
@@ -130,9 +127,6 @@ void SyncBackendHost::Initialize(
registrar_.routing_info.erase(syncable::PASSWORDS);
}
- // Nigori is populated by default now.
- registrar_.routing_info[syncable::NIGORI] = GROUP_PASSIVE;
-
// TODO(akalin): Create SyncNotifier here and pass it in as part of
// DoInitializeOptions.
core_->CreateSyncNotifier(baseline_context_getter);
@@ -167,18 +161,18 @@ bool SyncBackendHost::IsNigoriEnabled() const {
}
bool SyncBackendHost::IsUsingExplicitPassphrase() {
- return IsNigoriEnabled() && sync_manager_initialized_ &&
+ return IsNigoriEnabled() && initialized() &&
core_->sync_manager()->InitialSyncEndedForAllEnabledTypes() &&
core_->sync_manager()->IsUsingExplicitPassphrase();
}
bool SyncBackendHost::IsCryptographerReady(
const sync_api::BaseTransaction* trans) const {
- return sync_manager_initialized_ && trans->GetCryptographer()->is_ready();
+ return initialized() && trans->GetCryptographer()->is_ready();
}
JsBackend* SyncBackendHost::GetJsBackend() {
- if (sync_manager_initialized_) {
+ if (initialized()) {
return core_.get();
} else {
NOTREACHED();
@@ -238,7 +232,7 @@ void SyncBackendHost::Shutdown(bool sync_disabled) {
// - UI Thread (stops some time after we return from this call).
if (sync_thread_.IsRunning()) { // Not running in tests.
// TODO(akalin): Remove the need for this.
- if (sync_manager_initialized_) {
+ if (initialization_state_ > NOT_INITIALIZED) {
core_->sync_manager()->RequestEarlyExit();
}
sync_thread_.message_loop()->PostTask(FROM_HERE,
@@ -287,26 +281,26 @@ void SyncBackendHost::Shutdown(bool sync_disabled) {
syncable::AutofillMigrationState
SyncBackendHost::GetAutofillMigrationState() {
- DCHECK(sync_manager_initialized_);
+ DCHECK_GT(initialization_state_, NOT_INITIALIZED);
return core_->sync_manager()->GetAutofillMigrationState();
}
void SyncBackendHost::SetAutofillMigrationState(
syncable::AutofillMigrationState state) {
- DCHECK(sync_manager_initialized_);
+ DCHECK_GT(initialization_state_, NOT_INITIALIZED);
return core_->sync_manager()->SetAutofillMigrationState(state);
}
syncable::AutofillMigrationDebugInfo
SyncBackendHost::GetAutofillMigrationDebugInfo() {
- DCHECK(sync_manager_initialized_);
+ DCHECK_GT(initialization_state_, NOT_INITIALIZED);
return core_->sync_manager()->GetAutofillMigrationDebugInfo();
}
void SyncBackendHost::SetAutofillMigrationDebugInfo(
syncable::AutofillMigrationDebugInfo::PropertyToSet property_to_set,
const syncable::AutofillMigrationDebugInfo& info) {
- DCHECK(sync_manager_initialized_);
+ DCHECK_GT(initialization_state_, NOT_INITIALIZED);
return core_->sync_manager()->SetAutofillMigrationDebugInfo(
property_to_set, info);
}
@@ -381,10 +375,12 @@ SyncBackendHost::PendingConfigureDataTypesState*
}
}
+ // We must handle NIGORI separately as it has no DataTypeController.
if (types.count(syncable::NIGORI) == 0) {
if (nigori_enabled) { // Nigori is currently enabled.
state->deleted_type = true;
routing_info->erase(syncable::NIGORI);
+ // IsNigoriEnabled is now false.
}
} else { // Nigori needs to be enabled.
if (!nigori_enabled) {
@@ -409,7 +405,7 @@ void SyncBackendHost::ConfigureDataTypes(
// Only one configure is allowed at a time.
DCHECK(!pending_config_mode_state_.get());
DCHECK(!pending_download_state_.get());
- DCHECK(sync_manager_initialized_);
+ DCHECK_GT(initialization_state_, NOT_INITIALIZED);
if (types.count(syncable::AUTOFILL_PROFILE) != 0) {
ConfigureAutofillMigration();
@@ -433,7 +429,7 @@ void SyncBackendHost::ConfigureDataTypes(
}
void SyncBackendHost::StartConfiguration(Callback0::Type* callback) {
- // Put syncer in the config mode. DTM will put us in normal mode once it is.
+ // Put syncer in the config mode. DTM will put us in normal mode once it is
// done. This is to ensure we dont do a normal sync when we are doing model
// association.
sync_thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
@@ -513,7 +509,7 @@ void SyncBackendHost::EncryptDataTypes(
}
syncable::ModelTypeSet SyncBackendHost::GetEncryptedDataTypes() const {
- DCHECK(sync_manager_initialized_);
+ DCHECK_GT(initialization_state_, NOT_INITIALIZED);
return core_->sync_manager()->GetEncryptedDataTypes();
}
@@ -658,22 +654,22 @@ SyncBackendHost::Core::DoInitializeOptions::DoInitializeOptions(
SyncBackendHost::Core::DoInitializeOptions::~DoInitializeOptions() {}
sync_api::UserShare* SyncBackendHost::GetUserShare() const {
- DCHECK(sync_manager_initialized_);
+ DCHECK(initialized());
return core_->sync_manager()->GetUserShare();
}
SyncBackendHost::Status SyncBackendHost::GetDetailedStatus() {
- DCHECK(sync_manager_initialized_);
+ DCHECK(initialized());
return core_->sync_manager()->GetDetailedStatus();
}
SyncBackendHost::StatusSummary SyncBackendHost::GetStatusSummary() {
- DCHECK(sync_manager_initialized_);
+ DCHECK(initialized());
return core_->sync_manager()->GetStatusSummary();
}
string16 SyncBackendHost::GetAuthenticatedUsername() const {
- DCHECK(sync_manager_initialized_);
+ DCHECK(initialized());
return UTF8ToUTF16(core_->sync_manager()->GetAuthenticatedUsername());
}
@@ -701,12 +697,12 @@ void SyncBackendHost::GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) {
}
bool SyncBackendHost::HasUnsyncedItems() const {
- DCHECK(sync_manager_initialized_);
+ DCHECK(initialized());
return core_->sync_manager()->HasUnsyncedItems();
}
void SyncBackendHost::LogUnsyncedItems(int level) const {
- DCHECK(sync_manager_initialized_);
+ DCHECK(initialized());
return core_->sync_manager()->LogUnsyncedItems(level);
}
@@ -874,7 +870,8 @@ ChangeProcessor* SyncBackendHost::Core::GetProcessor(
return NULL;
if (!IsCurrentThreadSafeForModel(model_type)) {
- NOTREACHED() << "Changes applied on wrong thread.";
+ NOTREACHED() << "Changes applied on wrong thread. Model: "
+ << syncable::ModelTypeToString(model_type);
return NULL;
}
@@ -946,22 +943,24 @@ void SyncBackendHost::Core::HandleSyncCycleCompletedOnFrontendLoop(
// if this sync cycle has initialized all of the types we've been
// waiting for.
if (host_->pending_download_state_.get()) {
+ scoped_ptr<PendingConfigureDataTypesState> state(
+ host_->pending_download_state_.release());
bool found_all_added = true;
- for (syncable::ModelTypeSet::const_iterator it =
- host_->pending_download_state_->initial_types.begin();
- it != host_->pending_download_state_->initial_types.end();
+ syncable::ModelTypeSet::const_iterator it;
+ for (it = state->initial_types.begin(); it != state->initial_types.end();
++it) {
- if (host_->pending_download_state_->added_types.test(*it))
+ if (state->added_types.test(*it))
found_all_added &= snapshot->initial_sync_ended.test(*it);
}
if (!found_all_added) {
NOTREACHED() << "Update didn't return updates for all types requested.";
} else {
- host_->pending_download_state_->ready_task->Run();
+ state->ready_task->Run();
}
- host_->pending_download_state_.reset();
}
- host_->frontend_->OnSyncCycleCompleted();
+
+ if (host_->initialized())
+ host_->frontend_->OnSyncCycleCompleted();
}
void SyncBackendHost::Core::OnInitializationComplete() {
@@ -989,11 +988,25 @@ void SyncBackendHost::Core::HandleInitializationCompletedOnFrontendLoop() {
void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop() {
if (!frontend_)
return;
- sync_manager_initialized_ = true;
- // Now that the syncapi is initialized, we can update the cryptographer (and
- // can handle any ON_PASSPHRASE_REQUIRED notifications that may arise).
- core_->sync_manager()->RefreshEncryption();
- frontend_->OnBackendInitialized();
+
+ if (profile_->GetPrefs()->GetBoolean(prefs::kSyncHasSetupCompleted) ||
+ initialization_state_ == DOWNLOADING_NIGORI) {
+ // Now that the syncapi is initialized, we can update the cryptographer
+ // and can handle any ON_PASSPHRASE_REQUIRED notifications that may arise.
+ initialization_state_ = INITIALIZED;
+ core_->sync_manager()->RefreshEncryption();
+ frontend_->OnBackendInitialized();
+ return;
+ }
+
+ initialization_state_ = DOWNLOADING_NIGORI;
+ ConfigureDataTypes(
+ DataTypeController::TypeMap(),
+ syncable::ModelTypeSet(),
+ sync_api::CONFIGURE_REASON_NEW_CLIENT,
+ NewRunnableMethod(core_.get(),
+ &SyncBackendHost::Core::HandleInitializationCompletedOnFrontendLoop),
+ true);
}
bool SyncBackendHost::Core::IsCurrentThreadSafeForModel(
diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h
index 7c53fea..f3468f6 100644
--- a/chrome/browser/sync/glue/sync_backend_host.h
+++ b/chrome/browser/sync/glue/sync_backend_host.h
@@ -264,6 +264,15 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar {
// to make this class testable in general.
protected:
+ // An enum representing the steps to initializing the SyncBackendHost.
+ enum InitializationState {
+ NOT_INITIALIZED, // Initialization hasn't completed.
+ DOWNLOADING_NIGORI, // The SyncManager is initialized, but we're fetching
+ // encryption information before alerting the
+ // frontend.
+ INITIALIZED, // Initialization is complete.
+ };
+
// The real guts of SyncBackendHost, to keep the public client API clean.
class Core : public base::RefCountedThreadSafe<SyncBackendHost::Core>,
public sync_api::SyncManager::Observer,
@@ -416,6 +425,10 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar {
// A callback from the SyncerThread when it is safe to continue config.
void FinishConfigureDataTypes();
+ // Called to handle updating frontend thread components whenever we may
+ // need to alert the frontend that the backend is intialized.
+ void HandleInitializationCompletedOnFrontendLoop();
+
#if defined(UNIT_TEST)
// Special form of initialization that does not try and authenticate the
// last known user (since it will fail in test mode) and does some extra
@@ -487,10 +500,6 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar {
void HandleClearServerDataSucceededOnFrontendLoop();
void HandleClearServerDataFailedOnFrontendLoop();
- // Called from Core::OnInitializationComplete to handle updating
- // frontend thread components.
- void HandleInitializationCompletedOnFrontendLoop();
-
void RouteJsEventOnFrontendLoop(
const std::string& name, const JsEventDetails& details);
@@ -566,6 +575,8 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar {
// Our core, which communicates directly to the syncapi.
scoped_refptr<Core> core_;
+ InitializationState initialization_state_;
+
private:
FRIEND_TEST_ALL_PREFIXES(SyncBackendHostTest, MakePendingConfigModeState);
@@ -601,6 +612,9 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar {
sync_api::ConfigureReason reason,
bool nigori_enabled);
+ // For convenience, checks if initialization state is INITIALIZED.
+ bool initialized() const { return initialization_state_ == INITIALIZED; }
+
// A thread where all the sync operations happen.
base::Thread sync_thread_;
@@ -654,9 +668,6 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar {
// UI-thread cache of the last SyncSessionSnapshot received from syncapi.
scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_;
- // Whether we've processed the initialization complete callback.
- bool sync_manager_initialized_;
-
DISALLOW_COPY_AND_ASSIGN(SyncBackendHost);
};
diff --git a/chrome/browser/sync/glue/sync_backend_host_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_unittest.cc
index 7854ea5..aceb271 100644
--- a/chrome/browser/sync/glue/sync_backend_host_unittest.cc
+++ b/chrome/browser/sync/glue/sync_backend_host_unittest.cc
@@ -93,6 +93,9 @@ TEST_F(SyncBackendHostTest, InitShutdown) {
// "register sync prefs" code.
PrefService* pref_service = profile.GetPrefs();
pref_service->RegisterStringPref(prefs::kEncryptionBootstrapToken, "");
+ pref_service->RegisterBooleanPref(prefs::kSyncHasSetupCompleted,
+ false,
+ PrefService::UNSYNCABLE_PREF);
MockSyncFrontend mock_frontend;
sync_api::SyncCredentials credentials;
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 9804b6a..028a5f4 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -552,6 +552,12 @@ void ProfileSyncService::OnBackendInitialized() {
if (HasSyncSetupCompleted()) {
ConfigureDataTypeManager();
+ } else if (SetupInProgress()) {
+ wizard_.Step(SyncSetupWizard::SYNC_EVERYTHING);
+ } else {
+ // This should only be hit during integration tests, but there's no good
+ // way to assert this.
+ DVLOG(1) << "Setup not complete, no wizard - integration tests?";
}
}
@@ -687,12 +693,17 @@ void ProfileSyncService::OnPassphraseAccepted() {
// since we know we no longer require the passphrase.
passphrase_required_reason_ = sync_api::REASON_PASSPHRASE_NOT_REQUIRED;
- if (data_type_manager_.get())
+ if (data_type_manager_.get()) {
+ // Unblock the data type manager if necessary.
data_type_manager_->Configure(types,
sync_api::CONFIGURE_REASON_RECONFIGURATION);
+ }
NotifyObservers();
+ // TODO(tim): We shouldn't call this if !HasSyncSetupCompleted and the user
+ // isn't actually at the ENTER_PASSPHRASE screen. It results in a
+ // LOG(WARNING) currently.
wizard_.Step(SyncSetupWizard::DONE);
}
diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc
index a23cc33..8aae59e 100644
--- a/chrome/browser/sync/sync_setup_flow.cc
+++ b/chrome/browser/sync/sync_setup_flow.cc
@@ -361,8 +361,8 @@ void SyncSetupFlow::ActivateState(SyncSetupWizard::State state) {
flow_handler_->ShowGaiaSuccessAndClose();
break;
}
- current_state_ = SyncSetupWizard::SYNC_EVERYTHING;
- // Fall through.
+ flow_handler_->ShowGaiaSuccessAndSettingUp();
+ break;
case SyncSetupWizard::SYNC_EVERYTHING: {
DictionaryValue args;
SyncSetupFlow::GetArgsForConfigure(service_, &args);
diff --git a/chrome/browser/sync/sync_setup_wizard_unittest.cc b/chrome/browser/sync/sync_setup_wizard_unittest.cc
index 013dd1d..16b7d0d 100644
--- a/chrome/browser/sync/sync_setup_wizard_unittest.cc
+++ b/chrome/browser/sync/sync_setup_wizard_unittest.cc
@@ -295,8 +295,7 @@ TEST_F(SyncSetupWizardTest, InitialStepLogin) {
// Simulate success.
wizard_->Step(SyncSetupWizard::GAIA_SUCCESS);
EXPECT_TRUE(wizard_->IsVisible());
- // In a non-discrete run, GAIA_SUCCESS immediately transitions you to
- // SYNC_EVERYTHING.
+ wizard_->Step(SyncSetupWizard::SYNC_EVERYTHING);
EXPECT_EQ(SyncSetupWizard::SYNC_EVERYTHING, flow_->current_state_);
// That's all we're testing here, just move on to DONE. We'll test the
@@ -399,6 +398,7 @@ TEST_F(SyncSetupWizardTest, InvalidTransitions) {
EXPECT_EQ(SyncSetupWizard::GAIA_LOGIN, flow_->current_state_);
wizard_->Step(SyncSetupWizard::GAIA_SUCCESS);
+ wizard_->Step(SyncSetupWizard::SYNC_EVERYTHING);
EXPECT_EQ(SyncSetupWizard::SYNC_EVERYTHING, flow_->current_state_);
wizard_->Step(SyncSetupWizard::FATAL_ERROR);
@@ -419,6 +419,7 @@ TEST_F(SyncSetupWizardTest, AbortedByPendingClear) {
wizard_->Step(SyncSetupWizard::GAIA_LOGIN);
AttachSyncSetupHandler();
wizard_->Step(SyncSetupWizard::GAIA_SUCCESS);
+ wizard_->Step(SyncSetupWizard::SYNC_EVERYTHING);
wizard_->Step(SyncSetupWizard::SETUP_ABORTED_BY_PENDING_CLEAR);
EXPECT_EQ(SyncSetupWizard::SETUP_ABORTED_BY_PENDING_CLEAR,
flow_->current_state_);
diff --git a/chrome/browser/sync/test_profile_sync_service.cc b/chrome/browser/sync/test_profile_sync_service.cc
index 7453645..4f4ad07 100644
--- a/chrome/browser/sync/test_profile_sync_service.cc
+++ b/chrome/browser/sync/test_profile_sync_service.cc
@@ -133,6 +133,15 @@ void SyncBackendHostForProfileSyncTest::StartConfiguration(
Callback0::Type* callback) {
scoped_ptr<Callback0::Type> scoped_callback(callback);
SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop();
+ if (initialization_state_ == DOWNLOADING_NIGORI) {
+ syncable::ModelTypeBitSet sync_ended;
+ sync_ended.set(syncable::NIGORI);
+ std::string download_progress_markers[syncable::MODEL_TYPE_COUNT];
+ core_->HandleSyncCycleCompletedOnFrontendLoop(new SyncSessionSnapshot(
+ SyncerStatus(), ErrorCounters(), 0, false,
+ sync_ended, download_progress_markers, false, false, 0, 0, 0, false,
+ SyncSourceInfo(), 0));
+ }
}
void SyncBackendHostForProfileSyncTest::