Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ios / chrome / test / testing_application_context.cc
blob5c0edc7e065defe07e90c0c5c5f52a124442d428
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 #include "ios/chrome/test/testing_application_context.h"
7 #include "base/logging.h"
8 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
10 TestingApplicationContext::TestingApplicationContext()
11 : application_locale_("en"), local_state_(nullptr) {
12 DCHECK(!GetApplicationContext());
13 SetApplicationContext(this);
16 TestingApplicationContext::~TestingApplicationContext() {
17 DCHECK_EQ(this, GetApplicationContext());
18 SetApplicationContext(nullptr);
21 void TestingApplicationContext::SetLocalState(PrefService* local_state) {
22 DCHECK(thread_checker_.CalledOnValidThread());
23 local_state_ = local_state;
26 // static
27 TestingApplicationContext* TestingApplicationContext::GetGlobal() {
28 return static_cast<TestingApplicationContext*>(GetApplicationContext());
31 PrefService* TestingApplicationContext::GetLocalState() {
32 DCHECK(thread_checker_.CalledOnValidThread());
33 return local_state_;
36 net::URLRequestContextGetter*
37 TestingApplicationContext::GetSystemURLRequestContext() {
38 DCHECK(thread_checker_.CalledOnValidThread());
39 return ios::GetChromeBrowserProvider()->GetSystemURLRequestContext();
42 const std::string& TestingApplicationContext::GetApplicationLocale() {
43 DCHECK(thread_checker_.CalledOnValidThread());
44 DCHECK(!application_locale_.empty());
45 return application_locale_;