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

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

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « chrome/browser/sxs_linux.cc ('k') | chrome/browser/sync/test/integration/bookmarks_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 harness_.service->Shutdown(); 449 harness_.service->Shutdown();
450 harness_.service.reset(); 450 harness_.service.reset();
451 451
452 // This file should have been deleted when the whole directory was nuked. 452 // This file should have been deleted when the whole directory was nuked.
453 ASSERT_FALSE(base::PathExists(sync_file3)); 453 ASSERT_FALSE(base::PathExists(sync_file3));
454 ASSERT_FALSE(base::PathExists(sync_file1)); 454 ASSERT_FALSE(base::PathExists(sync_file1));
455 455
456 // This will still exist, but the text should have changed. 456 // This will still exist, but the text should have changed.
457 ASSERT_TRUE(base::PathExists(sync_file2)); 457 ASSERT_TRUE(base::PathExists(sync_file2));
458 std::string file2text; 458 std::string file2text;
459 ASSERT_TRUE(file_util::ReadFileToString(sync_file2, &file2text)); 459 ASSERT_TRUE(base::ReadFileToString(sync_file2, &file2text));
460 ASSERT_NE(file2text.compare(nonsense2), 0); 460 ASSERT_NE(file2text.compare(nonsense2), 0);
461 } 461 }
462 462
463 // Simulates a scenario where a database is corrupted and it is impossible to 463 // Simulates a scenario where a database is corrupted and it is impossible to
464 // recreate it. This test is useful mainly when it is run under valgrind. Its 464 // recreate it. This test is useful mainly when it is run under valgrind. Its
465 // expectations are not very interesting. 465 // expectations are not very interesting.
466 TEST_F(ProfileSyncServiceTest, FailToOpenDatabase) { 466 TEST_F(ProfileSyncServiceTest, FailToOpenDatabase) {
467 harness_.StartSyncServiceAndSetInitialSyncEnded(false, true, true, true, 467 harness_.StartSyncServiceAndSetInitialSyncEnded(false, true, true, true,
468 syncer::STORAGE_INVALID); 468 syncer::STORAGE_INVALID);
469 469
470 // The backend is not ready. Ensure the PSS knows this. 470 // The backend is not ready. Ensure the PSS knows this.
471 EXPECT_FALSE(harness_.service->sync_initialized()); 471 EXPECT_FALSE(harness_.service->sync_initialized());
472 } 472 }
473 473
474 // This setup will allow the database to exist, but leave it empty. The attempt 474 // This setup will allow the database to exist, but leave it empty. The attempt
475 // to download control types will silently fail (no downloads have any effect in 475 // to download control types will silently fail (no downloads have any effect in
476 // these tests). The sync_backend_host will notice this and inform the profile 476 // these tests). The sync_backend_host will notice this and inform the profile
477 // sync service of the failure to initialize the backed. 477 // sync service of the failure to initialize the backed.
478 TEST_F(ProfileSyncServiceTest, FailToDownloadControlTypes) { 478 TEST_F(ProfileSyncServiceTest, FailToDownloadControlTypes) {
479 harness_.StartSyncServiceAndSetInitialSyncEnded(false, true, true, true, 479 harness_.StartSyncServiceAndSetInitialSyncEnded(false, true, true, true,
480 syncer::STORAGE_IN_MEMORY); 480 syncer::STORAGE_IN_MEMORY);
481 481
482 // The backend is not ready. Ensure the PSS knows this. 482 // The backend is not ready. Ensure the PSS knows this.
483 EXPECT_FALSE(harness_.service->sync_initialized()); 483 EXPECT_FALSE(harness_.service->sync_initialized());
484 } 484 }
485 485
486 } // namespace 486 } // namespace
487 } // namespace browser_sync 487 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sxs_linux.cc ('k') | chrome/browser/sync/test/integration/bookmarks_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698