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

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

Issue 186883006: Revert 254678 "sync: turn on deferred startup." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 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
« no previous file with comments | « trunk/src/chrome/browser/sync/startup_controller.cc ('k') | trunk/src/chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/chrome/browser/sync/startup_controller_unittest.cc
===================================================================
--- trunk/src/chrome/browser/sync/startup_controller_unittest.cc (revision 254811)
+++ trunk/src/chrome/browser/sync/startup_controller_unittest.cc (working copy)
@@ -86,6 +86,15 @@
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(); }
@@ -118,8 +127,8 @@
controller()->TryStart();
EXPECT_FALSE(started());
token_service()->IssueRefreshTokenForUser(kTestUser, kTestToken);
- const bool deferred_start = !CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kSyncDisableDeferredStartup);
+ const bool deferred_start = CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kSyncEnableDeferredStartup);
controller()->TryStart();
EXPECT_EQ(!deferred_start, started());
std::string state(controller()->GetBackendInitializationStateString());
@@ -154,6 +163,7 @@
// 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);
@@ -176,6 +186,7 @@
// 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);
@@ -195,6 +206,8 @@
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);
@@ -206,6 +219,7 @@
// 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();
@@ -240,8 +254,8 @@
controller()->Reset(syncer::UserTypes());
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(started());
- const bool deferred_start = !CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kSyncDisableDeferredStartup);
+ const bool deferred_start = CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kSyncEnableDeferredStartup);
controller()->TryStart();
EXPECT_EQ(!deferred_start, started());
controller()->OnDataTypeRequestsSyncStartup(syncer::SESSIONS);
« no previous file with comments | « trunk/src/chrome/browser/sync/startup_controller.cc ('k') | trunk/src/chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698