| Index: chrome/test/sync/engine/mock_server_connection.cc
|
| ===================================================================
|
| --- chrome/test/sync/engine/mock_server_connection.cc (revision 27087)
|
| +++ chrome/test/sync/engine/mock_server_connection.cc (working copy)
|
| @@ -25,6 +25,7 @@
|
| using sync_pb::GetUpdatesMessage;
|
| using sync_pb::SyncEntity;
|
| using syncable::DirectoryManager;
|
| +using syncable::ScopedDirLookup;
|
| using syncable::WriteTransaction;
|
|
|
| MockConnectionManager::MockConnectionManager(DirectoryManager* dirmgr,
|
| @@ -38,12 +39,13 @@
|
| client_stuck_(false),
|
| commit_time_rename_prepended_string_(""),
|
| fail_next_postbuffer_(false),
|
| - directory_(dirmgr, name),
|
| + directory_manager_(dirmgr),
|
| + directory_name_(name),
|
| mid_commit_callback_function_(NULL),
|
| + mid_commit_observer_(NULL),
|
| client_command_(NULL),
|
| next_position_in_parent_(2) {
|
| server_reachable_ = true;
|
| - CHECK(directory_.good());
|
| };
|
|
|
| MockConnectionManager::~MockConnectionManager() {
|
| @@ -60,9 +62,18 @@
|
| mid_commit_callback_function_ = callback;
|
| }
|
|
|
| +void MockConnectionManager::SetMidCommitObserver(
|
| + MockConnectionManager::MidCommitObserver* observer) {
|
| + mid_commit_observer_ = observer;
|
| +}
|
| +
|
| bool MockConnectionManager::PostBufferToPath(const PostBufferParams* params,
|
| const string& path,
|
| const string& auth_token) {
|
| +
|
| + ScopedDirLookup directory(directory_manager_, directory_name_);
|
| + CHECK(directory.good());
|
| +
|
| ClientToServerMessage post;
|
| CHECK(post.ParseFromString(params->buffer_in));
|
| client_stuck_ = post.sync_problem_detected();
|
| @@ -73,7 +84,7 @@
|
| // network. As we can't test this we do the next best thing and hang here
|
| // when there's an issue.
|
| {
|
| - WriteTransaction wt(directory_, syncable::UNITTEST, __FILE__, __LINE__);
|
| + WriteTransaction wt(directory, syncable::UNITTEST, __FILE__, __LINE__);
|
| }
|
| if (fail_next_postbuffer_) {
|
| fail_next_postbuffer_ = false;
|
| @@ -105,9 +116,12 @@
|
| }
|
| response.SerializeToString(params->buffer_out);
|
| if (mid_commit_callback_function_) {
|
| - if (mid_commit_callback_function_(directory_))
|
| + if (mid_commit_callback_function_(directory))
|
| mid_commit_callback_function_ = 0;
|
| }
|
| + if (mid_commit_observer_) {
|
| + mid_commit_observer_->Observe();
|
| + }
|
| return result;
|
| }
|
|
|
|
|