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

Unified Diff: components/sync_driver/startup_controller_unittest.cc

Issue 1789433002: [Sync] Start up immediately when entering the sync setup UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setup
Patch Set: Split tests. Created 4 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
« no previous file with comments | « components/sync_driver/startup_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync_driver/startup_controller_unittest.cc
diff --git a/components/sync_driver/startup_controller_unittest.cc b/components/sync_driver/startup_controller_unittest.cc
index 6fada804e5b236de484cc1829f40b0af00a5c00f..c6de60f1180d37cae812d768e8386ffd79c540ed 100644
--- a/components/sync_driver/startup_controller_unittest.cc
+++ b/components/sync_driver/startup_controller_unittest.cc
@@ -162,9 +162,18 @@ TEST_F(StartupControllerTest, Managed) {
ExpectNotStarted();
}
-// Test that sync doesn't start until all conditions are met and a
-// data type triggers sync startup.
-TEST_F(StartupControllerTest, DataTypeTriggered) {
+// Test that a data type triggering startup starts sync immediately.
+TEST_F(StartupControllerTest, NoDeferralDataTypeTrigger) {
+ sync_prefs()->SetFirstSetupComplete();
+ signin()->set_account_id(kTestUser);
+ token_service()->UpdateCredentials(kTestUser, kTestToken);
+ controller()->OnDataTypeRequestsSyncStartup(syncer::SESSIONS);
+ ExpectStarted();
+}
+
+// Test that a data type trigger interrupts the deferral timer and starts
+// sync immediately.
+TEST_F(StartupControllerTest, DataTypeTriggerInterruptsDeferral) {
sync_prefs()->SetFirstSetupComplete();
signin()->set_account_id(kTestUser);
token_service()->UpdateCredentials(kTestUser, kTestToken);
@@ -222,13 +231,26 @@ TEST_F(StartupControllerTest, FallbackTimerWaits) {
ExpectNotStarted();
}
-// Test that start isn't deferred when setup is in progress.
-TEST_F(StartupControllerTest, NoDeferralWithSetupInProgress) {
+// Test that sync starts immediately when setup in progress is true.
+TEST_F(StartupControllerTest, NoDeferralSetupInProgressTrigger) {
+ sync_prefs()->SetFirstSetupComplete();
+ signin()->set_account_id(kTestUser);
+ token_service()->UpdateCredentials(kTestUser, kTestToken);
+
+ controller()->SetSetupInProgress(true);
+ ExpectStarted();
+}
+
+// Test that setup in progress being set to true interrupts the deferral timer
+// and starts sync immediately.
+TEST_F(StartupControllerTest, SetupInProgressTriggerInterruptsDeferral) {
sync_prefs()->SetFirstSetupComplete();
signin()->set_account_id(kTestUser);
token_service()->UpdateCredentials(kTestUser, kTestToken);
- controller()->set_setup_in_progress(true);
controller()->TryStart();
+ ExpectStartDeferred();
+
+ controller()->SetSetupInProgress(true);
ExpectStarted();
}
@@ -252,7 +274,7 @@ TEST_F(StartupControllerTest, ResetDuringSetup) {
token_service()->UpdateCredentials(kTestUser, kTestToken);
// Simulate UI telling us setup is in progress.
- controller()->set_setup_in_progress(true);
+ controller()->SetSetupInProgress(true);
// This could happen if the UI triggers a stop-syncing permanently call.
controller()->Reset(syncer::UserTypes());
« no previous file with comments | « components/sync_driver/startup_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698