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

Side by Side Diff: chrome/browser/sync/profile_sync_service_unittest.cc

Issue 10520010: Not for review: Support sync init with missing or corrupt store (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Documentation Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/signin/signin_manager.h" 9 #include "chrome/browser/signin/signin_manager.h"
10 #include "chrome/browser/signin/signin_manager_factory.h" 10 #include "chrome/browser/signin/signin_manager_factory.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 ASSERT_FALSE(file_util::PathExists(sync_file3)); 355 ASSERT_FALSE(file_util::PathExists(sync_file3));
356 ASSERT_FALSE(file_util::PathExists(sync_file1)); 356 ASSERT_FALSE(file_util::PathExists(sync_file1));
357 357
358 // This will still exist, but the text should have changed. 358 // This will still exist, but the text should have changed.
359 ASSERT_TRUE(file_util::PathExists(sync_file2)); 359 ASSERT_TRUE(file_util::PathExists(sync_file2));
360 std::string file2text; 360 std::string file2text;
361 ASSERT_TRUE(file_util::ReadFileToString(sync_file2, &file2text)); 361 ASSERT_TRUE(file_util::ReadFileToString(sync_file2, &file2text));
362 ASSERT_NE(file2text.compare(nonsense2), 0); 362 ASSERT_NE(file2text.compare(nonsense2), 0);
363 } 363 }
364 364
365 // Disabled because of crbug.com/109668.
366 TEST_F(ProfileSyncServiceTest, DISABLED_CorruptDatabase) {
rlarocque 2012/06/04 20:07:09 Our test framework actually makes this really hard
367 const char* nonesense = "not a database";
368
369 FilePath temp_directory = profile_->GetPath().AppendASCII("Sync Data");
370 FilePath sync_db_file = temp_directory.AppendASCII("SyncData.sqlite3");
371
372 ASSERT_TRUE(file_util::CreateDirectory(temp_directory));
373 ASSERT_NE(-1,
374 file_util::WriteFile(sync_db_file, nonesense, strlen(nonesense)));
375
376 // Initialize with HasSyncSetupCompleted() set to true and InitialSyncEnded
377 // false. This is to model the scenario that would result when opening the
378 // sync database fails.
379 StartSyncServiceAndSetInitialSyncEnded(false, true, true, true, false, true);
380
381 // The backend is not ready. Ensure the PSS knows this.
382 EXPECT_FALSE(service_->sync_initialized());
383
384 // Ensure we will be prepared to initialize a fresh DB next time.
385 EXPECT_FALSE(service_->HasSyncSetupCompleted());
386 }
387
388 } // namespace 365 } // namespace
389 366
390 } // namespace browser_sync 367 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698