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

Unified Diff: sync/engine/syncer_proto_util_unittest.cc

Issue 10454105: sync: Refactor per-datatype throttling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up and rebased Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: sync/engine/syncer_proto_util_unittest.cc
diff --git a/sync/engine/syncer_proto_util_unittest.cc b/sync/engine/syncer_proto_util_unittest.cc
index d70a07b1dc82d8dd42ec82ee1c66fc50b05473a2..d673116b448c9d30e2b9f7ad7684664e7ea856cf 100644
--- a/sync/engine/syncer_proto_util_unittest.cc
+++ b/sync/engine/syncer_proto_util_unittest.cc
@@ -10,6 +10,7 @@
#include "base/compiler_specific.h"
#include "base/message_loop.h"
#include "base/time.h"
+#include "sync/engine/throttled_data_type_tracker.h"
#include "sync/engine/syncproto.h"
#include "sync/sessions/session_state.h"
#include "sync/sessions/sync_session_context.h"
@@ -31,14 +32,6 @@ using ::testing::_;
namespace browser_sync {
using sessions::SyncSessionContext;
-class MockSyncSessionContext : public SyncSessionContext {
- public:
- MockSyncSessionContext() {}
- ~MockSyncSessionContext() {}
- MOCK_METHOD2(SetUnthrottleTime, void(syncable::ModelTypeSet,
- const base::TimeTicks&));
-};
-
class MockDelegate : public sessions::SyncSession::Delegate {
public:
MockDelegate() {}
@@ -269,7 +262,7 @@ TEST_F(SyncerProtoUtilTest, PostAndProcessHeaders) {
}
TEST_F(SyncerProtoUtilTest, HandleThrottlingWithDatatypes) {
- MockSyncSessionContext context;
+ ThrottledDataTypeTracker tdtt;
SyncProtocolError error;
error.error_type = browser_sync::THROTTLED;
syncable::ModelTypeSet types;
@@ -277,11 +270,9 @@ TEST_F(SyncerProtoUtilTest, HandleThrottlingWithDatatypes) {
types.Put(syncable::PASSWORDS);
error.error_data_types = types;
- base::TimeTicks ticks = base::TimeTicks::Now();
-
- EXPECT_CALL(context, SetUnthrottleTime(HasModelTypes(types), ticks));
-
- SyncerProtoUtil::HandleThrottleError(error, ticks, &context, NULL);
+ base::TimeTicks ticks = base::TimeTicks::FromInternalValue(1);
+ SyncerProtoUtil::HandleThrottleError(error, ticks, &tdtt, NULL);
+ EXPECT_TRUE(tdtt.GetThrottledTypes().Equals(types));
}
TEST_F(SyncerProtoUtilTest, HandleThrottlingNoDatatypes) {
@@ -289,7 +280,7 @@ TEST_F(SyncerProtoUtilTest, HandleThrottlingNoDatatypes) {
SyncProtocolError error;
error.error_type = browser_sync::THROTTLED;
- base::TimeTicks ticks = base::TimeTicks::Now();
+ base::TimeTicks ticks = base::TimeTicks::FromInternalValue(1);
EXPECT_CALL(delegate, OnSilencedUntil(ticks));

Powered by Google App Engine
This is Rietveld 408576698