OLD | NEW |
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 #include "sync/engine/syncer_proto_util.h" | 5 #include "sync/engine/syncer_proto_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 class DummyConnectionManager : public ServerConnectionManager { | 253 class DummyConnectionManager : public ServerConnectionManager { |
254 public: | 254 public: |
255 DummyConnectionManager(CancelationSignal* signal) | 255 DummyConnectionManager(CancelationSignal* signal) |
256 : ServerConnectionManager("unused", 0, false, signal), | 256 : ServerConnectionManager("unused", 0, false, signal), |
257 send_error_(false), | 257 send_error_(false), |
258 access_denied_(false) {} | 258 access_denied_(false) {} |
259 | 259 |
260 virtual ~DummyConnectionManager() {} | 260 virtual ~DummyConnectionManager() {} |
261 virtual bool PostBufferWithCachedAuth( | 261 virtual bool PostBufferWithCachedAuth( |
262 PostBufferParams* params, | 262 PostBufferParams* params, |
263 ScopedServerStatusWatcher* watcher) OVERRIDE { | 263 ScopedServerStatusWatcher* watcher) override { |
264 if (send_error_) { | 264 if (send_error_) { |
265 return false; | 265 return false; |
266 } | 266 } |
267 | 267 |
268 sync_pb::ClientToServerResponse response; | 268 sync_pb::ClientToServerResponse response; |
269 if (access_denied_) { | 269 if (access_denied_) { |
270 response.set_error_code(sync_pb::SyncEnums::ACCESS_DENIED); | 270 response.set_error_code(sync_pb::SyncEnums::ACCESS_DENIED); |
271 } | 271 } |
272 response.SerializeToString(¶ms->buffer_out); | 272 response.SerializeToString(¶ms->buffer_out); |
273 | 273 |
(...skipping 29 matching lines...) Expand all Loading... |
303 dcm.set_send_error(false); | 303 dcm.set_send_error(false); |
304 EXPECT_TRUE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL, | 304 EXPECT_TRUE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL, |
305 msg, &response)); | 305 msg, &response)); |
306 | 306 |
307 dcm.set_access_denied(true); | 307 dcm.set_access_denied(true); |
308 EXPECT_FALSE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL, | 308 EXPECT_FALSE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL, |
309 msg, &response)); | 309 msg, &response)); |
310 } | 310 } |
311 | 311 |
312 } // namespace syncer | 312 } // namespace syncer |
OLD | NEW |