Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Unified Diff: chrome/browser/sync/test_profile_sync_service.cc

Issue 10520010: Not for review: Support sync init with missing or corrupt store (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Documentation Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/test_profile_sync_service.cc
diff --git a/chrome/browser/sync/test_profile_sync_service.cc b/chrome/browser/sync/test_profile_sync_service.cc
index 60c881b3e294a938563ee9a083b3457a73cc64db..d1a227f70939ce2983d428e5c118c3e4228e720e 100644
--- a/chrome/browser/sync/test_profile_sync_service.cc
+++ b/chrome/browser/sync/test_profile_sync_service.cc
@@ -17,6 +17,8 @@
#include "sync/sessions/session_state.h"
#include "sync/syncable/syncable.h"
+#include "chrome/browser/sync/glue/sync_backend_registrar.h"
+
using browser_sync::ModelSafeRoutingInfo;
using browser_sync::sessions::ErrorCounters;
using browser_sync::sessions::SyncSourceInfo;
@@ -32,31 +34,17 @@ SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest(
Profile* profile,
const base::WeakPtr<SyncPrefs>& sync_prefs,
const base::WeakPtr<InvalidatorStorage>& invalidator_storage,
- bool set_initial_sync_ended_on_init,
bool synchronous_init,
- bool fail_initial_download,
+ bool fail_all_downloads,
bool use_real_database)
: browser_sync::SyncBackendHost(
profile->GetDebugName(), profile, sync_prefs, invalidator_storage),
synchronous_init_(synchronous_init),
- fail_initial_download_(fail_initial_download),
+ fail_all_downloads_(fail_all_downloads),
use_real_database_(use_real_database) {}
SyncBackendHostForProfileSyncTest::~SyncBackendHostForProfileSyncTest() {}
-void SyncBackendHostForProfileSyncTest::
- SimulateSyncCycleCompletedInitialSyncEnded(
- const tracked_objects::Location& location) {
- syncable::ModelTypeSet sync_ended;
- if (!fail_initial_download_)
- sync_ended = syncable::ModelTypeSet::All();
- syncable::ModelTypePayloadMap download_progress_markers;
- HandleSyncCycleCompletedOnFrontendLoop(SyncSessionSnapshot(
- SyncerStatus(), ErrorCounters(), 0, false,
- sync_ended, download_progress_markers, false, false, 0, 0, 0, 0,
- SyncSourceInfo(), false, 0, base::Time::Now(), false));
-}
-
namespace {
sync_api::HttpPostProviderFactory* MakeTestHttpBridgeFactory() {
@@ -88,15 +76,14 @@ void SyncBackendHostForProfileSyncTest::InitCore(
void SyncBackendHostForProfileSyncTest::StartConfiguration(
const base::Closure& callback) {
SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop();
- if (IsDownloadingNigoriForTest()) {
- syncable::ModelTypeSet sync_ended;
- if (!fail_initial_download_)
- sync_ended.Put(syncable::NIGORI);
+ if (!fail_all_downloads_ && pending_download_state_.get()) {
+ // Give the SBH the callback it is waiting for.
syncable::ModelTypePayloadMap download_progress_markers;
HandleSyncCycleCompletedOnFrontendLoop(SyncSessionSnapshot(
SyncerStatus(), ErrorCounters(), 0, false,
- sync_ended, download_progress_markers, false, false, 0, 0, 0, 0,
+ pending_download_state_->types_to_add,
+ download_progress_markers, false, false, 0, 0, 0, 0,
SyncSourceInfo(), false, 0, base::Time::Now(), false));
}
}
@@ -135,7 +122,7 @@ TestProfileSyncService::TestProfileSyncService(
synchronous_sync_configuration_(false),
callback_(callback),
set_initial_sync_ended_on_init_(true),
- fail_initial_download_(false),
+ fail_all_downloads_(false),
use_real_database_(false) {
SetSyncSetupCompleted();
}
@@ -215,8 +202,8 @@ void TestProfileSyncService::dont_set_initial_sync_ended_on_init() {
void TestProfileSyncService::set_synchronous_sync_configuration() {
synchronous_sync_configuration_ = true;
}
-void TestProfileSyncService::fail_initial_download() {
- fail_initial_download_ = true;
+void TestProfileSyncService::fail_all_downloads() {
+ fail_all_downloads_ = true;
}
void TestProfileSyncService::set_use_real_database() {
use_real_database_ = true;
@@ -227,8 +214,7 @@ void TestProfileSyncService::CreateBackend() {
profile(),
sync_prefs_.AsWeakPtr(),
invalidator_storage_.AsWeakPtr(),
- set_initial_sync_ended_on_init_,
synchronous_backend_initialization_,
- fail_initial_download_,
+ fail_all_downloads_,
use_real_database_));
}

Powered by Google App Engine
This is Rietveld 408576698