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

Side by Side Diff: sync/test/engine/syncer_command_test.h

Issue 23717047: Retry: sync: Gracefully handle early shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renames Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/test/engine/mock_connection_manager.cc ('k') | sync/tools/sync_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "sync/engine/model_changing_syncer_command.h" 15 #include "sync/engine/model_changing_syncer_command.h"
16 #include "sync/engine/traffic_recorder.h" 16 #include "sync/engine/traffic_recorder.h"
17 #include "sync/internal_api/debug_info_event_listener.h" 17 #include "sync/internal_api/debug_info_event_listener.h"
18 #include "sync/internal_api/public/base/cancelation_signal.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/directory.h" 23 #include "sync/syncable/directory.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/util/extensions_activity.h" 27 #include "sync/util/extensions_activity.h"
27 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 false, // force enable pre-commit GU avoidance experiment 98 false, // force enable pre-commit GU avoidance experiment
98 "fake_invalidator_client_id")); 99 "fake_invalidator_client_id"));
99 context_->set_routing_info(routing_info_); 100 context_->set_routing_info(routing_info_);
100 context_->set_account_name(directory()->name()); 101 context_->set_account_name(directory()->name());
101 ClearSession(); 102 ClearSession();
102 } 103 }
103 104
104 // Install a MockServerConnection. Resets the context. By default, 105 // Install a MockServerConnection. Resets the context. By default,
105 // the context does not have a MockServerConnection attached. 106 // the context does not have a MockServerConnection attached.
106 void ConfigureMockServerConnection() { 107 void ConfigureMockServerConnection() {
107 mock_server_.reset(new MockConnectionManager(directory())); 108 mock_server_.reset(new MockConnectionManager(directory(),
109 &cancelation_signal_));
108 ResetContext(); 110 ResetContext();
109 } 111 }
110 112
111 virtual syncable::Directory* directory() = 0; 113 virtual syncable::Directory* directory() = 0;
112 114
113 std::vector<scoped_refptr<ModelSafeWorker> >* workers() { 115 std::vector<scoped_refptr<ModelSafeWorker> >* workers() {
114 return &workers_; 116 return &workers_;
115 } 117 }
116 118
117 const ModelSafeRoutingInfo& routing_info() { return routing_info_; } 119 const ModelSafeRoutingInfo& routing_info() { return routing_info_; }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 private: 164 private:
163 base::MessageLoop message_loop_; 165 base::MessageLoop message_loop_;
164 scoped_ptr<sessions::SyncSessionContext> context_; 166 scoped_ptr<sessions::SyncSessionContext> context_;
165 scoped_ptr<MockConnectionManager> mock_server_; 167 scoped_ptr<MockConnectionManager> mock_server_;
166 scoped_ptr<sessions::SyncSession> session_; 168 scoped_ptr<sessions::SyncSession> session_;
167 std::vector<scoped_refptr<ModelSafeWorker> > workers_; 169 std::vector<scoped_refptr<ModelSafeWorker> > workers_;
168 ModelSafeRoutingInfo routing_info_; 170 ModelSafeRoutingInfo routing_info_;
169 DebugInfoEventListener debug_info_event_listener_; 171 DebugInfoEventListener debug_info_event_listener_;
170 scoped_refptr<ExtensionsActivity> extensions_activity_; 172 scoped_refptr<ExtensionsActivity> extensions_activity_;
171 TrafficRecorder traffic_recorder_; 173 TrafficRecorder traffic_recorder_;
174 CancelationSignal cancelation_signal_;
172 DISALLOW_COPY_AND_ASSIGN(SyncerCommandTestBase); 175 DISALLOW_COPY_AND_ASSIGN(SyncerCommandTestBase);
173 }; 176 };
174 177
175 class SyncerCommandTest : public SyncerCommandTestBase { 178 class SyncerCommandTest : public SyncerCommandTestBase {
176 public: 179 public:
177 virtual void SetUp() OVERRIDE; 180 virtual void SetUp() OVERRIDE;
178 virtual void TearDown() OVERRIDE; 181 virtual void TearDown() OVERRIDE;
179 virtual syncable::Directory* directory() OVERRIDE; 182 virtual syncable::Directory* directory() OVERRIDE;
180 183
181 private: 184 private:
182 TestDirectorySetterUpper dir_maker_; 185 TestDirectorySetterUpper dir_maker_;
183 }; 186 };
184 187
185 } // namespace syncer 188 } // namespace syncer
186 189
187 #endif // SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_ 190 #endif // SYNC_TEST_ENGINE_SYNCER_COMMAND_TEST_H_
OLDNEW
« no previous file with comments | « sync/test/engine/mock_connection_manager.cc ('k') | sync/tools/sync_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698