| 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(profile)), | 52 make_scoped_ptr(new browser_sync::ChromeSyncClient( |
| 53 profile, |
| 54 make_scoped_ptr(new SyncApiComponentFactoryMock()))), |
| 53 make_scoped_ptr<SigninManagerWrapper>(NULL), | 55 make_scoped_ptr<SigninManagerWrapper>(NULL), |
| 54 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 56 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 55 browser_sync::MANUAL_START, | 57 browser_sync::MANUAL_START, |
| 56 base::Bind(&EmptyNetworkTimeUpdate), | 58 base::Bind(&EmptyNetworkTimeUpdate), |
| 57 profile->GetPath(), | 59 profile->GetPath(), |
| 58 profile->GetRequestContext(), | 60 profile->GetRequestContext(), |
| 59 profile->GetDebugName(), | 61 profile->GetDebugName(), |
| 60 chrome::GetChannel(), | 62 chrome::GetChannel(), |
| 61 content::BrowserThread::GetMessageLoopProxyForThread( | 63 content::BrowserThread::GetMessageLoopProxyForThread( |
| 62 content::BrowserThread::DB), | 64 content::BrowserThread::DB), |
| 63 content::BrowserThread::GetMessageLoopProxyForThread( | 65 content::BrowserThread::GetMessageLoopProxyForThread( |
| 64 content::BrowserThread::FILE), | 66 content::BrowserThread::FILE), |
| 65 content::BrowserThread::GetBlockingPool()), | 67 content::BrowserThread::GetBlockingPool()), |
| 66 sync_initialized_(true), | 68 sync_initialized_(true), |
| 67 initialized_state_violation_(false) { | 69 initialized_state_violation_(false) {} |
| 68 static_cast<browser_sync::ChromeSyncClient*>(GetSyncClient()) | |
| 69 ->SetSyncApiComponentFactoryForTesting( | |
| 70 make_scoped_ptr(new SyncApiComponentFactoryMock())); | |
| 71 } | |
| 72 | 70 |
| 73 ~FakeProfileSyncService() override {} | 71 ~FakeProfileSyncService() override {} |
| 74 | 72 |
| 75 static scoped_ptr<KeyedService> BuildFakeProfileSyncService( | 73 static scoped_ptr<KeyedService> BuildFakeProfileSyncService( |
| 76 content::BrowserContext* context) { | 74 content::BrowserContext* context) { |
| 77 return make_scoped_ptr( | 75 return make_scoped_ptr( |
| 78 new FakeProfileSyncService(static_cast<Profile*>(context))); | 76 new FakeProfileSyncService(static_cast<Profile*>(context))); |
| 79 } | 77 } |
| 80 | 78 |
| 81 void set_sync_initialized(bool sync_initialized) { | 79 void set_sync_initialized(bool sync_initialized) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 204 |
| 207 // Verifies that we wait for the sync service to be ready before checking | 205 // Verifies that we wait for the sync service to be ready before checking |
| 208 // encryption status. | 206 // encryption status. |
| 209 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest, | 207 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest, |
| 210 GetSyncCategoriesWithoutPassphraseAsynchronous) { | 208 GetSyncCategoriesWithoutPassphraseAsynchronous) { |
| 211 service_->set_sync_initialized(false); | 209 service_->set_sync_initialized(false); |
| 212 TestGetSyncCategoriesWithoutPassphraseFunction(); | 210 TestGetSyncCategoriesWithoutPassphraseFunction(); |
| 213 } | 211 } |
| 214 | 212 |
| 215 } // namespace | 213 } // namespace |
| OLD | NEW |