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/invalidator_storage.h" | 16 #include "chrome/browser/invalidation/invalidator_storage.h" |
17 #include "chrome/browser/prefs/pref_service_syncable.h" | 17 #include "chrome/browser/prefs/pref_service_syncable.h" |
18 #include "chrome/browser/sync/glue/device_info.h" | 18 #include "chrome/browser/sync/glue/device_info.h" |
19 #include "chrome/browser/sync/glue/synced_device_tracker.h" | 19 #include "chrome/browser/sync/glue/synced_device_tracker.h" |
20 #include "chrome/browser/sync/sync_prefs.h" | |
21 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
22 #include "components/sync_driver/sync_frontend.h" | 21 #include "components/sync_driver/sync_frontend.h" |
| 22 #include "components/sync_driver/sync_prefs.h" |
23 #include "components/user_prefs/pref_registry_syncable.h" | 23 #include "components/user_prefs/pref_registry_syncable.h" |
24 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
25 #include "content/public/test/test_browser_thread_bundle.h" | 25 #include "content/public/test/test_browser_thread_bundle.h" |
26 #include "content/public/test/test_utils.h" | 26 #include "content/public/test/test_utils.h" |
27 #include "google/cacheinvalidation/include/types.h" | 27 #include "google/cacheinvalidation/include/types.h" |
28 #include "net/url_request/test_url_fetcher_factory.h" | 28 #include "net/url_request/test_url_fetcher_factory.h" |
29 #include "sync/internal_api/public/base/model_type.h" | 29 #include "sync/internal_api/public/base/model_type.h" |
30 #include "sync/internal_api/public/engine/model_safe_worker.h" | 30 #include "sync/internal_api/public/engine/model_safe_worker.h" |
31 #include "sync/internal_api/public/http_bridge_network_resources.h" | 31 #include "sync/internal_api/public/http_bridge_network_resources.h" |
32 #include "sync/internal_api/public/network_resources.h" | 32 #include "sync/internal_api/public/network_resources.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 class SyncBackendHostTest : public testing::Test { | 128 class SyncBackendHostTest : public testing::Test { |
129 protected: | 129 protected: |
130 SyncBackendHostTest() | 130 SyncBackendHostTest() |
131 : thread_bundle_(content::TestBrowserThreadBundle::REAL_IO_THREAD), | 131 : thread_bundle_(content::TestBrowserThreadBundle::REAL_IO_THREAD), |
132 fake_manager_(NULL) {} | 132 fake_manager_(NULL) {} |
133 | 133 |
134 virtual ~SyncBackendHostTest() {} | 134 virtual ~SyncBackendHostTest() {} |
135 | 135 |
136 virtual void SetUp() OVERRIDE { | 136 virtual void SetUp() OVERRIDE { |
137 profile_.reset(new TestingProfile()); | 137 profile_.reset(new TestingProfile()); |
138 sync_prefs_.reset(new SyncPrefs(profile_->GetPrefs())); | 138 sync_prefs_.reset(new sync_driver::SyncPrefs(profile_->GetPrefs())); |
139 backend_.reset(new SyncBackendHostImpl( | 139 backend_.reset(new SyncBackendHostImpl( |
140 profile_->GetDebugName(), | 140 profile_->GetDebugName(), |
141 profile_.get(), | 141 profile_.get(), |
142 sync_prefs_->AsWeakPtr())); | 142 sync_prefs_->AsWeakPtr())); |
143 credentials_.email = "user@example.com"; | 143 credentials_.email = "user@example.com"; |
144 credentials_.sync_token = "sync_token"; | 144 credentials_.sync_token = "sync_token"; |
145 | 145 |
146 fake_manager_factory_.reset(new FakeSyncManagerFactory(&fake_manager_)); | 146 fake_manager_factory_.reset(new FakeSyncManagerFactory(&fake_manager_)); |
147 | 147 |
148 // These types are always implicitly enabled. | 148 // These types are always implicitly enabled. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 248 } |
249 | 249 |
250 void OnDownloadRetry() { | 250 void OnDownloadRetry() { |
251 NOTIMPLEMENTED(); | 251 NOTIMPLEMENTED(); |
252 } | 252 } |
253 | 253 |
254 content::TestBrowserThreadBundle thread_bundle_; | 254 content::TestBrowserThreadBundle thread_bundle_; |
255 StrictMock<MockSyncFrontend> mock_frontend_; | 255 StrictMock<MockSyncFrontend> mock_frontend_; |
256 syncer::SyncCredentials credentials_; | 256 syncer::SyncCredentials credentials_; |
257 scoped_ptr<TestingProfile> profile_; | 257 scoped_ptr<TestingProfile> profile_; |
258 scoped_ptr<SyncPrefs> sync_prefs_; | 258 scoped_ptr<sync_driver::SyncPrefs> sync_prefs_; |
259 scoped_ptr<SyncBackendHost> backend_; | 259 scoped_ptr<SyncBackendHost> backend_; |
260 scoped_ptr<FakeSyncManagerFactory> fake_manager_factory_; | 260 scoped_ptr<FakeSyncManagerFactory> fake_manager_factory_; |
261 FakeSyncManager* fake_manager_; | 261 FakeSyncManager* fake_manager_; |
262 syncer::ModelTypeSet enabled_types_; | 262 syncer::ModelTypeSet enabled_types_; |
263 scoped_ptr<syncer::NetworkResources> network_resources_; | 263 scoped_ptr<syncer::NetworkResources> network_resources_; |
264 }; | 264 }; |
265 | 265 |
266 // Test basic initialization with no initial types (first time initialization). | 266 // Test basic initialization with no initial types (first time initialization). |
267 // Only the nigori should be configured. | 267 // Only the nigori should be configured. |
268 TEST_F(SyncBackendHostTest, InitShutdown) { | 268 TEST_F(SyncBackendHostTest, InitShutdown) { |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 ASSERT_NE(-1, base::WriteFile(sync_file, nonsense, strlen(nonsense))); | 700 ASSERT_NE(-1, base::WriteFile(sync_file, nonsense, strlen(nonsense))); |
701 | 701 |
702 InitializeBackend(true); | 702 InitializeBackend(true); |
703 | 703 |
704 EXPECT_FALSE(base::PathExists(sync_file)); | 704 EXPECT_FALSE(base::PathExists(sync_file)); |
705 } | 705 } |
706 | 706 |
707 } // namespace | 707 } // namespace |
708 | 708 |
709 } // namespace browser_sync | 709 } // namespace browser_sync |
OLD | NEW |