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

Unified Diff: sync/engine/sync_scheduler_unittest.cc

Issue 10455012: [Sync] Add support for performing a GetKey on startup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move GetEncryptionKey logic into GetUpdates 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 side-by-side diff with in-line comments
Download patch
Index: sync/engine/sync_scheduler_unittest.cc
diff --git a/sync/engine/sync_scheduler_unittest.cc b/sync/engine/sync_scheduler_unittest.cc
index acac5db1bf64a2aa315b9c5394170f93a063b050..46cbff0658ed854f327ab9c05d2a3c2d30c84fae 100644
--- a/sync/engine/sync_scheduler_unittest.cc
+++ b/sync/engine/sync_scheduler_unittest.cc
@@ -120,7 +120,8 @@ class SyncSchedulerTest : public testing::Test {
context_.reset(new SyncSessionContext(
connection_.get(), directory(), routing_info, workers,
&extensions_activity_monitor_, throttled_data_type_tracker_.get(),
- std::vector<SyncEngineEventListener*>(), NULL, NULL));
+ std::vector<SyncEngineEventListener*>(), NULL, NULL,
+ true /* enable keystore encryption */));
context_->set_notifications_enabled(true);
context_->set_account_name("Test");
scheduler_.reset(
@@ -311,7 +312,6 @@ TEST_F(SyncSchedulerTest, Config) {
GetUpdatesCallerInfo::RECONFIGURATION,
model_types,
TypesToRoutingInfo(model_types),
- ConfigurationParams::KEYSTORE_KEY_UNNECESSARY,
base::Bind(&CallbackCounter::Callback, base::Unretained(&counter)));
ASSERT_TRUE(scheduler()->ScheduleConfiguration(params));
ASSERT_EQ(1, counter.times_called());
@@ -345,7 +345,6 @@ TEST_F(SyncSchedulerTest, ConfigWithBackingOff) {
GetUpdatesCallerInfo::RECONFIGURATION,
model_types,
TypesToRoutingInfo(model_types),
- ConfigurationParams::KEYSTORE_KEY_UNNECESSARY,
base::Bind(&CallbackCounter::Callback, base::Unretained(&counter)));
ASSERT_FALSE(scheduler()->ScheduleConfiguration(params));
ASSERT_EQ(0, counter.times_called());
@@ -388,7 +387,6 @@ TEST_F(SyncSchedulerTest, NudgeWithConfigWithBackingOff) {
GetUpdatesCallerInfo::RECONFIGURATION,
model_types,
TypesToRoutingInfo(model_types),
- ConfigurationParams::KEYSTORE_KEY_UNNECESSARY,
base::Bind(&CallbackCounter::Callback, base::Unretained(&counter)));
ASSERT_FALSE(scheduler()->ScheduleConfiguration(params));
ASSERT_EQ(0, counter.times_called());
@@ -734,7 +732,6 @@ TEST_F(SyncSchedulerTest, ThrottlingDoesThrottle) {
GetUpdatesCallerInfo::RECONFIGURATION,
types,
TypesToRoutingInfo(types),
- ConfigurationParams::KEYSTORE_KEY_UNNECESSARY,
base::Bind(&CallbackCounter::Callback, base::Unretained(&counter)));
ASSERT_FALSE(scheduler()->ScheduleConfiguration(params));
ASSERT_EQ(0, counter.times_called());
@@ -788,7 +785,6 @@ TEST_F(SyncSchedulerTest, ConfigurationMode) {
GetUpdatesCallerInfo::RECONFIGURATION,
config_types,
TypesToRoutingInfo(config_types),
- ConfigurationParams::KEYSTORE_KEY_UNNECESSARY,
base::Bind(&CallbackCounter::Callback, base::Unretained(&counter)));
ASSERT_TRUE(scheduler()->ScheduleConfiguration(params));
ASSERT_EQ(1, counter.times_called());
@@ -852,6 +848,17 @@ TEST_F(BackoffTriggersSyncSchedulerTest, FailDownloadTwice) {
EXPECT_TRUE(RunAndGetBackoff());
}
+// Have the syncer fail to get the encryption key yet succeed in downloading
+// updates. Expect this will leave the scheduler in backoff.
+TEST_F(BackoffTriggersSyncSchedulerTest, FailGetEncryptionKey) {
+ EXPECT_CALL(*syncer(), SyncShare(_,_,_))
+ .WillOnce(Invoke(sessions::test_util::SimulateGetEncryptionKeyFailed))
+ .WillRepeatedly(DoAll(
+ Invoke(sessions::test_util::SimulateGetEncryptionKeyFailed),
+ QuitLoopNowAction()));
+ EXPECT_TRUE(RunAndGetBackoff());
+}
+
// Test that no polls or extraneous nudges occur when in backoff.
TEST_F(SyncSchedulerTest, BackoffDropsJobs) {
SyncShareRecords r;
@@ -903,7 +910,6 @@ TEST_F(SyncSchedulerTest, BackoffDropsJobs) {
GetUpdatesCallerInfo::RECONFIGURATION,
types,
TypesToRoutingInfo(types),
- ConfigurationParams::KEYSTORE_KEY_UNNECESSARY,
base::Bind(&CallbackCounter::Callback, base::Unretained(&counter)));
ASSERT_FALSE(scheduler()->ScheduleConfiguration(params));
ASSERT_EQ(0, counter.times_called());
@@ -1076,7 +1082,6 @@ TEST_F(SyncSchedulerTest, SyncerSteps) {
GetUpdatesCallerInfo::RECONFIGURATION,
model_types,
TypesToRoutingInfo(model_types),
- ConfigurationParams::KEYSTORE_KEY_UNNECESSARY,
base::Bind(&CallbackCounter::Callback, base::Unretained(&counter)));
ASSERT_TRUE(scheduler()->ScheduleConfiguration(params));
ASSERT_EQ(1, counter.times_called());

Powered by Google App Engine
This is Rietveld 408576698