| 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/throttled_data_type_tracker.h" |
| 16 #include "sync/engine/model_changing_syncer_command.h" | 17 #include "sync/engine/model_changing_syncer_command.h" |
| 17 #include "sync/engine/model_safe_worker.h" | 18 #include "sync/engine/model_safe_worker.h" |
| 18 #include "sync/engine/traffic_recorder.h" | 19 #include "sync/engine/traffic_recorder.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/mock_connection_manager.h" | 24 #include "sync/test/engine/mock_connection_manager.h" |
| 24 #include "sync/test/engine/fake_model_worker.h" | 25 #include "sync/test/engine/fake_model_worker.h" |
| 25 #include "sync/test/engine/test_directory_setter_upper.h" | 26 #include "sync/test/engine/test_directory_setter_upper.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 120 } |
| 120 | 121 |
| 121 void ClearSession() { | 122 void ClearSession() { |
| 122 session_.reset(); | 123 session_.reset(); |
| 123 } | 124 } |
| 124 | 125 |
| 125 void ResetContext() { | 126 void ResetContext() { |
| 126 context_.reset(new sessions::SyncSessionContext( | 127 context_.reset(new sessions::SyncSessionContext( |
| 127 mock_server_.get(), directory(), | 128 mock_server_.get(), directory(), |
| 128 registrar(), &extensions_activity_monitor_, | 129 registrar(), &extensions_activity_monitor_, |
| 130 &throttled_data_type_tracker_, |
| 129 std::vector<SyncEngineEventListener*>(), | 131 std::vector<SyncEngineEventListener*>(), |
| 130 &mock_debug_info_getter_, | 132 &mock_debug_info_getter_, |
| 131 &traffic_recorder_)); | 133 &traffic_recorder_)); |
| 132 context_->set_account_name(directory()->name()); | 134 context_->set_account_name(directory()->name()); |
| 133 ClearSession(); | 135 ClearSession(); |
| 134 } | 136 } |
| 135 | 137 |
| 136 // Install a MockServerConnection. Resets the context. By default, | 138 // Install a MockServerConnection. Resets the context. By default, |
| 137 // the context does not have a MockServerConnection attached. | 139 // the context does not have a MockServerConnection attached. |
| 138 void ConfigureMockServerConnection() { | 140 void ConfigureMockServerConnection() { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 196 |
| 195 private: | 197 private: |
| 196 MessageLoop message_loop_; | 198 MessageLoop message_loop_; |
| 197 scoped_ptr<sessions::SyncSessionContext> context_; | 199 scoped_ptr<sessions::SyncSessionContext> context_; |
| 198 scoped_ptr<MockConnectionManager> mock_server_; | 200 scoped_ptr<MockConnectionManager> mock_server_; |
| 199 scoped_ptr<sessions::SyncSession> session_; | 201 scoped_ptr<sessions::SyncSession> session_; |
| 200 std::vector<scoped_refptr<ModelSafeWorker> > workers_; | 202 std::vector<scoped_refptr<ModelSafeWorker> > workers_; |
| 201 ModelSafeRoutingInfo routing_info_; | 203 ModelSafeRoutingInfo routing_info_; |
| 202 NiceMock<MockDebugInfoGetter> mock_debug_info_getter_; | 204 NiceMock<MockDebugInfoGetter> mock_debug_info_getter_; |
| 203 FakeExtensionsActivityMonitor extensions_activity_monitor_; | 205 FakeExtensionsActivityMonitor extensions_activity_monitor_; |
| 206 ThrottledDataTypeTracker throttled_data_type_tracker_; |
| 204 TrafficRecorder traffic_recorder_; | 207 TrafficRecorder traffic_recorder_; |
| 205 DISALLOW_COPY_AND_ASSIGN(SyncerCommandTestBase); | 208 DISALLOW_COPY_AND_ASSIGN(SyncerCommandTestBase); |
| 206 }; | 209 }; |
| 207 | 210 |
| 208 class SyncerCommandTest : public SyncerCommandTestBase { | 211 class SyncerCommandTest : public SyncerCommandTestBase { |
| 209 public: | 212 public: |
| 210 virtual void SetUp() OVERRIDE; | 213 virtual void SetUp() OVERRIDE; |
| 211 virtual void TearDown() OVERRIDE; | 214 virtual void TearDown() OVERRIDE; |
| 212 virtual Directory* directory() OVERRIDE; | 215 virtual Directory* directory() OVERRIDE; |
| 213 | 216 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 227 | 230 |
| 228 virtual void SetUp() OVERRIDE; | 231 virtual void SetUp() OVERRIDE; |
| 229 | 232 |
| 230 TestUnrecoverableErrorHandler handler_; | 233 TestUnrecoverableErrorHandler handler_; |
| 231 MockDirectory mock_directory_; | 234 MockDirectory mock_directory_; |
| 232 }; | 235 }; |
| 233 | 236 |
| 234 } // namespace browser_sync | 237 } // namespace browser_sync |
| 235 | 238 |
| 236 #endif // SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ | 239 #endif // SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ |
| OLD | NEW |