OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/public/test/fake_sync_service_factory.h" | 5 #include "ios/public/test/fake_sync_service_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "components/keyed_service/core/keyed_service.h" | 9 #include "components/keyed_service/core/keyed_service.h" |
10 #include "components/keyed_service/ios/browser_state_dependency_manager.h" | 10 #include "components/keyed_service/ios/browser_state_dependency_manager.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 private: | 24 private: |
25 sync_driver::FakeSyncService fake_sync_service_; | 25 sync_driver::FakeSyncService fake_sync_service_; |
26 }; | 26 }; |
27 | 27 |
28 } // namespace | 28 } // namespace |
29 | 29 |
30 namespace ios { | 30 namespace ios { |
31 | 31 |
32 // static | 32 // static |
33 FakeSyncServiceFactory* FakeSyncServiceFactory::GetInstance() { | 33 FakeSyncServiceFactory* FakeSyncServiceFactory::GetInstance() { |
34 return Singleton<FakeSyncServiceFactory>::get(); | 34 return base::Singleton<FakeSyncServiceFactory>::get(); |
35 } | 35 } |
36 | 36 |
37 // static | 37 // static |
38 sync_driver::FakeSyncService* FakeSyncServiceFactory::GetForBrowserState( | 38 sync_driver::FakeSyncService* FakeSyncServiceFactory::GetForBrowserState( |
39 ios::ChromeBrowserState* browser_state) { | 39 ios::ChromeBrowserState* browser_state) { |
40 return static_cast<KeyedFakeSyncService*>( | 40 return static_cast<KeyedFakeSyncService*>( |
41 FakeSyncServiceFactory::GetInstance()->GetServiceForBrowserState( | 41 FakeSyncServiceFactory::GetInstance()->GetServiceForBrowserState( |
42 browser_state, true))->fake_sync_service(); | 42 browser_state, true))->fake_sync_service(); |
43 } | 43 } |
44 | 44 |
45 FakeSyncServiceFactory::FakeSyncServiceFactory() | 45 FakeSyncServiceFactory::FakeSyncServiceFactory() |
46 : BrowserStateKeyedServiceFactory( | 46 : BrowserStateKeyedServiceFactory( |
47 "FakeSyncService", | 47 "FakeSyncService", |
48 BrowserStateDependencyManager::GetInstance()) { | 48 BrowserStateDependencyManager::GetInstance()) { |
49 } | 49 } |
50 | 50 |
51 FakeSyncServiceFactory::~FakeSyncServiceFactory() { | 51 FakeSyncServiceFactory::~FakeSyncServiceFactory() { |
52 } | 52 } |
53 | 53 |
54 scoped_ptr<KeyedService> FakeSyncServiceFactory::BuildServiceInstanceFor( | 54 scoped_ptr<KeyedService> FakeSyncServiceFactory::BuildServiceInstanceFor( |
55 web::BrowserState* context) const { | 55 web::BrowserState* context) const { |
56 return make_scoped_ptr(new KeyedFakeSyncService); | 56 return make_scoped_ptr(new KeyedFakeSyncService); |
57 } | 57 } |
58 | 58 |
59 } // namespace ios | 59 } // namespace ios |
OLD | NEW |