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

Side by Side Diff: sync/test/engine/mock_connection_manager.cc

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 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.h ('k') | sync/test/engine/syncer_command_test.h » ('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 // Mock ServerConnectionManager class for use in client regression tests. 5 // Mock ServerConnectionManager class for use in client regression tests.
6 6
7 #include "sync/test/engine/mock_connection_manager.h" 7 #include "sync/test/engine/mock_connection_manager.h"
8 8
9 #include <map> 9 #include <map>
10 10
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "sync/engine/syncer_proto_util.h" 13 #include "sync/engine/syncer_proto_util.h"
14 #include "sync/protocol/bookmark_specifics.pb.h" 14 #include "sync/protocol/bookmark_specifics.pb.h"
15 #include "sync/syncable/directory.h" 15 #include "sync/syncable/directory.h"
16 #include "sync/syncable/write_transaction.h" 16 #include "sync/syncable/write_transaction.h"
17 #include "sync/test/engine/test_id_factory.h" 17 #include "sync/test/engine/test_id_factory.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 using csync::HttpResponse; 20 using syncer::HttpResponse;
21 using csync::ServerConnectionManager; 21 using syncer::ServerConnectionManager;
22 using csync::ServerConnectionEventListener; 22 using syncer::ServerConnectionEventListener;
23 using csync::ServerConnectionEvent; 23 using syncer::ServerConnectionEvent;
24 using csync::SyncerProtoUtil; 24 using syncer::SyncerProtoUtil;
25 using csync::TestIdFactory; 25 using syncer::TestIdFactory;
26 using std::map; 26 using std::map;
27 using std::string; 27 using std::string;
28 using sync_pb::ClientToServerMessage; 28 using sync_pb::ClientToServerMessage;
29 using sync_pb::ClientToServerResponse; 29 using sync_pb::ClientToServerResponse;
30 using sync_pb::CommitMessage; 30 using sync_pb::CommitMessage;
31 using sync_pb::CommitResponse; 31 using sync_pb::CommitResponse;
32 using sync_pb::CommitResponse_EntryResponse; 32 using sync_pb::CommitResponse_EntryResponse;
33 using sync_pb::GetUpdatesMessage; 33 using sync_pb::GetUpdatesMessage;
34 using sync_pb::SyncEnums; 34 using sync_pb::SyncEnums;
35 using sync_pb::SyncEntity; 35 using sync_pb::SyncEntity;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 void MockConnectionManager::SetMidCommitObserver( 80 void MockConnectionManager::SetMidCommitObserver(
81 MockConnectionManager::MidCommitObserver* observer) { 81 MockConnectionManager::MidCommitObserver* observer) {
82 mid_commit_observer_ = observer; 82 mid_commit_observer_ = observer;
83 } 83 }
84 84
85 bool MockConnectionManager::PostBufferToPath(PostBufferParams* params, 85 bool MockConnectionManager::PostBufferToPath(PostBufferParams* params,
86 const string& path, 86 const string& path,
87 const string& auth_token, 87 const string& auth_token,
88 csync::ScopedServerStatusWatcher* watcher) { 88 syncer::ScopedServerStatusWatcher* watcher) {
89 ClientToServerMessage post; 89 ClientToServerMessage post;
90 CHECK(post.ParseFromString(params->buffer_in)); 90 CHECK(post.ParseFromString(params->buffer_in));
91 CHECK(post.has_protocol_version()); 91 CHECK(post.has_protocol_version());
92 last_request_.CopyFrom(post); 92 last_request_.CopyFrom(post);
93 client_stuck_ = post.sync_problem_detected(); 93 client_stuck_ = post.sync_problem_detected();
94 ClientToServerResponse response; 94 ClientToServerResponse response;
95 response.Clear(); 95 response.Clear();
96 96
97 if (directory_) { 97 if (directory_) {
98 // If the Directory's locked when we do this, it's a problem as in normal 98 // If the Directory's locked when we do this, it's a problem as in normal
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 server_reachable_ = false; 587 server_reachable_ = false;
588 } 588 }
589 589
590 void MockConnectionManager::UpdateConnectionStatus() { 590 void MockConnectionManager::UpdateConnectionStatus() {
591 if (!server_reachable_) { 591 if (!server_reachable_) {
592 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; 592 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE;
593 } else { 593 } else {
594 server_status_ = HttpResponse::SERVER_CONNECTION_OK; 594 server_status_ = HttpResponse::SERVER_CONNECTION_OK;
595 } 595 }
596 } 596 }
OLDNEW
« no previous file with comments | « sync/test/engine/mock_connection_manager.h ('k') | sync/test/engine/syncer_command_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698