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

Unified Diff: components/sync_driver/startup_controller_unittest.cc

Issue 2159453002: [Sync] Don't start up sync when FirstSetupCompleted is false and no setup in progress (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review Created 4 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: 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 eb83d9da3b686dcf14de54525797a69cdf5ee6c5..5e0b5a5d4389e8a5f525d02163357fda74844b52 100644
--- a/components/sync_driver/startup_controller_unittest.cc
+++ b/components/sync_driver/startup_controller_unittest.cc
@@ -86,21 +86,21 @@ class StartupControllerTest : public testing::Test {
std::unique_ptr<StartupController> controller_;
};
-// Test that sync doesn't start until all conditions are met.
-TEST_F(StartupControllerTest, Basic) {
- controller()->TryStart();
+// Test that sync doesn't start if setup is not in progress or complete.
+TEST_F(StartupControllerTest, NoSetupComplete) {
+ controller()->TryStart(false);
ExpectNotStarted();
SetCanStart(true);
- controller()->TryStart();
- ExpectStarted();
+ controller()->TryStart(false);
+ ExpectNotStarted();
}
// Test that sync defers if first setup is complete.
TEST_F(StartupControllerTest, DefersAfterFirstSetupComplete) {
sync_prefs()->SetFirstSetupComplete();
SetCanStart(true);
- controller()->TryStart();
+ controller()->TryStart(false);
ExpectStartDeferred();
}
@@ -117,7 +117,7 @@ TEST_F(StartupControllerTest, NoDeferralDataTypeTrigger) {
TEST_F(StartupControllerTest, DataTypeTriggerInterruptsDeferral) {
sync_prefs()->SetFirstSetupComplete();
SetCanStart(true);
- controller()->TryStart();
+ controller()->TryStart(false);
ExpectStartDeferred();
controller()->OnDataTypeRequestsSyncStartup(syncer::SESSIONS);
@@ -135,7 +135,7 @@ TEST_F(StartupControllerTest, DataTypeTriggerInterruptsDeferral) {
TEST_F(StartupControllerTest, FallbackTimer) {
sync_prefs()->SetFirstSetupComplete();
SetCanStart(true);
- controller()->TryStart();
+ controller()->TryStart(false);
ExpectStartDeferred();
base::RunLoop().RunUntilIdle();
@@ -156,14 +156,14 @@ TEST_F(StartupControllerTest, NoDeferralWithoutSessionsSync) {
sync_prefs()->SetFirstSetupComplete();
SetCanStart(true);
- controller()->TryStart();
+ controller()->TryStart(false);
ExpectStarted();
}
// Sanity check that the fallback timer doesn't fire before startup
// conditions are met.
TEST_F(StartupControllerTest, FallbackTimerWaits) {
- controller()->TryStart();
+ controller()->TryStart(false);
ExpectNotStarted();
base::RunLoop().RunUntilIdle();
ExpectNotStarted();
@@ -182,24 +182,19 @@ TEST_F(StartupControllerTest, NoDeferralSetupInProgressTrigger) {
TEST_F(StartupControllerTest, SetupInProgressTriggerInterruptsDeferral) {
sync_prefs()->SetFirstSetupComplete();
SetCanStart(true);
- controller()->TryStart();
+ controller()->TryStart(false);
ExpectStartDeferred();
controller()->SetSetupInProgress(true);
ExpectStarted();
}
-// Test that start isn't deferred on the first start but is on restarts.
-TEST_F(StartupControllerTest, DeferralOnRestart) {
+// Test that immediate startup can be forced.
+TEST_F(StartupControllerTest, ForceImmediateStartup) {
+ sync_prefs()->SetFirstSetupComplete();
SetCanStart(true);
- controller()->TryStart();
+ controller()->TryStart(true);
ExpectStarted();
-
- clear_started();
- controller()->Reset(syncer::UserTypes());
- ExpectNotStarted();
- controller()->TryStart();
- ExpectStartDeferred();
}
// Test that setup-in-progress tracking is persistent across a Reset.
« components/sync_driver/startup_controller.cc ('K') | « components/sync_driver/startup_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698