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

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

Issue 8851006: [Sync] Replace all instances of ModelTypeSet with ModelEnumSet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup pass #2 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"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/time.h" 12 #include "base/time.h"
13 #include "chrome/browser/sync/engine/syncproto.h" 13 #include "chrome/browser/sync/engine/syncproto.h"
14 #include "chrome/browser/sync/sessions/session_state.h" 14 #include "chrome/browser/sync/sessions/session_state.h"
15 #include "chrome/browser/sync/sessions/sync_session_context.h" 15 #include "chrome/browser/sync/sessions/sync_session_context.h"
16 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" 16 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h"
17 #include "chrome/browser/sync/protocol/password_specifics.pb.h" 17 #include "chrome/browser/sync/protocol/password_specifics.pb.h"
18 #include "chrome/browser/sync/protocol/sync.pb.h" 18 #include "chrome/browser/sync/protocol/sync.pb.h"
19 #include "chrome/browser/sync/syncable/blob.h" 19 #include "chrome/browser/sync/syncable/blob.h"
20 #include "chrome/browser/sync/syncable/directory_manager.h" 20 #include "chrome/browser/sync/syncable/directory_manager.h"
21 #include "chrome/browser/sync/syncable/model_type_test_util.h"
21 #include "chrome/browser/sync/syncable/syncable.h" 22 #include "chrome/browser/sync/syncable/syncable.h"
22 #include "chrome/browser/sync/test/engine/mock_connection_manager.h" 23 #include "chrome/browser/sync/test/engine/mock_connection_manager.h"
23 #include "chrome/browser/sync/test/engine/test_directory_setter_upper.h" 24 #include "chrome/browser/sync/test/engine/test_directory_setter_upper.h"
24 25
25 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
26 27
27 using syncable::Blob; 28 using syncable::Blob;
28 using syncable::ScopedDirLookup; 29 using syncable::ScopedDirLookup;
29 using syncable::ModelTypeSet;
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(const ModelTypeSet&, 39 MOCK_METHOD2(SetUnthrottleTime, void(syncable::ModelEnumSet,
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::ModelTypeSet types; 278 syncable::ModelEnumSet types;
279 types.insert(syncable::BOOKMARKS); 279 types.Put(syncable::BOOKMARKS);
280 types.insert(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(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