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

Unified Diff: chrome/browser/sync/startup_controller_unittest.cc

Issue 183563004: sync: reland deferred init (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: override timeout Created 6 years, 9 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: chrome/browser/sync/startup_controller_unittest.cc
diff --git a/chrome/browser/sync/startup_controller_unittest.cc b/chrome/browser/sync/startup_controller_unittest.cc
index 16331baddc98bb85f1e3614f5ec77243cc25a1b7..3aa1e2e94788da99d3dbfb040e0ade0e75e005f6 100644
--- a/chrome/browser/sync/startup_controller_unittest.cc
+++ b/chrome/browser/sync/startup_controller_unittest.cc
@@ -86,15 +86,6 @@ class StartupControllerTest : public testing::Test {
started_ = true;
}
- void ForceDeferredStartup() {
- if (!CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kSyncEnableDeferredStartup)) {
- CommandLine::ForCurrentProcess()->
- AppendSwitch(switches::kSyncEnableDeferredStartup);
- controller_->Reset(syncer::UserTypes());
- }
- }
-
bool started() const { return started_; }
void clear_started() { started_ = false; }
StartupController* controller() { return controller_.get(); }
@@ -127,8 +118,8 @@ TEST_F(StartupControllerTest, Basic) {
controller()->TryStart();
EXPECT_FALSE(started());
token_service()->IssueRefreshTokenForUser(kTestUser, kTestToken);
- const bool deferred_start = CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kSyncEnableDeferredStartup);
+ const bool deferred_start = !CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kSyncDisableDeferredStartup);
controller()->TryStart();
EXPECT_EQ(!deferred_start, started());
std::string state(controller()->GetBackendInitializationStateString());
@@ -163,7 +154,6 @@ TEST_F(StartupControllerTest, Managed) {
// Test that sync doesn't start until all conditions are met and a
// data type triggers sync startup.
TEST_F(StartupControllerTest, DataTypeTriggered) {
- ForceDeferredStartup();
sync_prefs()->SetSyncSetupCompleted();
signin()->set_account(kTestUser);
token_service()->IssueRefreshTokenForUser(kTestUser, kTestToken);
@@ -186,7 +176,6 @@ TEST_F(StartupControllerTest, DataTypeTriggered) {
// Test that the fallback timer starts sync in the event all
// conditions are met and no data type requests sync.
TEST_F(StartupControllerTest, FallbackTimer) {
- ForceDeferredStartup();
sync_prefs()->SetSyncSetupCompleted();
signin()->set_account(kTestUser);
token_service()->IssueRefreshTokenForUser(kTestUser, kTestToken);
@@ -206,8 +195,6 @@ TEST_F(StartupControllerTest, NoDeferralWithoutSessionsSync) {
types.Remove(syncer::MANAGED_USER_SETTINGS);
sync_prefs()->SetKeepEverythingSynced(false);
sync_prefs()->SetPreferredDataTypes(syncer::UserTypes(), types);
- CommandLine::ForCurrentProcess()->AppendSwitch(
- switches::kSyncEnableDeferredStartup);
controller()->Reset(syncer::UserTypes());
sync_prefs()->SetSyncSetupCompleted();
signin()->set_account(kTestUser);
@@ -219,7 +206,6 @@ TEST_F(StartupControllerTest, NoDeferralWithoutSessionsSync) {
// Sanity check that the fallback timer doesn't fire before startup
// conditions are met.
TEST_F(StartupControllerTest, FallbackTimerWaits) {
- ForceDeferredStartup();
controller()->TryStart();
EXPECT_FALSE(started());
base::RunLoop().RunUntilIdle();
@@ -254,8 +240,8 @@ TEST_F(StartupControllerTest, Reset) {
controller()->Reset(syncer::UserTypes());
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(started());
- const bool deferred_start = CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kSyncEnableDeferredStartup);
+ const bool deferred_start = !CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kSyncDisableDeferredStartup);
controller()->TryStart();
EXPECT_EQ(!deferred_start, started());
controller()->OnDataTypeRequestsSyncStartup(syncer::SESSIONS);

Powered by Google App Engine
This is Rietveld 408576698