Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / ios / public / test / test_keyed_service_provider.cc
blob5566fa33ae8d273f3a6a0cf8a90cbcbbc3dfe925
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
3 // found in the LICENSE file.
5 #include "ios/public/test/test_keyed_service_provider.h"
7 #include "base/logging.h"
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/singleton.h"
11 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
12 #include "components/keyed_service/core/keyed_service.h"
13 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
14 #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
15 #include "components/sync_driver/fake_sync_service.h"
16 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h"
17 #include "ios/public/test/fake_sync_service_factory.h"
19 namespace ios {
20 namespace {
22 class MissingServiceKeyedServiceFactory
23 : public BrowserStateKeyedServiceFactory {
24 public:
25 static MissingServiceKeyedServiceFactory* GetInstance();
27 private:
28 friend struct DefaultSingletonTraits<MissingServiceKeyedServiceFactory>;
30 MissingServiceKeyedServiceFactory();
31 ~MissingServiceKeyedServiceFactory() override;
33 // BrowserStateKeyedServiceFactory implementation.
34 scoped_ptr<KeyedService> BuildServiceInstanceFor(
35 web::BrowserState* context) const override;
37 DISALLOW_COPY_AND_ASSIGN(MissingServiceKeyedServiceFactory);
40 // static
41 MissingServiceKeyedServiceFactory*
42 MissingServiceKeyedServiceFactory::GetInstance() {
43 return Singleton<MissingServiceKeyedServiceFactory>::get();
46 MissingServiceKeyedServiceFactory::MissingServiceKeyedServiceFactory()
47 : BrowserStateKeyedServiceFactory(
48 "MissingService",
49 BrowserStateDependencyManager::GetInstance()) {
52 MissingServiceKeyedServiceFactory::~MissingServiceKeyedServiceFactory() {
55 scoped_ptr<KeyedService>
56 MissingServiceKeyedServiceFactory::BuildServiceInstanceFor(
57 web::BrowserState* context) const {
58 NOTREACHED();
59 return nullptr;
62 } // namespace
64 TestKeyedServiceProvider::TestKeyedServiceProvider() {
67 TestKeyedServiceProvider::~TestKeyedServiceProvider() {
70 KeyedServiceBaseFactory*
71 TestKeyedServiceProvider::GetManagedBookmarkServiceFactory() {
72 return MissingServiceKeyedServiceFactory::GetInstance();
75 bookmarks::ManagedBookmarkService*
76 TestKeyedServiceProvider::GetManagedBookmarkServiceForBrowserState(
77 ChromeBrowserState* browser_state) {
78 return nullptr;
81 KeyedServiceBaseFactory* TestKeyedServiceProvider::GetSyncServiceFactory() {
82 return FakeSyncServiceFactory::GetInstance();
85 sync_driver::SyncService*
86 TestKeyedServiceProvider::GetSyncServiceForBrowserState(
87 ChromeBrowserState* browser_state) {
88 return FakeSyncServiceFactory::GetForBrowserState(browser_state);
91 KeyedServiceBaseFactory*
92 TestKeyedServiceProvider::GetProfileInvalidationProviderFactory() {
93 return MissingServiceKeyedServiceFactory::GetInstance();
96 invalidation::ProfileInvalidationProvider*
97 TestKeyedServiceProvider::GetProfileInvalidationProviderForBrowserState(
98 ios::ChromeBrowserState* browser_state) {
99 return nullptr;
102 } // namespace ios