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

Unified Diff: sync/internal_api/test/fake_sync_manager.cc

Issue 10824252: Revert 150990 - [Sync] Avoid unregistering object IDs on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « sync/internal_api/sync_manager_impl_unittest.cc ('k') | sync/notifier/invalidation_notifier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/test/fake_sync_manager.cc
===================================================================
--- sync/internal_api/test/fake_sync_manager.cc (revision 150991)
+++ sync/internal_api/test/fake_sync_manager.cc (working copy)
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
-#include "base/run_loop.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
@@ -22,15 +21,22 @@
namespace syncer {
-FakeSyncManager::FakeSyncManager(ModelTypeSet initial_sync_ended_types,
- ModelTypeSet progress_marker_types,
- ModelTypeSet configure_fail_types) :
- initial_sync_ended_types_(initial_sync_ended_types),
- progress_marker_types_(progress_marker_types),
- configure_fail_types_(configure_fail_types) {}
+FakeSyncManager::FakeSyncManager() {}
FakeSyncManager::~FakeSyncManager() {}
+void FakeSyncManager::set_initial_sync_ended_types(ModelTypeSet types) {
+ initial_sync_ended_types_ = types;
+}
+
+void FakeSyncManager::set_progress_marker_types(ModelTypeSet types) {
+ progress_marker_types_ = types;
+}
+
+void FakeSyncManager::set_configure_fail_types(ModelTypeSet types) {
+ configure_fail_types_ = types;
+}
+
ModelTypeSet FakeSyncManager::GetAndResetCleanedTypes() {
ModelTypeSet cleaned_types = cleaned_types_;
cleaned_types_.Clear();
@@ -78,24 +84,6 @@
}
}
-namespace {
-
-void DoNothing() {}
-
-} // namespace
-
-void FakeSyncManager::WaitForSyncThread() {
- // Post a task to |sync_task_runner_| and block until it runs.
- base::RunLoop run_loop;
- if (!sync_task_runner_->PostTaskAndReply(
- FROM_HERE,
- base::Bind(&DoNothing),
- run_loop.QuitClosure())) {
- NOTREACHED();
- }
- run_loop.Run();
-}
-
void FakeSyncManager::Init(
const FilePath& database_location,
const WeakHandle<JsEventHandler>& event_handler,
@@ -160,22 +148,12 @@
enabled_types_ = types;
}
-void FakeSyncManager::RegisterInvalidationHandler(
- SyncNotifierObserver* handler) {
- registrar_.RegisterHandler(handler);
-}
-
void FakeSyncManager::UpdateRegisteredInvalidationIds(
SyncNotifierObserver* handler,
const ObjectIdSet& ids) {
- registrar_.UpdateRegisteredIds(handler, ids);
+ notifier_helper_.UpdateRegisteredIds(handler, ids);
}
-void FakeSyncManager::UnregisterInvalidationHandler(
- SyncNotifierObserver* handler) {
- registrar_.UnregisterHandler(handler);
-}
-
void FakeSyncManager::StartSyncingNormally(
const ModelSafeRoutingInfo& routing_info) {
// Do nothing.
@@ -286,18 +264,18 @@
const ObjectIdPayloadMap& id_payloads,
IncomingNotificationSource source) {
DCHECK(sync_task_runner_->RunsTasksOnCurrentThread());
- registrar_.DispatchInvalidationsToHandlers(id_payloads, source);
+ notifier_helper_.DispatchInvalidationsToHandlers(id_payloads, source);
}
void FakeSyncManager::EnableNotificationsOnSyncThread() {
DCHECK(sync_task_runner_->RunsTasksOnCurrentThread());
- registrar_.EmitOnNotificationsEnabled();
+ notifier_helper_.EmitOnNotificationsEnabled();
}
void FakeSyncManager::DisableNotificationsOnSyncThread(
NotificationsDisabledReason reason) {
DCHECK(sync_task_runner_->RunsTasksOnCurrentThread());
- registrar_.EmitOnNotificationsDisabled(reason);
+ notifier_helper_.EmitOnNotificationsDisabled(reason);
}
} // namespace syncer
« no previous file with comments | « sync/internal_api/sync_manager_impl_unittest.cc ('k') | sync/notifier/invalidation_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698