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

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

Issue 8570016: Revert 110177 - Sync: Improve handling of database load failures (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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/profile_sync_service_unittest.cc
===================================================================
--- chrome/browser/sync/profile_sync_service_unittest.cc (revision 110181)
+++ chrome/browser/sync/profile_sync_service_unittest.cc (working copy)
@@ -77,15 +77,14 @@
// 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 @@
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,
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,
JsControllerProcessJsMessageBasicDelayedBackendInitialization) {
- StartSyncServiceAndSetInitialSyncEnded(true, false, false, true, true);
+ StartSyncServiceAndSetInitialSyncEnded(true, false, false, true);
StrictMock<MockJsReplyHandler> reply_handler;
@@ -282,9 +277,8 @@
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 @@
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
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/sync/syncable/directory_backing_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698