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
3 // found in the LICENSE file.
5 #ifndef IOS_CHROME_TEST_TESTING_APPLICATION_CONTEXT_H_
6 #define IOS_CHROME_TEST_TESTING_APPLICATION_CONTEXT_H_
8 #include "base/macros.h"
9 #include "base/threading/thread_checker.h"
10 #include "ios/chrome/browser/application_context.h"
12 class TestingApplicationContext
: public ApplicationContext
{
14 TestingApplicationContext();
15 ~TestingApplicationContext() override
;
17 // Convenience method to get the current application context as a
18 // TestingApplicationContext.
19 static TestingApplicationContext
* GetGlobal();
21 // Sets the local state.
22 void SetLocalState(PrefService
* local_state
);
24 // Sets the ChromeBrowserStateManager.
25 void SetChromeBrowserStateManager(ios::ChromeBrowserStateManager
* manager
);
27 // ApplicationContext implementation.
28 PrefService
* GetLocalState() override
;
29 net::URLRequestContextGetter
* GetSystemURLRequestContext() override
;
30 const std::string
& GetApplicationLocale() override
;
31 ios::ChromeBrowserStateManager
* GetChromeBrowserStateManager() override
;
32 metrics::MetricsService
* GetMetricsService() override
;
33 policy::BrowserPolicyConnector
* GetBrowserPolicyConnector() override
;
34 rappor::RapporService
* GetRapporService() override
;
37 base::ThreadChecker thread_checker_
;
38 std::string application_locale_
;
39 PrefService
* local_state_
;
40 ios::ChromeBrowserStateManager
* chrome_browser_state_manager_
;
42 DISALLOW_COPY_AND_ASSIGN(TestingApplicationContext
);
45 #endif // IOS_CHROME_TEST_TESTING_APPLICATION_CONTEXT_H_