Index: sync/internal_api/test/fake_sync_manager.cc |
diff --git a/sync/internal_api/test/fake_sync_manager.cc b/sync/internal_api/test/fake_sync_manager.cc |
index c9a742d5ae372c062b0fae24309d99e91fe6deda..cc41cc00c373b224609fb27219eb63c685d8f771 100644 |
--- a/sync/internal_api/test/fake_sync_manager.cc |
+++ b/sync/internal_api/test/fake_sync_manager.cc |
@@ -9,6 +9,7 @@ |
#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" |
@@ -21,22 +22,15 @@ |
namespace syncer { |
-FakeSyncManager::FakeSyncManager() {} |
+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() {} |
-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(); |
@@ -84,6 +78,24 @@ void FakeSyncManager::DisableNotifications( |
} |
} |
+namespace { |
+ |
+void DoNothing() {} |
+ |
+} // namespace |
+ |
+void FakeSyncManager::WaitForSyncThread() { |
msw
2012/08/07 20:09:30
This pattern seems odd, is there precedent for it
akalin
2012/08/07 23:38:05
I don't think there's a precedent. An alternate w
msw
2012/08/08 00:55:23
Sorry, I don't fully understand what you're doing,
|
+ // 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(); |
+} |
+ |
bool FakeSyncManager::Init( |
const FilePath& database_location, |
const WeakHandle<JsEventHandler>& event_handler, |
@@ -149,10 +161,16 @@ void FakeSyncManager::UpdateEnabledTypes(const ModelTypeSet& types) { |
enabled_types_ = types; |
} |
+void FakeSyncManager::SetInvalidationHandler( |
+ const std::string& handler_name, |
+ SyncNotifierObserver* handler) { |
+ notifier_helper_.SetHandler(handler_name, handler); |
+} |
+ |
void FakeSyncManager::UpdateRegisteredInvalidationIds( |
- SyncNotifierObserver* handler, |
+ const std::string& handler_name, |
const ObjectIdSet& ids) { |
- notifier_helper_.UpdateRegisteredIds(handler, ids); |
+ notifier_helper_.UpdateRegisteredIds(handler_name, ids); |
} |
void FakeSyncManager::StartSyncingNormally( |