| 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/file_util.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 14 #include "base/test/test_timeouts.h" | 14 #include "base/test/test_timeouts.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/invalidation/invalidation_service_factory.h" | 16 #include "chrome/browser/invalidation/profile_invalidation_provider.h" |
| 17 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 17 #include "chrome/browser/prefs/pref_service_syncable.h" | 18 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 18 #include "chrome/browser/sync/glue/device_info.h" | 19 #include "chrome/browser/sync/glue/device_info.h" |
| 19 #include "chrome/browser/sync/glue/synced_device_tracker.h" | 20 #include "chrome/browser/sync/glue/synced_device_tracker.h" |
| 20 #include "chrome/test/base/testing_browser_process.h" | 21 #include "chrome/test/base/testing_browser_process.h" |
| 21 #include "chrome/test/base/testing_profile.h" | 22 #include "chrome/test/base/testing_profile.h" |
| 22 #include "chrome/test/base/testing_profile_manager.h" | 23 #include "chrome/test/base/testing_profile_manager.h" |
| 23 #include "components/invalidation/invalidator_storage.h" | 24 #include "components/invalidation/invalidator_storage.h" |
| 24 #include "components/sync_driver/sync_frontend.h" | 25 #include "components/sync_driver/sync_frontend.h" |
| 25 #include "components/sync_driver/sync_prefs.h" | 26 #include "components/sync_driver/sync_prefs.h" |
| 26 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 153 |
| 153 virtual ~SyncBackendHostTest() {} | 154 virtual ~SyncBackendHostTest() {} |
| 154 | 155 |
| 155 virtual void SetUp() OVERRIDE { | 156 virtual void SetUp() OVERRIDE { |
| 156 ASSERT_TRUE(profile_manager_.SetUp()); | 157 ASSERT_TRUE(profile_manager_.SetUp()); |
| 157 profile_ = profile_manager_.CreateTestingProfile(kTestProfileName); | 158 profile_ = profile_manager_.CreateTestingProfile(kTestProfileName); |
| 158 sync_prefs_.reset(new sync_driver::SyncPrefs(profile_->GetPrefs())); | 159 sync_prefs_.reset(new sync_driver::SyncPrefs(profile_->GetPrefs())); |
| 159 backend_.reset(new SyncBackendHostImpl( | 160 backend_.reset(new SyncBackendHostImpl( |
| 160 profile_->GetDebugName(), | 161 profile_->GetDebugName(), |
| 161 profile_, | 162 profile_, |
| 162 invalidation::InvalidationServiceFactory::GetForProfile(profile_), | 163 invalidation::ProfileInvalidationProviderFactory::GetForProfile( |
| 164 profile_)->GetInvalidationService(), |
| 163 sync_prefs_->AsWeakPtr(), | 165 sync_prefs_->AsWeakPtr(), |
| 164 base::FilePath(kTestSyncDir))); | 166 base::FilePath(kTestSyncDir))); |
| 165 credentials_.email = "user@example.com"; | 167 credentials_.email = "user@example.com"; |
| 166 credentials_.sync_token = "sync_token"; | 168 credentials_.sync_token = "sync_token"; |
| 167 | 169 |
| 168 fake_manager_factory_.reset(new FakeSyncManagerFactory(&fake_manager_)); | 170 fake_manager_factory_.reset(new FakeSyncManagerFactory(&fake_manager_)); |
| 169 | 171 |
| 170 // These types are always implicitly enabled. | 172 // These types are always implicitly enabled. |
| 171 enabled_types_.PutAll(syncer::ControlTypes()); | 173 enabled_types_.PutAll(syncer::ControlTypes()); |
| 172 | 174 |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 ASSERT_NE(-1, base::WriteFile(sync_file, nonsense, strlen(nonsense))); | 726 ASSERT_NE(-1, base::WriteFile(sync_file, nonsense, strlen(nonsense))); |
| 725 | 727 |
| 726 InitializeBackend(true); | 728 InitializeBackend(true); |
| 727 | 729 |
| 728 EXPECT_FALSE(base::PathExists(sync_file)); | 730 EXPECT_FALSE(base::PathExists(sync_file)); |
| 729 } | 731 } |
| 730 | 732 |
| 731 } // namespace | 733 } // namespace |
| 732 | 734 |
| 733 } // namespace browser_sync | 735 } // namespace browser_sync |
| OLD | NEW |