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

Side by Side Diff: chrome/test/sync/engine/mock_server_connection.h

Issue 235010: Reverting 27117. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 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 | « chrome/common/chrome_switches.cc ('k') | chrome/test/sync/engine/mock_server_connection.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // Mock ServerConnectionManager class for use in client unit tests. 5 // Mock ServerConnectionManager class for use in client unit tests.
6 6
7 #ifndef CHROME_TEST_SYNC_ENGINE_MOCK_SERVER_CONNECTION_H_ 7 #ifndef CHROME_TEST_SYNC_ENGINE_MOCK_SERVER_CONNECTION_H_
8 #define CHROME_TEST_SYNC_ENGINE_MOCK_SERVER_CONNECTION_H_ 8 #define CHROME_TEST_SYNC_ENGINE_MOCK_SERVER_CONNECTION_H_
9 9
10 #include <string> 10 #include <string>
(...skipping 13 matching lines...) Expand all
24 namespace browser_sync { 24 namespace browser_sync {
25 struct HttpResponse; 25 struct HttpResponse;
26 } 26 }
27 27
28 class MockConnectionManager : public browser_sync::ServerConnectionManager { 28 class MockConnectionManager : public browser_sync::ServerConnectionManager {
29 public: 29 public:
30 // A callback function type. These can be set to be called when server 30 // A callback function type. These can be set to be called when server
31 // activity would normally take place. This aids simulation of race 31 // activity would normally take place. This aids simulation of race
32 // conditions. 32 // conditions.
33 typedef bool (*TestCallbackFunction)(syncable::Directory* dir); 33 typedef bool (*TestCallbackFunction)(syncable::Directory* dir);
34 class MidCommitObserver {
35 public:
36 virtual void Observe() = 0;
37 };
38 34
39 MockConnectionManager(syncable::DirectoryManager* dirmgr, PathString name); 35 MockConnectionManager(syncable::DirectoryManager* dirmgr, PathString name);
40 virtual ~MockConnectionManager(); 36 virtual ~MockConnectionManager();
41 37
42 // Overridden ServerConnectionManager functions. 38 // Overridden ServerConnectionManager functions.
43 virtual bool PostBufferToPath(const PostBufferParams*, 39 virtual bool PostBufferToPath(const PostBufferParams*,
44 const string& path, 40 const string& path,
45 const string& auth_token); 41 const string& auth_token);
46 42
47 virtual bool IsServerReachable(); 43 virtual bool IsServerReachable();
48 virtual bool IsUserAuthenticated(); 44 virtual bool IsUserAuthenticated();
49 45
50 // Control of commit response. 46 // Control of commit response.
51 void SetMidCommitCallbackFunction(TestCallbackFunction callback); 47 void SetMidCommitCallbackFunction(TestCallbackFunction callback);
52 void SetMidCommitObserver(MidCommitObserver* observer);
53 48
54 // Set this if you want commit to perform commit time rename. Will request 49 // Set this if you want commit to perform commit time rename. Will request
55 // that the client renames all commited entries, prepending this string. 50 // that the client renames all commited entries, prepending this string.
56 void SetCommitTimeRename(string prepend); 51 void SetCommitTimeRename(string prepend);
57 52
58 // Control of get updates response. All updates set will only be returned 53 // Control of get updates response. All updates set will only be returned
59 // once. This mock object doesn't simulate a changelist, it simulates server 54 // once. This mock object doesn't simulate a changelist, it simulates server
60 // responses. 55 // responses.
61 void ResetUpdates(); 56 void ResetUpdates();
62 // Generic versions of AddUpdate functions. Tests using these function should 57 // Generic versions of AddUpdate functions. Tests using these function should
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // The store birthday we send to the client. 170 // The store birthday we send to the client.
176 string store_birthday_; 171 string store_birthday_;
177 bool store_birthday_sent_; 172 bool store_birthday_sent_;
178 bool client_stuck_; 173 bool client_stuck_;
179 string commit_time_rename_prepended_string_; 174 string commit_time_rename_prepended_string_;
180 175
181 // Fail on the next call to PostBufferToPath(). 176 // Fail on the next call to PostBufferToPath().
182 bool fail_next_postbuffer_; 177 bool fail_next_postbuffer_;
183 178
184 // Our directory. 179 // Our directory.
185 syncable::DirectoryManager* directory_manager_; 180 syncable::ScopedDirLookup directory_;
186 PathString directory_name_;
187 181
188 // The updates we'll return to the next request. 182 // The updates we'll return to the next request.
189 sync_pb::GetUpdatesResponse updates_; 183 sync_pb::GetUpdatesResponse updates_;
190 TestCallbackFunction mid_commit_callback_function_; 184 TestCallbackFunction mid_commit_callback_function_;
191 MidCommitObserver* mid_commit_observer_;
192 185
193 scoped_ptr<sync_pb::ClientCommand> client_command_; 186 scoped_ptr<sync_pb::ClientCommand> client_command_;
194 187
195 // The next value to use for the position_in_parent property. 188 // The next value to use for the position_in_parent property.
196 int64 next_position_in_parent_; 189 int64 next_position_in_parent_;
197 190
198 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); 191 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager);
199 }; 192 };
200 193
201 #endif // CHROME_TEST_SYNC_ENGINE_MOCK_SERVER_CONNECTION_H_ 194 #endif // CHROME_TEST_SYNC_ENGINE_MOCK_SERVER_CONNECTION_H_
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | chrome/test/sync/engine/mock_server_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698