| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ | 5 #ifndef SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ | 
| 6 #define SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ | 6 #define SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ | 
| 7 #pragma once | 7 #pragma once | 
| 8 | 8 | 
| 9 #include <algorithm> | 9 #include <algorithm> | 
| 10 #include <string> | 10 #include <string> | 
| 11 #include <vector> | 11 #include <vector> | 
| 12 | 12 | 
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" | 
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" | 
| 15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" | 
| 16 #include "sync/engine/model_changing_syncer_command.h" | 16 #include "sync/engine/model_changing_syncer_command.h" | 
|  | 17 #include "sync/engine/throttled_data_type_tracker.h" | 
| 17 #include "sync/engine/traffic_recorder.h" | 18 #include "sync/engine/traffic_recorder.h" | 
| 18 #include "sync/internal_api/public/engine/model_safe_worker.h" | 19 #include "sync/internal_api/public/engine/model_safe_worker.h" | 
| 19 #include "sync/sessions/debug_info_getter.h" | 20 #include "sync/sessions/debug_info_getter.h" | 
| 20 #include "sync/sessions/sync_session.h" | 21 #include "sync/sessions/sync_session.h" | 
| 21 #include "sync/sessions/sync_session_context.h" | 22 #include "sync/sessions/sync_session_context.h" | 
| 22 #include "sync/syncable/syncable_mock.h" | 23 #include "sync/syncable/syncable_mock.h" | 
| 23 #include "sync/test/engine/fake_model_worker.h" | 24 #include "sync/test/engine/fake_model_worker.h" | 
| 24 #include "sync/test/engine/mock_connection_manager.h" | 25 #include "sync/test/engine/mock_connection_manager.h" | 
| 25 #include "sync/test/engine/test_directory_setter_upper.h" | 26 #include "sync/test/engine/test_directory_setter_upper.h" | 
| 26 #include "sync/test/fake_extensions_activity_monitor.h" | 27 #include "sync/test/fake_extensions_activity_monitor.h" | 
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 114                      routing_info_, workers)); | 115                      routing_info_, workers)); | 
| 115     } | 116     } | 
| 116     return session_.get(); | 117     return session_.get(); | 
| 117   } | 118   } | 
| 118 | 119 | 
| 119   void ClearSession() { | 120   void ClearSession() { | 
| 120     session_.reset(); | 121     session_.reset(); | 
| 121   } | 122   } | 
| 122 | 123 | 
| 123   void ResetContext() { | 124   void ResetContext() { | 
|  | 125     throttled_data_type_tracker_.reset(new ThrottledDataTypeTracker(NULL)); | 
| 124     context_.reset(new sessions::SyncSessionContext( | 126     context_.reset(new sessions::SyncSessionContext( | 
| 125             mock_server_.get(), directory(), | 127             mock_server_.get(), directory(), | 
| 126             routing_info_, GetWorkers(), &extensions_activity_monitor_, | 128             routing_info_, GetWorkers(), &extensions_activity_monitor_, | 
|  | 129             throttled_data_type_tracker_.get(), | 
| 127             std::vector<SyncEngineEventListener*>(), | 130             std::vector<SyncEngineEventListener*>(), | 
| 128             &mock_debug_info_getter_, | 131             &mock_debug_info_getter_, | 
| 129             &traffic_recorder_)); | 132             &traffic_recorder_)); | 
| 130     context_->set_account_name(directory()->name()); | 133     context_->set_account_name(directory()->name()); | 
| 131     ClearSession(); | 134     ClearSession(); | 
| 132   } | 135   } | 
| 133 | 136 | 
| 134   // Install a MockServerConnection.  Resets the context.  By default, | 137   // Install a MockServerConnection.  Resets the context.  By default, | 
| 135   // the context does not have a MockServerConnection attached. | 138   // the context does not have a MockServerConnection attached. | 
| 136   void ConfigureMockServerConnection() { | 139   void ConfigureMockServerConnection() { | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 192 | 195 | 
| 193  private: | 196  private: | 
| 194   MessageLoop message_loop_; | 197   MessageLoop message_loop_; | 
| 195   scoped_ptr<sessions::SyncSessionContext> context_; | 198   scoped_ptr<sessions::SyncSessionContext> context_; | 
| 196   scoped_ptr<MockConnectionManager> mock_server_; | 199   scoped_ptr<MockConnectionManager> mock_server_; | 
| 197   scoped_ptr<sessions::SyncSession> session_; | 200   scoped_ptr<sessions::SyncSession> session_; | 
| 198   std::vector<scoped_refptr<ModelSafeWorker> > workers_; | 201   std::vector<scoped_refptr<ModelSafeWorker> > workers_; | 
| 199   ModelSafeRoutingInfo routing_info_; | 202   ModelSafeRoutingInfo routing_info_; | 
| 200   NiceMock<MockDebugInfoGetter> mock_debug_info_getter_; | 203   NiceMock<MockDebugInfoGetter> mock_debug_info_getter_; | 
| 201   FakeExtensionsActivityMonitor extensions_activity_monitor_; | 204   FakeExtensionsActivityMonitor extensions_activity_monitor_; | 
|  | 205   scoped_ptr<ThrottledDataTypeTracker> throttled_data_type_tracker_; | 
| 202   TrafficRecorder traffic_recorder_; | 206   TrafficRecorder traffic_recorder_; | 
| 203   DISALLOW_COPY_AND_ASSIGN(SyncerCommandTestBase); | 207   DISALLOW_COPY_AND_ASSIGN(SyncerCommandTestBase); | 
| 204 }; | 208 }; | 
| 205 | 209 | 
| 206 class SyncerCommandTest : public SyncerCommandTestBase { | 210 class SyncerCommandTest : public SyncerCommandTestBase { | 
| 207  public: | 211  public: | 
| 208   virtual void SetUp() OVERRIDE; | 212   virtual void SetUp() OVERRIDE; | 
| 209   virtual void TearDown() OVERRIDE; | 213   virtual void TearDown() OVERRIDE; | 
| 210   virtual Directory* directory() OVERRIDE; | 214   virtual Directory* directory() OVERRIDE; | 
| 211 | 215 | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 225 | 229 | 
| 226   virtual void SetUp() OVERRIDE; | 230   virtual void SetUp() OVERRIDE; | 
| 227 | 231 | 
| 228   TestUnrecoverableErrorHandler handler_; | 232   TestUnrecoverableErrorHandler handler_; | 
| 229   MockDirectory mock_directory_; | 233   MockDirectory mock_directory_; | 
| 230 }; | 234 }; | 
| 231 | 235 | 
| 232 }  // namespace browser_sync | 236 }  // namespace browser_sync | 
| 233 | 237 | 
| 234 #endif  // SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ | 238 #endif  // SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ | 
| OLD | NEW | 
|---|