summaryrefslogtreecommitdiffstats
path: root/sync/sessions/sync_session_unittest.cc
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-14 19:45:30 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-14 19:45:30 +0000
commitd9d8f9f150646e0adcb2948097cea99f89db41c4 (patch)
tree77437a172d1a057e8c465b20ec8ef517187dddde /sync/sessions/sync_session_unittest.cc
parent3c6de13983e12c3506fd53502fc92075b2595136 (diff)
downloadchromium_src-d9d8f9f150646e0adcb2948097cea99f89db41c4.zip
chromium_src-d9d8f9f150646e0adcb2948097cea99f89db41c4.tar.gz
chromium_src-d9d8f9f150646e0adcb2948097cea99f89db41c4.tar.bz2
sync: Handle type throttling in NudgeTracker
This change removes the ThrottledDataTypeTracker and moves much of its functionality into the NudgeTracker. This allows us to better control throttling behavior and fix crbug.com/155296. This CL re-routes syncer_proto_util type throttling callbacks through the SyncSession::Delegate to the SyncScheduler. It adds a timer and some related functions to the SyncScheduler, so the scheduler can now wake up, unthrottle types, and attempt a sync cycle at the exact time when throttling expires. The information about which types are currently throttled has been moved to the NudgeTracker. This allows the NudgeTracker to take type throttling into account in functions like NudgeTracker::IsSyncRequired() and NudgeTracker::RecordSuccessfulSyncCycle(). The DownloadUpdatesCommand's special case for nudge-type syncs has been extended to take throttling into account. GetCommitIdsCommand has been updated to fetch its list of throttled types from the nudge tracker. Unfortunately, this meant that committing from poll-triggered sync sessions had to be disabled, since poll sync cycles do not have access to the nudge tracker. BUG=155296, 116184 Review URL: https://chromiumcodereview.appspot.com/16402013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206475 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/sessions/sync_session_unittest.cc')
-rw-r--r--sync/sessions/sync_session_unittest.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/sync/sessions/sync_session_unittest.cc b/sync/sessions/sync_session_unittest.cc
index 861abbe..5de32e2 100644
--- a/sync/sessions/sync_session_unittest.cc
+++ b/sync/sessions/sync_session_unittest.cc
@@ -9,7 +9,6 @@
#include "base/memory/ref_counted.h"
#include "base/message_loop.h"
#include "sync/engine/syncer_types.h"
-#include "sync/engine/throttled_data_type_tracker.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/base/model_type_invalidation_map_test_util.h"
#include "sync/sessions/status_controller.h"
@@ -62,7 +61,6 @@ class SyncSessionTest : public testing::Test,
NULL,
workers,
&extensions_activity_monitor_,
- throttled_data_type_tracker_.get(),
std::vector<SyncEngineEventListener*>(),
NULL,
NULL,
@@ -71,17 +69,21 @@ class SyncSessionTest : public testing::Test,
context_->set_routing_info(routes_);
session_.reset(MakeSession());
- throttled_data_type_tracker_.reset(new ThrottledDataTypeTracker(NULL));
}
virtual void TearDown() {
session_.reset();
context_.reset();
}
- virtual void OnSilencedUntil(const base::TimeTicks& silenced_until) OVERRIDE {
- FailControllerInvocationIfDisabled("OnSilencedUntil");
+ virtual void OnThrottled(const base::TimeDelta& throttle_duration) OVERRIDE {
+ FailControllerInvocationIfDisabled("OnThrottled");
}
- virtual bool IsSyncingCurrentlySilenced() OVERRIDE {
+ virtual void OnTypesThrottled(
+ ModelTypeSet types,
+ const base::TimeDelta& throttle_duration) OVERRIDE {
+ FailControllerInvocationIfDisabled("OnTypesThrottled");
+ }
+ virtual bool IsCurrentlyThrottled() OVERRIDE {
FailControllerInvocationIfDisabled("IsSyncingCurrentlySilenced");
return false;
}
@@ -144,7 +146,6 @@ class SyncSessionTest : public testing::Test,
std::vector<scoped_refptr<ModelSafeWorker> > workers_;
ModelSafeRoutingInfo routes_;
FakeExtensionsActivityMonitor extensions_activity_monitor_;
- scoped_ptr<ThrottledDataTypeTracker> throttled_data_type_tracker_;
};
TEST_F(SyncSessionTest, MoreToDownloadIfDownloadFailed) {