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

Side by Side Diff: chrome/browser/sync/engine/syncer_proto_util_unittest.cc

Issue 8919021: [Sync] Rename ModelEnumSet to ModelTypeSet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/syncer_proto_util.h" 5 #include "chrome/browser/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 18 matching lines...) Expand all
29 using syncable::ScopedDirLookup; 29 using syncable::ScopedDirLookup;
30 using ::testing::_; 30 using ::testing::_;
31 31
32 namespace browser_sync { 32 namespace browser_sync {
33 using sessions::SyncSessionContext; 33 using sessions::SyncSessionContext;
34 34
35 class MockSyncSessionContext : public SyncSessionContext { 35 class MockSyncSessionContext : public SyncSessionContext {
36 public: 36 public:
37 MockSyncSessionContext() {} 37 MockSyncSessionContext() {}
38 ~MockSyncSessionContext() {} 38 ~MockSyncSessionContext() {}
39 MOCK_METHOD2(SetUnthrottleTime, void(syncable::ModelEnumSet, 39 MOCK_METHOD2(SetUnthrottleTime, void(syncable::ModelTypeSet,
40 const base::TimeTicks&)); 40 const base::TimeTicks&));
41 }; 41 };
42 42
43 class MockDelegate : public sessions::SyncSession::Delegate { 43 class MockDelegate : public sessions::SyncSession::Delegate {
44 public: 44 public:
45 MockDelegate() {} 45 MockDelegate() {}
46 ~MockDelegate() {} 46 ~MockDelegate() {}
47 47
48 MOCK_METHOD0(IsSyncingCurrentlySilenced, bool()); 48 MOCK_METHOD0(IsSyncingCurrentlySilenced, bool());
49 MOCK_METHOD1(OnReceivedShortPollIntervalUpdate, void(const base::TimeDelta&)); 49 MOCK_METHOD1(OnReceivedShortPollIntervalUpdate, void(const base::TimeDelta&));
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 dcm.set_access_denied(true); 269 dcm.set_access_denied(true);
270 EXPECT_FALSE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL, 270 EXPECT_FALSE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL,
271 msg, &response)); 271 msg, &response));
272 } 272 }
273 273
274 TEST_F(SyncerProtoUtilTest, HandleThrottlingWithDatatypes) { 274 TEST_F(SyncerProtoUtilTest, HandleThrottlingWithDatatypes) {
275 MockSyncSessionContext context; 275 MockSyncSessionContext context;
276 SyncProtocolError error; 276 SyncProtocolError error;
277 error.error_type = browser_sync::THROTTLED; 277 error.error_type = browser_sync::THROTTLED;
278 syncable::ModelEnumSet types; 278 syncable::ModelTypeSet types;
279 types.Put(syncable::BOOKMARKS); 279 types.Put(syncable::BOOKMARKS);
280 types.Put(syncable::PASSWORDS); 280 types.Put(syncable::PASSWORDS);
281 error.error_data_types = types; 281 error.error_data_types = types;
282 282
283 base::TimeTicks ticks = base::TimeTicks::Now(); 283 base::TimeTicks ticks = base::TimeTicks::Now();
284 284
285 EXPECT_CALL(context, SetUnthrottleTime(HasModelTypes(types), ticks)); 285 EXPECT_CALL(context, SetUnthrottleTime(HasModelTypes(types), ticks));
286 286
287 SyncerProtoUtil::HandleThrottleError(error, ticks, &context, NULL); 287 SyncerProtoUtil::HandleThrottleError(error, ticks, &context, NULL);
288 } 288 }
289 289
290 TEST_F(SyncerProtoUtilTest, HandleThrottlingNoDatatypes) { 290 TEST_F(SyncerProtoUtilTest, HandleThrottlingNoDatatypes) {
291 MockDelegate delegate; 291 MockDelegate delegate;
292 SyncProtocolError error; 292 SyncProtocolError error;
293 error.error_type = browser_sync::THROTTLED; 293 error.error_type = browser_sync::THROTTLED;
294 294
295 base::TimeTicks ticks = base::TimeTicks::Now(); 295 base::TimeTicks ticks = base::TimeTicks::Now();
296 296
297 EXPECT_CALL(delegate, OnSilencedUntil(ticks)); 297 EXPECT_CALL(delegate, OnSilencedUntil(ticks));
298 298
299 SyncerProtoUtil::HandleThrottleError(error, ticks, NULL, &delegate); 299 SyncerProtoUtil::HandleThrottleError(error, ticks, NULL, &delegate);
300 } 300 }
301 } // namespace browser_sync 301 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_proto_util.cc ('k') | chrome/browser/sync/engine/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698