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

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

Issue 10735041: Remove syncproto.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address most 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/syncable/syncable_unittest.cc ('k') | no next file » | 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 std::map; 20 using std::map;
21 using std::string; 21 using std::string;
22 using sync_pb::ClientToServerMessage;
22 using sync_pb::CommitMessage; 23 using sync_pb::CommitMessage;
23 using sync_pb::CommitResponse; 24 using sync_pb::CommitResponse;
24 using sync_pb::GetUpdatesMessage; 25 using sync_pb::GetUpdatesMessage;
25 using sync_pb::SyncEnums; 26 using sync_pb::SyncEnums;
26 27
27 namespace syncer { 28 namespace syncer {
28 29
29 using syncable::WriteTransaction; 30 using syncable::WriteTransaction;
30 31
31 static char kValidAuthToken[] = "AuthToken"; 32 static char kValidAuthToken[] = "AuthToken";
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 75
75 bool MockConnectionManager::PostBufferToPath(PostBufferParams* params, 76 bool MockConnectionManager::PostBufferToPath(PostBufferParams* params,
76 const string& path, 77 const string& path,
77 const string& auth_token, 78 const string& auth_token,
78 syncer::ScopedServerStatusWatcher* watcher) { 79 syncer::ScopedServerStatusWatcher* watcher) {
79 ClientToServerMessage post; 80 ClientToServerMessage post;
80 CHECK(post.ParseFromString(params->buffer_in)); 81 CHECK(post.ParseFromString(params->buffer_in));
81 CHECK(post.has_protocol_version()); 82 CHECK(post.has_protocol_version());
82 last_request_.CopyFrom(post); 83 last_request_.CopyFrom(post);
83 client_stuck_ = post.sync_problem_detected(); 84 client_stuck_ = post.sync_problem_detected();
84 ClientToServerResponse response; 85 sync_pb::ClientToServerResponse response;
85 response.Clear(); 86 response.Clear();
86 87
87 if (directory_) { 88 if (directory_) {
88 // If the Directory's locked when we do this, it's a problem as in normal 89 // If the Directory's locked when we do this, it's a problem as in normal
89 // use this function could take a while to return because it accesses the 90 // use this function could take a while to return because it accesses the
90 // network. As we can't test this we do the next best thing and hang here 91 // network. As we can't test this we do the next best thing and hang here
91 // when there's an issue. 92 // when there's an issue.
92 CHECK(directory_->good()); 93 CHECK(directory_->good());
93 WriteTransaction wt(FROM_HERE, syncable::UNITTEST, directory_); 94 WriteTransaction wt(FROM_HERE, syncable::UNITTEST, directory_);
94 } 95 }
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 589
589 void MockConnectionManager::UpdateConnectionStatus() { 590 void MockConnectionManager::UpdateConnectionStatus() {
590 if (!server_reachable_) { 591 if (!server_reachable_) {
591 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; 592 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE;
592 } else { 593 } else {
593 server_status_ = HttpResponse::SERVER_CONNECTION_OK; 594 server_status_ = HttpResponse::SERVER_CONNECTION_OK;
594 } 595 }
595 } 596 }
596 597
597 } // namespace syncer 598 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/syncable_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698