| OLD | NEW |
| 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/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 // Since we're doing synchronous initialization, backend should be | 426 // Since we're doing synchronous initialization, backend should be |
| 427 // initialized by this call. | 427 // initialized by this call. |
| 428 harness_.IssueTestTokens(); | 428 harness_.IssueTestTokens(); |
| 429 | 429 |
| 430 // Stop the service so we can read the new Sync Data files that were | 430 // Stop the service so we can read the new Sync Data files that were |
| 431 // created. | 431 // created. |
| 432 harness_.service->Shutdown(); | 432 harness_.service->Shutdown(); |
| 433 harness_.service.reset(); | 433 harness_.service.reset(); |
| 434 | 434 |
| 435 // This file should have been deleted when the whole directory was nuked. | 435 // This file should have been deleted when the whole directory was nuked. |
| 436 ASSERT_FALSE(file_util::PathExists(sync_file3)); | 436 ASSERT_FALSE(base::PathExists(sync_file3)); |
| 437 ASSERT_FALSE(file_util::PathExists(sync_file1)); | 437 ASSERT_FALSE(base::PathExists(sync_file1)); |
| 438 | 438 |
| 439 // This will still exist, but the text should have changed. | 439 // This will still exist, but the text should have changed. |
| 440 ASSERT_TRUE(file_util::PathExists(sync_file2)); | 440 ASSERT_TRUE(base::PathExists(sync_file2)); |
| 441 std::string file2text; | 441 std::string file2text; |
| 442 ASSERT_TRUE(file_util::ReadFileToString(sync_file2, &file2text)); | 442 ASSERT_TRUE(file_util::ReadFileToString(sync_file2, &file2text)); |
| 443 ASSERT_NE(file2text.compare(nonsense2), 0); | 443 ASSERT_NE(file2text.compare(nonsense2), 0); |
| 444 } | 444 } |
| 445 | 445 |
| 446 // Simulates a scenario where a database is corrupted and it is impossible to | 446 // Simulates a scenario where a database is corrupted and it is impossible to |
| 447 // recreate it. This test is useful mainly when it is run under valgrind. Its | 447 // recreate it. This test is useful mainly when it is run under valgrind. Its |
| 448 // expectations are not very interesting. | 448 // expectations are not very interesting. |
| 449 TEST_F(ProfileSyncServiceTest, FailToOpenDatabase) { | 449 TEST_F(ProfileSyncServiceTest, FailToOpenDatabase) { |
| 450 harness_.StartSyncServiceAndSetInitialSyncEnded(false, true, true, true, | 450 harness_.StartSyncServiceAndSetInitialSyncEnded(false, true, true, true, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 461 TEST_F(ProfileSyncServiceTest, FailToDownloadControlTypes) { | 461 TEST_F(ProfileSyncServiceTest, FailToDownloadControlTypes) { |
| 462 harness_.StartSyncServiceAndSetInitialSyncEnded(false, true, true, true, | 462 harness_.StartSyncServiceAndSetInitialSyncEnded(false, true, true, true, |
| 463 syncer::STORAGE_IN_MEMORY); | 463 syncer::STORAGE_IN_MEMORY); |
| 464 | 464 |
| 465 // The backend is not ready. Ensure the PSS knows this. | 465 // The backend is not ready. Ensure the PSS knows this. |
| 466 EXPECT_FALSE(harness_.service->sync_initialized()); | 466 EXPECT_FALSE(harness_.service->sync_initialized()); |
| 467 } | 467 } |
| 468 | 468 |
| 469 } // namespace | 469 } // namespace |
| 470 } // namespace browser_sync | 470 } // namespace browser_sync |
| OLD | NEW |