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 "components/sync/driver/glue/sync_backend_host_impl.h" | 5 #include "components/sync/driver/glue/sync_backend_host_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <cstddef> | 9 #include <cstddef> |
10 #include <map> | 10 #include <map> |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 173 |
174 void SetUp() override { | 174 void SetUp() override { |
175 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 175 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
176 | 176 |
177 sync_driver::SyncPrefs::RegisterProfilePrefs(pref_service_.registry()); | 177 sync_driver::SyncPrefs::RegisterProfilePrefs(pref_service_.registry()); |
178 | 178 |
179 sync_prefs_.reset(new sync_driver::SyncPrefs(&pref_service_)); | 179 sync_prefs_.reset(new sync_driver::SyncPrefs(&pref_service_)); |
180 backend_.reset(new SyncBackendHostImpl( | 180 backend_.reset(new SyncBackendHostImpl( |
181 "dummyDebugName", &sync_client_, base::ThreadTaskRunnerHandle::Get(), | 181 "dummyDebugName", &sync_client_, base::ThreadTaskRunnerHandle::Get(), |
182 nullptr, sync_prefs_->AsWeakPtr(), | 182 nullptr, sync_prefs_->AsWeakPtr(), |
183 temp_dir_.path().Append(base::FilePath(kTestSyncDir)))); | 183 temp_dir_.GetPath().Append(base::FilePath(kTestSyncDir)))); |
184 credentials_.account_id = "user@example.com"; | 184 credentials_.account_id = "user@example.com"; |
185 credentials_.email = "user@example.com"; | 185 credentials_.email = "user@example.com"; |
186 credentials_.sync_token = "sync_token"; | 186 credentials_.sync_token = "sync_token"; |
187 credentials_.scope_set.insert(GaiaConstants::kChromeSyncOAuth2Scope); | 187 credentials_.scope_set.insert(GaiaConstants::kChromeSyncOAuth2Scope); |
188 | 188 |
189 fake_manager_factory_.reset(new FakeSyncManagerFactory(&fake_manager_)); | 189 fake_manager_factory_.reset(new FakeSyncManagerFactory(&fake_manager_)); |
190 | 190 |
191 // These types are always implicitly enabled. | 191 // These types are always implicitly enabled. |
192 enabled_types_.PutAll(syncer::ControlTypes()); | 192 enabled_types_.PutAll(syncer::ControlTypes()); |
193 | 193 |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 InitializeBackend(true); | 727 InitializeBackend(true); |
728 EXPECT_EQ(syncer::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE, | 728 EXPECT_EQ(syncer::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE, |
729 fake_manager_->GetAndResetConfigureReason()); | 729 fake_manager_->GetAndResetConfigureReason()); |
730 } | 730 } |
731 | 731 |
732 // It is SyncBackendHostCore responsibility to cleanup Sync Data folder if sync | 732 // It is SyncBackendHostCore responsibility to cleanup Sync Data folder if sync |
733 // setup hasn't been completed. This test ensures that cleanup happens. | 733 // setup hasn't been completed. This test ensures that cleanup happens. |
734 TEST_F(SyncBackendHostTest, TestStartupWithOldSyncData) { | 734 TEST_F(SyncBackendHostTest, TestStartupWithOldSyncData) { |
735 const char* nonsense = "slon"; | 735 const char* nonsense = "slon"; |
736 base::FilePath temp_directory = | 736 base::FilePath temp_directory = |
737 temp_dir_.path().Append(base::FilePath(kTestSyncDir)); | 737 temp_dir_.GetPath().Append(base::FilePath(kTestSyncDir)); |
738 base::FilePath sync_file = temp_directory.AppendASCII("SyncData.sqlite3"); | 738 base::FilePath sync_file = temp_directory.AppendASCII("SyncData.sqlite3"); |
739 ASSERT_TRUE(base::CreateDirectory(temp_directory)); | 739 ASSERT_TRUE(base::CreateDirectory(temp_directory)); |
740 ASSERT_NE(-1, base::WriteFile(sync_file, nonsense, strlen(nonsense))); | 740 ASSERT_NE(-1, base::WriteFile(sync_file, nonsense, strlen(nonsense))); |
741 | 741 |
742 InitializeBackend(true); | 742 InitializeBackend(true); |
743 | 743 |
744 EXPECT_FALSE(base::PathExists(sync_file)); | 744 EXPECT_FALSE(base::PathExists(sync_file)); |
745 } | 745 } |
746 | 746 |
747 // If bookmarks encounter an error that results in disabling without purging | 747 // If bookmarks encounter an error that results in disabling without purging |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 backend_->StopSyncingForShutdown(); | 861 backend_->StopSyncingForShutdown(); |
862 // Verify that call to DeactivateNonBlockingDataType doesn't assert. | 862 // Verify that call to DeactivateNonBlockingDataType doesn't assert. |
863 backend_->DeactivateNonBlockingDataType(syncer::AUTOFILL); | 863 backend_->DeactivateNonBlockingDataType(syncer::AUTOFILL); |
864 backend_->Shutdown(syncer::STOP_SYNC); | 864 backend_->Shutdown(syncer::STOP_SYNC); |
865 backend_.reset(); | 865 backend_.reset(); |
866 } | 866 } |
867 | 867 |
868 } // namespace | 868 } // namespace |
869 | 869 |
870 } // namespace browser_sync | 870 } // namespace browser_sync |
OLD | NEW |