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

Unified Diff: chrome/browser/sync_file_system/drive_file_sync_service.cc

Issue 12391012: Sync FileSystem: Add simulated relaunch of DriveFileSyncService on its unit_tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: testfix for win7 Created 7 years, 10 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_file_system/drive_file_sync_service.cc
diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.cc b/chrome/browser/sync_file_system/drive_file_sync_service.cc
index a504a3a66ad0f6b23b53effe5da16e9db1b6405d..6360c6deadec9f55d8278f6f24aec1eb5b245677 100644
--- a/chrome/browser/sync_file_system/drive_file_sync_service.cc
+++ b/chrome/browser/sync_file_system/drive_file_sync_service.cc
@@ -287,7 +287,8 @@ DriveFileSyncService::~DriveFileSyncService() {
// Invalidate WeakPtr instances here explicitly to notify TaskToken that we
// can safely discard the token.
weak_factory_.InvalidateWeakPtrs();
- sync_client_->RemoveObserver(this);
+ if (sync_client_)
+ sync_client_->RemoveObserver(this);
token_.reset();
// Unregister for Drive notifications.
@@ -318,6 +319,12 @@ scoped_ptr<DriveFileSyncService> DriveFileSyncService::CreateForTesting(
profile, base_dir, sync_client.Pass(), metadata_store.Pass()));
}
+scoped_ptr<DriveFileSyncClientInterface>
+DriveFileSyncService::DestroyAndPassSyncClientForTesting(
+ scoped_ptr<DriveFileSyncService> sync_service) {
+ return sync_service->sync_client_.Pass();
+}
+
void DriveFileSyncService::AddServiceObserver(Observer* observer) {
service_observers_.AddObserver(observer);
}
@@ -1823,8 +1830,7 @@ void DriveFileSyncService::MaybeStartFetchChanges() {
}
if (may_have_unfetched_changes_ &&
- !metadata_store_->incremental_sync_origins().empty() &&
- pending_changes_.empty()) {
+ !metadata_store_->incremental_sync_origins().empty()) {
FetchChangesForIncrementalSync();
}
}
@@ -1836,7 +1842,6 @@ void DriveFileSyncService::FetchChangesForIncrementalSync() {
DCHECK(may_have_unfetched_changes_);
DCHECK(pending_batch_sync_origins_.empty());
DCHECK(!metadata_store_->incremental_sync_origins().empty());
- DCHECK(pending_changes_.empty());
DVLOG(1) << "FetchChangesForIncrementalSync (start_changestamp:"
<< (largest_fetched_changestamp_ + 1) << ")";

Powered by Google App Engine
This is Rietveld 408576698