diff options
Diffstat (limited to 'chrome/browser/sync/profile_sync_service_unittest.cc')
-rw-r--r-- | chrome/browser/sync/profile_sync_service_unittest.cc | 44 |
1 files changed, 8 insertions, 36 deletions
diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index b2e7636..470ba48 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -77,15 +77,14 @@ class ProfileSyncServiceTest : public testing::Test { // TODO(akalin): Refactor the StartSyncService*() functions below. void StartSyncService() { - StartSyncServiceAndSetInitialSyncEnded(true, true, false, true, true); + StartSyncServiceAndSetInitialSyncEnded(true, true, false, true); } void StartSyncServiceAndSetInitialSyncEnded( bool set_initial_sync_ended, bool issue_auth_token, bool synchronous_sync_configuration, - bool sync_setup_completed, - bool expect_create_dtm) { + bool sync_setup_completed) { if (!service_.get()) { // Set bootstrap to true and it will provide a logged in user for test service_.reset(new TestProfileSyncService(&factory_, @@ -98,13 +97,9 @@ class ProfileSyncServiceTest : public testing::Test { if (!sync_setup_completed) profile_->GetPrefs()->SetBoolean(prefs::kSyncHasSetupCompleted, false); - if (expect_create_dtm) { - // Register the bookmark data type. - EXPECT_CALL(factory_, CreateDataTypeManager(_, _)). - WillOnce(ReturnNewDataTypeManager()); - } else { - EXPECT_CALL(factory_, CreateDataTypeManager(_, _)).Times(0); - } + // Register the bookmark data type. + EXPECT_CALL(factory_, CreateDataTypeManager(_, _)). + WillOnce(ReturnNewDataTypeManager()); if (issue_auth_token) { profile_->GetTokenService()->IssueAuthTokenForTest( @@ -197,7 +192,7 @@ TEST_F(ProfileSyncServiceTest, JsControllerHandlersBasic) { TEST_F(ProfileSyncServiceTest, JsControllerHandlersDelayedBackendInitialization) { - StartSyncServiceAndSetInitialSyncEnded(true, false, false, true, true); + StartSyncServiceAndSetInitialSyncEnded(true, false, false, true); StrictMock<MockJsEventHandler> event_handler; EXPECT_CALL(event_handler, HandleJsEvent(_, _)).Times(AtLeast(1)); @@ -239,7 +234,7 @@ TEST_F(ProfileSyncServiceTest, JsControllerProcessJsMessageBasic) { TEST_F(ProfileSyncServiceTest, JsControllerProcessJsMessageBasicDelayedBackendInitialization) { - StartSyncServiceAndSetInitialSyncEnded(true, false, false, true, true); + StartSyncServiceAndSetInitialSyncEnded(true, false, false, true); StrictMock<MockJsReplyHandler> reply_handler; @@ -282,9 +277,8 @@ TEST_F(ProfileSyncServiceTest, TestStartupWithOldSyncData) { ASSERT_NE(-1, file_util::WriteFile(sync_file3, nonsense3, strlen(nonsense3))); - StartSyncServiceAndSetInitialSyncEnded(false, false, true, false, true); + StartSyncServiceAndSetInitialSyncEnded(false, false, true, false); EXPECT_FALSE(service_->HasSyncSetupCompleted()); - EXPECT_FALSE(service_->sync_initialized()); // Since we're doing synchronous initialization, backend should be // initialized by this call. @@ -306,28 +300,6 @@ TEST_F(ProfileSyncServiceTest, TestStartupWithOldSyncData) { ASSERT_NE(file2text.compare(nonsense2), 0); } -TEST_F(ProfileSyncServiceTest, CorruptDatabase) { - const char* nonesense = "not a database"; - - FilePath temp_directory = profile_->GetPath().AppendASCII("Sync Data"); - FilePath sync_db_file = temp_directory.AppendASCII("SyncData.sqlite3"); - - ASSERT_TRUE(file_util::CreateDirectory(temp_directory)); - ASSERT_NE(-1, - file_util::WriteFile(sync_db_file, nonesense, strlen(nonesense))); - - // Initialize with HasSyncSetupCompleted() set to true and InitialSyncEnded - // false. This is to model the scenario that would result when opening the - // sync database fails. - StartSyncServiceAndSetInitialSyncEnded(false, true, true, true, false); - - // The backend is not ready. Ensure the PSS knows this. - EXPECT_FALSE(service_->sync_initialized()); - - // Ensure we will be prepared to initialize a fresh DB next time. - EXPECT_FALSE(service_->HasSyncSetupCompleted()); -} - } // namespace } // namespace browser_sync |