Index: sync/internal_api/sync_context_proxy_impl_unittest.cc |
diff --git a/sync/internal_api/sync_context_proxy_impl_unittest.cc b/sync/internal_api/sync_context_proxy_impl_unittest.cc |
index 660670dbd827d3c755d993778f4dde4df3eb2f8b..49ed02de0727c29dba90ceb7b72ea1259fa99c89 100644 |
--- a/sync/internal_api/sync_context_proxy_impl_unittest.cc |
+++ b/sync/internal_api/sync_context_proxy_impl_unittest.cc |
@@ -11,6 +11,8 @@ |
#include "sync/internal_api/public/sync_context.h" |
#include "sync/internal_api/sync_context_proxy_impl.h" |
#include "sync/sessions/model_type_registry.h" |
+#include "sync/test/engine/mock_nudge_handler.h" |
+#include "sync/test/engine/test_directory_setter_upper.h" |
#include "testing/gtest/include/gtest/gtest.h" |
namespace syncer { |
@@ -19,22 +21,39 @@ class SyncContextProxyImplTest : public ::testing::Test { |
public: |
SyncContextProxyImplTest() |
: sync_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
- type_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
- registry_(new ModelTypeRegistry()), |
- context_proxy_(sync_task_runner_, registry_->AsWeakPtr()) {} |
+ type_task_runner_(base::ThreadTaskRunnerHandle::Get()) {} |
+ |
+ virtual void SetUp() { |
+ dir_maker_.SetUp(); |
+ registry_.reset(new ModelTypeRegistry( |
+ workers_, dir_maker_.directory(), &nudge_handler_)); |
+ context_proxy_.reset( |
+ new SyncContextProxyImpl(sync_task_runner_, registry_->AsWeakPtr())); |
+ } |
+ |
+ virtual void TearDown() { |
+ context_proxy_.reset(); |
+ registry_.reset(); |
+ dir_maker_.TearDown(); |
+ } |
// The sync thread could be shut down at any time without warning. This |
// function simulates such an event. |
void DisableSync() { registry_.reset(); } |
- scoped_ptr<SyncContextProxy> GetProxy() { return context_proxy_.Clone(); } |
+ scoped_ptr<SyncContextProxy> GetProxy() { return context_proxy_->Clone(); } |
private: |
base::MessageLoop loop_; |
scoped_refptr<base::SequencedTaskRunner> sync_task_runner_; |
scoped_refptr<base::SequencedTaskRunner> type_task_runner_; |
+ |
+ std::vector<scoped_refptr<ModelSafeWorker> > workers_; |
+ TestDirectorySetterUpper dir_maker_; |
+ MockNudgeHandler nudge_handler_; |
scoped_ptr<ModelTypeRegistry> registry_; |
- SyncContextProxyImpl context_proxy_; |
+ |
+ scoped_ptr<SyncContextProxyImpl> context_proxy_; |
}; |
// Try to connect a type to a SyncContext that has already shut down. |