| 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/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 FakeSyncManager** fake_manager_; | 144 FakeSyncManager** fake_manager_; |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 class SyncBackendHostTest : public testing::Test { | 147 class SyncBackendHostTest : public testing::Test { |
| 148 protected: | 148 protected: |
| 149 SyncBackendHostTest() | 149 SyncBackendHostTest() |
| 150 : thread_bundle_(content::TestBrowserThreadBundle::REAL_IO_THREAD), | 150 : thread_bundle_(content::TestBrowserThreadBundle::REAL_IO_THREAD), |
| 151 profile_manager_(TestingBrowserProcess::GetGlobal()), | 151 profile_manager_(TestingBrowserProcess::GetGlobal()), |
| 152 fake_manager_(NULL) {} | 152 fake_manager_(NULL) {} |
| 153 | 153 |
| 154 virtual ~SyncBackendHostTest() {} | 154 ~SyncBackendHostTest() override {} |
| 155 | 155 |
| 156 virtual void SetUp() override { | 156 void SetUp() override { |
| 157 ASSERT_TRUE(profile_manager_.SetUp()); | 157 ASSERT_TRUE(profile_manager_.SetUp()); |
| 158 profile_ = profile_manager_.CreateTestingProfile(kTestProfileName); | 158 profile_ = profile_manager_.CreateTestingProfile(kTestProfileName); |
| 159 sync_prefs_.reset(new sync_driver::SyncPrefs(profile_->GetPrefs())); | 159 sync_prefs_.reset(new sync_driver::SyncPrefs(profile_->GetPrefs())); |
| 160 backend_.reset(new SyncBackendHostImpl( | 160 backend_.reset(new SyncBackendHostImpl( |
| 161 profile_->GetDebugName(), | 161 profile_->GetDebugName(), |
| 162 profile_, | 162 profile_, |
| 163 invalidation::ProfileInvalidationProviderFactory::GetForProfile( | 163 invalidation::ProfileInvalidationProviderFactory::GetForProfile( |
| 164 profile_)->GetInvalidationService(), | 164 profile_)->GetInvalidationService(), |
| 165 sync_prefs_->AsWeakPtr(), | 165 sync_prefs_->AsWeakPtr(), |
| 166 base::FilePath(kTestSyncDir))); | 166 base::FilePath(kTestSyncDir))); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 177 // Registrar removing them if it can't find their model workers. | 177 // Registrar removing them if it can't find their model workers. |
| 178 enabled_types_.Put(syncer::BOOKMARKS); | 178 enabled_types_.Put(syncer::BOOKMARKS); |
| 179 enabled_types_.Put(syncer::PREFERENCES); | 179 enabled_types_.Put(syncer::PREFERENCES); |
| 180 enabled_types_.Put(syncer::SESSIONS); | 180 enabled_types_.Put(syncer::SESSIONS); |
| 181 enabled_types_.Put(syncer::SEARCH_ENGINES); | 181 enabled_types_.Put(syncer::SEARCH_ENGINES); |
| 182 enabled_types_.Put(syncer::AUTOFILL); | 182 enabled_types_.Put(syncer::AUTOFILL); |
| 183 | 183 |
| 184 network_resources_.reset(new syncer::HttpBridgeNetworkResources()); | 184 network_resources_.reset(new syncer::HttpBridgeNetworkResources()); |
| 185 } | 185 } |
| 186 | 186 |
| 187 virtual void TearDown() override { | 187 void TearDown() override { |
| 188 if (backend_) { | 188 if (backend_) { |
| 189 backend_->StopSyncingForShutdown(); | 189 backend_->StopSyncingForShutdown(); |
| 190 backend_->Shutdown(syncer::STOP_SYNC); | 190 backend_->Shutdown(syncer::STOP_SYNC); |
| 191 } | 191 } |
| 192 backend_.reset(); | 192 backend_.reset(); |
| 193 sync_prefs_.reset(); | 193 sync_prefs_.reset(); |
| 194 profile_ = NULL; | 194 profile_ = NULL; |
| 195 profile_manager_.DeleteTestingProfile(kTestProfileName); | 195 profile_manager_.DeleteTestingProfile(kTestProfileName); |
| 196 // Pump messages posted by the sync thread (which may end up | 196 // Pump messages posted by the sync thread (which may end up |
| 197 // posting on the IO thread). | 197 // posting on the IO thread). |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 syncer::ModelTypeSet()); | 788 syncer::ModelTypeSet()); |
| 789 EXPECT_TRUE( | 789 EXPECT_TRUE( |
| 790 ready_types.Equals(syncer::Difference(enabled_types_, error_types))); | 790 ready_types.Equals(syncer::Difference(enabled_types_, error_types))); |
| 791 EXPECT_FALSE(fake_manager_->GetTypesWithEmptyProgressMarkerToken( | 791 EXPECT_FALSE(fake_manager_->GetTypesWithEmptyProgressMarkerToken( |
| 792 error_types).Empty()); | 792 error_types).Empty()); |
| 793 } | 793 } |
| 794 | 794 |
| 795 } // namespace | 795 } // namespace |
| 796 | 796 |
| 797 } // namespace browser_sync | 797 } // namespace browser_sync |
| OLD | NEW |