OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/test/base/testing_profile.h" | 5 #include "chrome/test/base/testing_profile.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
810 } | 810 } |
811 profile_policy_connector_.reset(new policy::ProfilePolicyConnector()); | 811 profile_policy_connector_.reset(new policy::ProfilePolicyConnector()); |
812 profile_policy_connector_->InitForTesting(policy_service_.Pass()); | 812 profile_policy_connector_->InitForTesting(policy_service_.Pass()); |
813 policy::ProfilePolicyConnectorFactory::GetInstance()->SetServiceForTesting( | 813 policy::ProfilePolicyConnectorFactory::GetInstance()->SetServiceForTesting( |
814 this, profile_policy_connector_.get()); | 814 this, profile_policy_connector_.get()); |
815 CHECK_EQ(profile_policy_connector_.get(), | 815 CHECK_EQ(profile_policy_connector_.get(), |
816 policy::ProfilePolicyConnectorFactory::GetForProfile(this)); | 816 policy::ProfilePolicyConnectorFactory::GetForProfile(this)); |
817 } | 817 } |
818 | 818 |
819 PrefService* TestingProfile::GetPrefs() { | 819 PrefService* TestingProfile::GetPrefs() { |
820 return const_cast<PrefService*>( | |
821 static_cast<const TestingProfile*>(this)->GetPrefs()); | |
sky
2015/02/05 17:00:58
Shouldn't this be const_cast here too? I would hav
Ilya Sherman
2015/02/05 21:24:58
You only need to const_cast in order to drop a con
| |
822 } | |
823 | |
824 const PrefService* TestingProfile::GetPrefs() const { | |
820 DCHECK(prefs_); | 825 DCHECK(prefs_); |
821 return prefs_.get(); | 826 return prefs_.get(); |
822 } | 827 } |
823 | 828 |
824 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { | 829 DownloadManagerDelegate* TestingProfile::GetDownloadManagerDelegate() { |
825 return NULL; | 830 return NULL; |
826 } | 831 } |
827 | 832 |
828 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { | 833 net::URLRequestContextGetter* TestingProfile::GetRequestContext() { |
829 return GetDefaultStoragePartition(this)->GetURLRequestContext(); | 834 return GetDefaultStoragePartition(this)->GetURLRequestContext(); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1083 #if defined(ENABLE_EXTENSIONS) | 1088 #if defined(ENABLE_EXTENSIONS) |
1084 extension_policy_, | 1089 extension_policy_, |
1085 #endif | 1090 #endif |
1086 pref_service_.Pass(), | 1091 pref_service_.Pass(), |
1087 original_profile, | 1092 original_profile, |
1088 guest_session_, | 1093 guest_session_, |
1089 supervised_user_id_, | 1094 supervised_user_id_, |
1090 policy_service_.Pass(), | 1095 policy_service_.Pass(), |
1091 testing_factories_); | 1096 testing_factories_); |
1092 } | 1097 } |
OLD | NEW |