| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/provider/chrome/browser/test_chrome_browser_provider.h" | 5 #include "ios/public/provider/chrome/browser/test_chrome_browser_provider.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "ios/public/provider/chrome/browser/distribution/test_app_distribution_
provider.h" | 12 #include "ios/public/provider/chrome/browser/distribution/test_app_distribution_
provider.h" |
| 13 #include "ios/public/provider/chrome/browser/omaha/omaha_service_provider.h" | 13 #include "ios/public/provider/chrome/browser/omaha/test_omaha_service_provider.h
" |
| 14 #include "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service
.h" | 14 #include "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service
.h" |
| 15 #include "ios/public/provider/chrome/browser/signin/test_signin_resources_provid
er.h" |
| 15 #import "ios/public/provider/chrome/browser/voice/test_voice_search_provider.h" | 16 #import "ios/public/provider/chrome/browser/voice/test_voice_search_provider.h" |
| 16 #import "ios/public/provider/chrome/browser/voice/voice_search_language.h" | 17 #import "ios/public/provider/chrome/browser/voice/voice_search_language.h" |
| 17 | 18 |
| 18 @interface TestStyledTextField : UITextField<TextFieldStyling> | 19 @interface TestStyledTextField : UITextField<TextFieldStyling> |
| 19 @end | 20 @end |
| 20 | 21 |
| 21 @implementation TestStyledTextField | 22 @implementation TestStyledTextField |
| 22 @synthesize placeholderStyle = _placeholderStyle; | 23 @synthesize placeholderStyle = _placeholderStyle; |
| 23 @synthesize textValidator = _textValidator; | 24 @synthesize textValidator = _textValidator; |
| 24 | 25 |
| 25 - (void)setUseErrorStyling:(BOOL)error { | 26 - (void)setUseErrorStyling:(BOOL)error { |
| 26 } | 27 } |
| 27 @end | 28 @end |
| 28 | 29 |
| 29 namespace ios { | 30 namespace ios { |
| 30 | 31 |
| 31 TestChromeBrowserProvider::TestChromeBrowserProvider() | 32 TestChromeBrowserProvider::TestChromeBrowserProvider() |
| 32 : app_distribution_provider_( | 33 : app_distribution_provider_( |
| 33 base::MakeUnique<TestAppDistributionProvider>()), | 34 base::MakeUnique<TestAppDistributionProvider>()), |
| 34 omaha_service_provider_(base::MakeUnique<OmahaServiceProvider>()), | 35 omaha_service_provider_(base::MakeUnique<TestOmahaServiceProvider>()), |
| 36 signin_resources_provider_( |
| 37 base::MakeUnique<TestSigninResourcesProvider>()), |
| 35 voice_search_provider_(base::MakeUnique<TestVoiceSearchProvider>()) {} | 38 voice_search_provider_(base::MakeUnique<TestVoiceSearchProvider>()) {} |
| 36 | 39 |
| 37 TestChromeBrowserProvider::~TestChromeBrowserProvider() {} | 40 TestChromeBrowserProvider::~TestChromeBrowserProvider() {} |
| 38 | 41 |
| 39 // static | 42 // static |
| 40 TestChromeBrowserProvider* TestChromeBrowserProvider::GetTestProvider() { | 43 TestChromeBrowserProvider* TestChromeBrowserProvider::GetTestProvider() { |
| 41 ChromeBrowserProvider* provider = GetChromeBrowserProvider(); | 44 ChromeBrowserProvider* provider = GetChromeBrowserProvider(); |
| 42 DCHECK(provider); | 45 DCHECK(provider); |
| 43 return static_cast<TestChromeBrowserProvider*>(provider); | 46 return static_cast<TestChromeBrowserProvider*>(provider); |
| 44 } | 47 } |
| 45 | 48 |
| 49 SigninResourcesProvider* |
| 50 TestChromeBrowserProvider::GetSigninResourcesProvider() { |
| 51 return signin_resources_provider_.get(); |
| 52 } |
| 53 |
| 46 void TestChromeBrowserProvider::SetChromeIdentityServiceForTesting( | 54 void TestChromeBrowserProvider::SetChromeIdentityServiceForTesting( |
| 47 std::unique_ptr<ChromeIdentityService> service) { | 55 std::unique_ptr<ChromeIdentityService> service) { |
| 48 chrome_identity_service_.swap(service); | 56 chrome_identity_service_.swap(service); |
| 49 } | 57 } |
| 50 | 58 |
| 51 ChromeIdentityService* TestChromeBrowserProvider::GetChromeIdentityService() { | 59 ChromeIdentityService* TestChromeBrowserProvider::GetChromeIdentityService() { |
| 52 if (!chrome_identity_service_) { | 60 if (!chrome_identity_service_) { |
| 53 chrome_identity_service_.reset(new FakeChromeIdentityService()); | 61 chrome_identity_service_.reset(new FakeChromeIdentityService()); |
| 54 } | 62 } |
| 55 return chrome_identity_service_.get(); | 63 return chrome_identity_service_.get(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 77 const { | 85 const { |
| 78 return omaha_service_provider_.get(); | 86 return omaha_service_provider_.get(); |
| 79 } | 87 } |
| 80 | 88 |
| 81 id<NativeAppWhitelistManager> | 89 id<NativeAppWhitelistManager> |
| 82 TestChromeBrowserProvider::GetNativeAppWhitelistManager() const { | 90 TestChromeBrowserProvider::GetNativeAppWhitelistManager() const { |
| 83 return nil; | 91 return nil; |
| 84 } | 92 } |
| 85 | 93 |
| 86 } // namespace ios | 94 } // namespace ios |
| OLD | NEW |