Add ICU message format support
[chromium-blink-merge.git] / ios / public / test / fake_sync_service_factory.cc
blob10fecc988e07ac655749f2df541929c52518fd0e
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/fake_sync_service_factory.h"
7 #include "base/logging.h"
8 #include "base/memory/singleton.h"
9 #include "components/keyed_service/core/keyed_service.h"
10 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
11 #include "components/sync_driver/fake_sync_service.h"
12 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h"
14 namespace {
16 class KeyedFakeSyncService : public KeyedService {
17 public:
18 KeyedFakeSyncService() {}
20 sync_driver::FakeSyncService* fake_sync_service() {
21 return &fake_sync_service_;
24 private:
25 sync_driver::FakeSyncService fake_sync_service_;
28 } // namespace
30 namespace ios {
32 // static
33 FakeSyncServiceFactory* FakeSyncServiceFactory::GetInstance() {
34 return Singleton<FakeSyncServiceFactory>::get();
37 // static
38 sync_driver::FakeSyncService* FakeSyncServiceFactory::GetForBrowserState(
39 ios::ChromeBrowserState* browser_state) {
40 return static_cast<KeyedFakeSyncService*>(
41 FakeSyncServiceFactory::GetInstance()->GetServiceForBrowserState(
42 browser_state, true))->fake_sync_service();
45 FakeSyncServiceFactory::FakeSyncServiceFactory()
46 : BrowserStateKeyedServiceFactory(
47 "FakeSyncService",
48 BrowserStateDependencyManager::GetInstance()) {
51 FakeSyncServiceFactory::~FakeSyncServiceFactory() {
54 scoped_ptr<KeyedService> FakeSyncServiceFactory::BuildServiceInstanceFor(
55 web::BrowserState* context) const {
56 return make_scoped_ptr(new KeyedFakeSyncService);
59 } // namespace ios