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

Side by Side Diff: sync/engine/syncer_proto_util_unittest.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/engine/syncer_proto_util.cc ('k') | sync/engine/syncer_types.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 #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 10 matching lines...) Expand all
21 #include "sync/sessions/sync_session_context.h" 21 #include "sync/sessions/sync_session_context.h"
22 #include "sync/syncable/blob.h" 22 #include "sync/syncable/blob.h"
23 #include "sync/syncable/directory.h" 23 #include "sync/syncable/directory.h"
24 #include "sync/test/engine/mock_connection_manager.h" 24 #include "sync/test/engine/mock_connection_manager.h"
25 #include "sync/test/engine/test_directory_setter_upper.h" 25 #include "sync/test/engine/test_directory_setter_upper.h"
26 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
27 27
28 using syncable::Blob; 28 using syncable::Blob;
29 using ::testing::_; 29 using ::testing::_;
30 30
31 namespace csync { 31 namespace syncer {
32 using sessions::SyncSessionContext; 32 using sessions::SyncSessionContext;
33 33
34 class MockDelegate : public sessions::SyncSession::Delegate { 34 class MockDelegate : public sessions::SyncSession::Delegate {
35 public: 35 public:
36 MockDelegate() {} 36 MockDelegate() {}
37 ~MockDelegate() {} 37 ~MockDelegate() {}
38 38
39 MOCK_METHOD0(IsSyncingCurrentlySilenced, bool()); 39 MOCK_METHOD0(IsSyncingCurrentlySilenced, bool());
40 MOCK_METHOD1(OnReceivedShortPollIntervalUpdate, void(const base::TimeDelta&)); 40 MOCK_METHOD1(OnReceivedShortPollIntervalUpdate, void(const base::TimeDelta&));
41 MOCK_METHOD1(OnReceivedLongPollIntervalUpdate ,void(const base::TimeDelta&)); 41 MOCK_METHOD1(OnReceivedLongPollIntervalUpdate ,void(const base::TimeDelta&));
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 EXPECT_TRUE(directory()->store_birthday().empty()); 196 EXPECT_TRUE(directory()->store_birthday().empty());
197 ClientToServerMessage msg; 197 ClientToServerMessage msg;
198 SyncerProtoUtil::AddRequestBirthday(directory(), &msg); 198 SyncerProtoUtil::AddRequestBirthday(directory(), &msg);
199 EXPECT_FALSE(msg.has_store_birthday()); 199 EXPECT_FALSE(msg.has_store_birthday());
200 200
201 directory()->set_store_birthday("meat"); 201 directory()->set_store_birthday("meat");
202 SyncerProtoUtil::AddRequestBirthday(directory(), &msg); 202 SyncerProtoUtil::AddRequestBirthday(directory(), &msg);
203 EXPECT_EQ(msg.store_birthday(), "meat"); 203 EXPECT_EQ(msg.store_birthday(), "meat");
204 } 204 }
205 205
206 class DummyConnectionManager : public csync::ServerConnectionManager { 206 class DummyConnectionManager : public syncer::ServerConnectionManager {
207 public: 207 public:
208 DummyConnectionManager() 208 DummyConnectionManager()
209 : ServerConnectionManager("unused", 0, false), 209 : ServerConnectionManager("unused", 0, false),
210 send_error_(false), 210 send_error_(false),
211 access_denied_(false) {} 211 access_denied_(false) {}
212 212
213 virtual ~DummyConnectionManager() {} 213 virtual ~DummyConnectionManager() {}
214 virtual bool PostBufferWithCachedAuth( 214 virtual bool PostBufferWithCachedAuth(
215 PostBufferParams* params, 215 PostBufferParams* params,
216 ScopedServerStatusWatcher* watcher) OVERRIDE { 216 ScopedServerStatusWatcher* watcher) OVERRIDE {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 msg, &response)); 256 msg, &response));
257 257
258 dcm.set_access_denied(true); 258 dcm.set_access_denied(true);
259 EXPECT_FALSE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL, 259 EXPECT_FALSE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL,
260 msg, &response)); 260 msg, &response));
261 } 261 }
262 262
263 TEST_F(SyncerProtoUtilTest, HandleThrottlingWithDatatypes) { 263 TEST_F(SyncerProtoUtilTest, HandleThrottlingWithDatatypes) {
264 ThrottledDataTypeTracker tracker(NULL); 264 ThrottledDataTypeTracker tracker(NULL);
265 SyncProtocolError error; 265 SyncProtocolError error;
266 error.error_type = csync::THROTTLED; 266 error.error_type = syncer::THROTTLED;
267 syncable::ModelTypeSet types; 267 syncable::ModelTypeSet types;
268 types.Put(syncable::BOOKMARKS); 268 types.Put(syncable::BOOKMARKS);
269 types.Put(syncable::PASSWORDS); 269 types.Put(syncable::PASSWORDS);
270 error.error_data_types = types; 270 error.error_data_types = types;
271 271
272 base::TimeTicks ticks = base::TimeTicks::FromInternalValue(1); 272 base::TimeTicks ticks = base::TimeTicks::FromInternalValue(1);
273 SyncerProtoUtil::HandleThrottleError(error, ticks, &tracker, NULL); 273 SyncerProtoUtil::HandleThrottleError(error, ticks, &tracker, NULL);
274 EXPECT_TRUE(tracker.GetThrottledTypes().Equals(types)); 274 EXPECT_TRUE(tracker.GetThrottledTypes().Equals(types));
275 } 275 }
276 276
277 TEST_F(SyncerProtoUtilTest, HandleThrottlingNoDatatypes) { 277 TEST_F(SyncerProtoUtilTest, HandleThrottlingNoDatatypes) {
278 ThrottledDataTypeTracker tracker(NULL); 278 ThrottledDataTypeTracker tracker(NULL);
279 MockDelegate delegate; 279 MockDelegate delegate;
280 SyncProtocolError error; 280 SyncProtocolError error;
281 error.error_type = csync::THROTTLED; 281 error.error_type = syncer::THROTTLED;
282 282
283 base::TimeTicks ticks = base::TimeTicks::FromInternalValue(1); 283 base::TimeTicks ticks = base::TimeTicks::FromInternalValue(1);
284 284
285 EXPECT_CALL(delegate, OnSilencedUntil(ticks)); 285 EXPECT_CALL(delegate, OnSilencedUntil(ticks));
286 286
287 SyncerProtoUtil::HandleThrottleError(error, ticks, &tracker, &delegate); 287 SyncerProtoUtil::HandleThrottleError(error, ticks, &tracker, &delegate);
288 EXPECT_TRUE(tracker.GetThrottledTypes().Empty()); 288 EXPECT_TRUE(tracker.GetThrottledTypes().Empty());
289 } 289 }
290 } // namespace csync 290 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/syncer_proto_util.cc ('k') | sync/engine/syncer_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698