| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #endif | 42 #endif |
| 43 | 43 |
| 44 using extensions::PreferencesPrivateGetSyncCategoriesWithoutPassphraseFunction; | 44 using extensions::PreferencesPrivateGetSyncCategoriesWithoutPassphraseFunction; |
| 45 | 45 |
| 46 namespace { | 46 namespace { |
| 47 | 47 |
| 48 class FakeProfileSyncService : public ProfileSyncService { | 48 class FakeProfileSyncService : public ProfileSyncService { |
| 49 public: | 49 public: |
| 50 explicit FakeProfileSyncService(Profile* profile) | 50 explicit FakeProfileSyncService(Profile* profile) |
| 51 : ProfileSyncService( | 51 : ProfileSyncService( |
| 52 make_scoped_ptr(new browser_sync::ChromeSyncClient( | 52 make_scoped_ptr(new browser_sync::ChromeSyncClient(profile)), |
| 53 profile, | |
| 54 make_scoped_ptr(new SyncApiComponentFactoryMock()))), | |
| 55 make_scoped_ptr<SigninManagerWrapper>(NULL), | 53 make_scoped_ptr<SigninManagerWrapper>(NULL), |
| 56 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 54 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 57 browser_sync::MANUAL_START, | 55 browser_sync::MANUAL_START, |
| 58 base::Bind(&EmptyNetworkTimeUpdate), | 56 base::Bind(&EmptyNetworkTimeUpdate), |
| 59 profile->GetPath(), | 57 profile->GetPath(), |
| 60 profile->GetRequestContext(), | 58 profile->GetRequestContext(), |
| 61 profile->GetDebugName(), | 59 profile->GetDebugName(), |
| 62 chrome::GetChannel(), | 60 chrome::GetChannel(), |
| 63 content::BrowserThread::GetMessageLoopProxyForThread( | 61 content::BrowserThread::GetMessageLoopProxyForThread( |
| 64 content::BrowserThread::DB), | 62 content::BrowserThread::DB), |
| 65 content::BrowserThread::GetMessageLoopProxyForThread( | 63 content::BrowserThread::GetMessageLoopProxyForThread( |
| 66 content::BrowserThread::FILE), | 64 content::BrowserThread::FILE), |
| 67 content::BrowserThread::GetBlockingPool()), | 65 content::BrowserThread::GetBlockingPool()), |
| 68 sync_initialized_(true), | 66 sync_initialized_(true), |
| 69 initialized_state_violation_(false) {} | 67 initialized_state_violation_(false) { |
| 68 static_cast<browser_sync::ChromeSyncClient*>(GetSyncClient()) |
| 69 ->SetSyncApiComponentFactoryForTesting( |
| 70 make_scoped_ptr(new SyncApiComponentFactoryMock())); |
| 71 } |
| 70 | 72 |
| 71 ~FakeProfileSyncService() override {} | 73 ~FakeProfileSyncService() override {} |
| 72 | 74 |
| 73 static scoped_ptr<KeyedService> BuildFakeProfileSyncService( | 75 static scoped_ptr<KeyedService> BuildFakeProfileSyncService( |
| 74 content::BrowserContext* context) { | 76 content::BrowserContext* context) { |
| 75 return make_scoped_ptr( | 77 return make_scoped_ptr( |
| 76 new FakeProfileSyncService(static_cast<Profile*>(context))); | 78 new FakeProfileSyncService(static_cast<Profile*>(context))); |
| 77 } | 79 } |
| 78 | 80 |
| 79 void set_sync_initialized(bool sync_initialized) { | 81 void set_sync_initialized(bool sync_initialized) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 206 |
| 205 // Verifies that we wait for the sync service to be ready before checking | 207 // Verifies that we wait for the sync service to be ready before checking |
| 206 // encryption status. | 208 // encryption status. |
| 207 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest, | 209 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest, |
| 208 GetSyncCategoriesWithoutPassphraseAsynchronous) { | 210 GetSyncCategoriesWithoutPassphraseAsynchronous) { |
| 209 service_->set_sync_initialized(false); | 211 service_->set_sync_initialized(false); |
| 210 TestGetSyncCategoriesWithoutPassphraseFunction(); | 212 TestGetSyncCategoriesWithoutPassphraseFunction(); |
| 211 } | 213 } |
| 212 | 214 |
| 213 } // namespace | 215 } // namespace |
| OLD | NEW |