| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 public: | 112 public: |
| 113 explicit FakeSyncManagerFactory(FakeSyncManager** fake_manager) | 113 explicit FakeSyncManagerFactory(FakeSyncManager** fake_manager) |
| 114 : SyncManagerFactory(NORMAL), | 114 : SyncManagerFactory(NORMAL), |
| 115 fake_manager_(fake_manager) { | 115 fake_manager_(fake_manager) { |
| 116 *fake_manager_ = NULL; | 116 *fake_manager_ = NULL; |
| 117 } | 117 } |
| 118 virtual ~FakeSyncManagerFactory() {} | 118 virtual ~FakeSyncManagerFactory() {} |
| 119 | 119 |
| 120 // SyncManagerFactory implementation. Called on the sync thread. | 120 // SyncManagerFactory implementation. Called on the sync thread. |
| 121 virtual scoped_ptr<SyncManager> CreateSyncManager( | 121 virtual scoped_ptr<SyncManager> CreateSyncManager( |
| 122 std::string name) OVERRIDE { | 122 std::string name) override { |
| 123 *fake_manager_ = new FakeSyncManager(initial_sync_ended_types_, | 123 *fake_manager_ = new FakeSyncManager(initial_sync_ended_types_, |
| 124 progress_marker_types_, | 124 progress_marker_types_, |
| 125 configure_fail_types_); | 125 configure_fail_types_); |
| 126 return scoped_ptr<SyncManager>(*fake_manager_); | 126 return scoped_ptr<SyncManager>(*fake_manager_); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void set_initial_sync_ended_types(syncer::ModelTypeSet types) { | 129 void set_initial_sync_ended_types(syncer::ModelTypeSet types) { |
| 130 initial_sync_ended_types_ = types; | 130 initial_sync_ended_types_ = types; |
| 131 } | 131 } |
| 132 | 132 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 147 | 147 |
| 148 class SyncBackendHostTest : public testing::Test { | 148 class SyncBackendHostTest : public testing::Test { |
| 149 protected: | 149 protected: |
| 150 SyncBackendHostTest() | 150 SyncBackendHostTest() |
| 151 : thread_bundle_(content::TestBrowserThreadBundle::REAL_IO_THREAD), | 151 : thread_bundle_(content::TestBrowserThreadBundle::REAL_IO_THREAD), |
| 152 profile_manager_(TestingBrowserProcess::GetGlobal()), | 152 profile_manager_(TestingBrowserProcess::GetGlobal()), |
| 153 fake_manager_(NULL) {} | 153 fake_manager_(NULL) {} |
| 154 | 154 |
| 155 virtual ~SyncBackendHostTest() {} | 155 virtual ~SyncBackendHostTest() {} |
| 156 | 156 |
| 157 virtual void SetUp() OVERRIDE { | 157 virtual void SetUp() override { |
| 158 ASSERT_TRUE(profile_manager_.SetUp()); | 158 ASSERT_TRUE(profile_manager_.SetUp()); |
| 159 profile_ = profile_manager_.CreateTestingProfile(kTestProfileName); | 159 profile_ = profile_manager_.CreateTestingProfile(kTestProfileName); |
| 160 sync_prefs_.reset(new sync_driver::SyncPrefs(profile_->GetPrefs())); | 160 sync_prefs_.reset(new sync_driver::SyncPrefs(profile_->GetPrefs())); |
| 161 backend_.reset(new SyncBackendHostImpl( | 161 backend_.reset(new SyncBackendHostImpl( |
| 162 profile_->GetDebugName(), | 162 profile_->GetDebugName(), |
| 163 profile_, | 163 profile_, |
| 164 invalidation::ProfileInvalidationProviderFactory::GetForProfile( | 164 invalidation::ProfileInvalidationProviderFactory::GetForProfile( |
| 165 profile_)->GetInvalidationService(), | 165 profile_)->GetInvalidationService(), |
| 166 sync_prefs_->AsWeakPtr(), | 166 sync_prefs_->AsWeakPtr(), |
| 167 base::FilePath(kTestSyncDir))); | 167 base::FilePath(kTestSyncDir))); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 181 enabled_types_.Put(syncer::DEVICE_INFO); | 181 enabled_types_.Put(syncer::DEVICE_INFO); |
| 182 enabled_types_.Put(syncer::PREFERENCES); | 182 enabled_types_.Put(syncer::PREFERENCES); |
| 183 enabled_types_.Put(syncer::SESSIONS); | 183 enabled_types_.Put(syncer::SESSIONS); |
| 184 enabled_types_.Put(syncer::SEARCH_ENGINES); | 184 enabled_types_.Put(syncer::SEARCH_ENGINES); |
| 185 enabled_types_.Put(syncer::AUTOFILL); | 185 enabled_types_.Put(syncer::AUTOFILL); |
| 186 enabled_types_.Put(syncer::EXPERIMENTS); | 186 enabled_types_.Put(syncer::EXPERIMENTS); |
| 187 | 187 |
| 188 network_resources_.reset(new syncer::HttpBridgeNetworkResources()); | 188 network_resources_.reset(new syncer::HttpBridgeNetworkResources()); |
| 189 } | 189 } |
| 190 | 190 |
| 191 virtual void TearDown() OVERRIDE { | 191 virtual void TearDown() override { |
| 192 if (backend_) { | 192 if (backend_) { |
| 193 backend_->StopSyncingForShutdown(); | 193 backend_->StopSyncingForShutdown(); |
| 194 backend_->Shutdown(syncer::STOP_SYNC); | 194 backend_->Shutdown(syncer::STOP_SYNC); |
| 195 } | 195 } |
| 196 backend_.reset(); | 196 backend_.reset(); |
| 197 sync_prefs_.reset(); | 197 sync_prefs_.reset(); |
| 198 profile_ = NULL; | 198 profile_ = NULL; |
| 199 profile_manager_.DeleteTestingProfile(kTestProfileName); | 199 profile_manager_.DeleteTestingProfile(kTestProfileName); |
| 200 // Pump messages posted by the sync thread (which may end up | 200 // Pump messages posted by the sync thread (which may end up |
| 201 // posting on the IO thread). | 201 // posting on the IO thread). |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 Difference(syncer::ModelTypeSet::All(), | 768 Difference(syncer::ModelTypeSet::All(), |
| 769 enabled_types_), | 769 enabled_types_), |
| 770 syncer::ModelTypeSet()); | 770 syncer::ModelTypeSet()); |
| 771 EXPECT_FALSE(fake_manager_->GetTypesWithEmptyProgressMarkerToken( | 771 EXPECT_FALSE(fake_manager_->GetTypesWithEmptyProgressMarkerToken( |
| 772 error_types).Empty()); | 772 error_types).Empty()); |
| 773 } | 773 } |
| 774 | 774 |
| 775 } // namespace | 775 } // namespace |
| 776 | 776 |
| 777 } // namespace browser_sync | 777 } // namespace browser_sync |
| OLD | NEW |