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

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

Issue 246098: Sync: Remove pthreads from auth_watcher. (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/chrome.gyp ('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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 int xattr_count); 102 int xattr_count);
103 // Prepare to add checksums. 103 // Prepare to add checksums.
104 void SetLastUpdateDeleted(); 104 void SetLastUpdateDeleted();
105 void SetLastUpdateSingletonTag(const string& tag); 105 void SetLastUpdateSingletonTag(const string& tag);
106 void SetLastUpdateOriginatorFields(const string& client_id, 106 void SetLastUpdateOriginatorFields(const string& client_id,
107 const string& entry_id); 107 const string& entry_id);
108 void SetLastUpdatePosition(int64 position_in_parent); 108 void SetLastUpdatePosition(int64 position_in_parent);
109 void SetNewTimestamp(int64 ts); 109 void SetNewTimestamp(int64 ts);
110 void SetNewestTimestamp(int64 ts); 110 void SetNewestTimestamp(int64 ts);
111 111
112 // For AUTHENTICATE responses.
113 void SetAuthenticationResponseInfo(const std::string& valid_auth_token,
114 const std::string& user_display_name,
115 const std::string& user_display_email,
116 const std::string& user_obfuscated_id);
117
112 void FailNextPostBufferToPathCall() { fail_next_postbuffer_ = true; } 118 void FailNextPostBufferToPathCall() { fail_next_postbuffer_ = true; }
113 119
114 // Simple inspectors. 120 // Simple inspectors.
115 bool client_stuck() const { return client_stuck_; } 121 bool client_stuck() const { return client_stuck_; }
116 122
117 sync_pb::ClientCommand* GetNextClientCommand(); 123 sync_pb::ClientCommand* GetNextClientCommand();
118 124
119 const vector<syncable::Id>& committed_ids() const { return committed_ids_; } 125 const vector<syncable::Id>& committed_ids() const { return committed_ids_; }
120 const vector<sync_pb::CommitMessage*>& commit_messages() const { 126 const vector<sync_pb::CommitMessage*>& commit_messages() const {
121 return commit_messages_; 127 return commit_messages_;
(...skipping 15 matching lines...) Expand all
137 sync_pb::SyncEntity* AddUpdateFull(syncable::Id id, syncable::Id parentid, 143 sync_pb::SyncEntity* AddUpdateFull(syncable::Id id, syncable::Id parentid,
138 string name, int64 version, 144 string name, int64 version,
139 int64 sync_ts, 145 int64 sync_ts,
140 bool is_dir); 146 bool is_dir);
141 sync_pb::SyncEntity* AddUpdateFull(string id, string parentid, string name, 147 sync_pb::SyncEntity* AddUpdateFull(string id, string parentid, string name,
142 int64 version, int64 sync_ts, 148 int64 version, int64 sync_ts,
143 bool is_dir); 149 bool is_dir);
144 // Functions to handle the various types of server request. 150 // Functions to handle the various types of server request.
145 void ProcessGetUpdates(sync_pb::ClientToServerMessage* csm, 151 void ProcessGetUpdates(sync_pb::ClientToServerMessage* csm,
146 sync_pb::ClientToServerResponse* response); 152 sync_pb::ClientToServerResponse* response);
153 void ProcessAuthenticate(sync_pb::ClientToServerMessage* csm,
154 sync_pb::ClientToServerResponse* response,
155 const std::string& auth_token);
147 void ProcessCommit(sync_pb::ClientToServerMessage* csm, 156 void ProcessCommit(sync_pb::ClientToServerMessage* csm,
148 sync_pb::ClientToServerResponse* response_buffer); 157 sync_pb::ClientToServerResponse* response_buffer);
149 // Locate the most recent update message for purpose of alteration. 158 // Locate the most recent update message for purpose of alteration.
150 sync_pb::SyncEntity* GetMutableLastUpdate(); 159 sync_pb::SyncEntity* GetMutableLastUpdate();
151 160
152 // Determine if one entry in a commit should be rejected with a conflict. 161 // Determine if one entry in a commit should be rejected with a conflict.
153 bool ShouldConflictThisCommit(); 162 bool ShouldConflictThisCommit();
154 163
155 // Generate a numeric position_in_parent value. We use a global counter 164 // Generate a numeric position_in_parent value. We use a global counter
156 // that only decreases; this simulates new objects always being added to the 165 // that only decreases; this simulates new objects always being added to the
(...skipping 26 matching lines...) Expand all
183 192
184 // Our directory. 193 // Our directory.
185 syncable::DirectoryManager* directory_manager_; 194 syncable::DirectoryManager* directory_manager_;
186 PathString directory_name_; 195 PathString directory_name_;
187 196
188 // The updates we'll return to the next request. 197 // The updates we'll return to the next request.
189 sync_pb::GetUpdatesResponse updates_; 198 sync_pb::GetUpdatesResponse updates_;
190 TestCallbackFunction mid_commit_callback_function_; 199 TestCallbackFunction mid_commit_callback_function_;
191 MidCommitObserver* mid_commit_observer_; 200 MidCommitObserver* mid_commit_observer_;
192 201
202 // The AUTHENTICATE response we'll return for auth requests.
203 sync_pb::AuthenticateResponse auth_response_;
204 // What we use to determine if we should return SUCCESS or BAD_AUTH_TOKEN.
205 std::string valid_auth_token_;
206
193 scoped_ptr<sync_pb::ClientCommand> client_command_; 207 scoped_ptr<sync_pb::ClientCommand> client_command_;
194 208
195 // The next value to use for the position_in_parent property. 209 // The next value to use for the position_in_parent property.
196 int64 next_position_in_parent_; 210 int64 next_position_in_parent_;
197 211
198 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); 212 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager);
199 }; 213 };
200 214
201 #endif // CHROME_TEST_SYNC_ENGINE_MOCK_SERVER_CONNECTION_H_ 215 #endif // CHROME_TEST_SYNC_ENGINE_MOCK_SERVER_CONNECTION_H_
OLDNEW
« no previous file with comments | « chrome/chrome.gyp ('k') | chrome/test/sync/engine/mock_server_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698