Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/sync/glue/sync_backend_host_impl.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/file_util.h" | |
| 9 #include "base/location.h" | 10 #include "base/location.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 12 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/test/test_timeouts.h" | 14 #include "base/test/test_timeouts.h" |
| 14 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "chrome/browser/invalidation/invalidator_storage.h" | 16 #include "chrome/browser/invalidation/invalidator_storage.h" |
| 16 #include "chrome/browser/prefs/pref_service_syncable.h" | 17 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 17 #include "chrome/browser/sync/glue/device_info.h" | 18 #include "chrome/browser/sync/glue/device_info.h" |
| 18 #include "chrome/browser/sync/glue/sync_frontend.h" | 19 #include "chrome/browser/sync/glue/sync_frontend.h" |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 680 // Test that configuration on restart sends the proper GU source. | 681 // Test that configuration on restart sends the proper GU source. |
| 681 TEST_F(SyncBackendHostTest, DownloadControlTypesRestart) { | 682 TEST_F(SyncBackendHostTest, DownloadControlTypesRestart) { |
| 682 sync_prefs_->SetSyncSetupCompleted(); | 683 sync_prefs_->SetSyncSetupCompleted(); |
| 683 fake_manager_factory_->set_progress_marker_types(enabled_types_); | 684 fake_manager_factory_->set_progress_marker_types(enabled_types_); |
| 684 fake_manager_factory_->set_initial_sync_ended_types(enabled_types_); | 685 fake_manager_factory_->set_initial_sync_ended_types(enabled_types_); |
| 685 InitializeBackend(true); | 686 InitializeBackend(true); |
| 686 EXPECT_EQ(syncer::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE, | 687 EXPECT_EQ(syncer::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE, |
| 687 fake_manager_->GetAndResetConfigureReason()); | 688 fake_manager_->GetAndResetConfigureReason()); |
| 688 } | 689 } |
| 689 | 690 |
| 691 // It is SyncBackendHostCore responsibility to cleanup Sync Data folder if sync | |
| 692 // setup hasn't been completed. This test ensures that cleanup happens. | |
| 693 TEST_F(SyncBackendHostTest, TestStartupWithOldSyncData) { | |
| 694 const char* nonsense = "slon"; | |
| 695 base::FilePath temp_directory = | |
| 696 profile_->GetPath().AppendASCII("Sync Data"); | |
| 697 base::FilePath sync_file = temp_directory.AppendASCII("SyncData.sqlite3"); | |
| 698 ASSERT_TRUE(file_util::CreateDirectory(temp_directory)); | |
| 699 ASSERT_NE(-1, file_util::WriteFile(sync_file, nonsense, strlen(nonsense))); | |
| 700 | |
| 701 InitializeBackend(true); | |
|
rlarocque
2013/11/13 18:58:35
I think InitializeBackend() will instantiate a Fak
pavely
2013/11/18 19:26:57
Yes, you are right. It doesn't test creation of sy
| |
| 702 | |
| 703 EXPECT_FALSE(base::PathExists(sync_file)); | |
| 704 } | |
| 705 | |
| 690 } // namespace | 706 } // namespace |
| 691 | 707 |
| 692 } // namespace browser_sync | 708 } // namespace browser_sync |
| OLD | NEW |