Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(578)

Side by Side Diff: chrome/test/base/testing_profile.cc

Issue 11968032: Move 'theme' parsing out of Extension class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed IncognitoAutofillManagerTest unittest Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/base/testing_profile.h ('k') | chrome/utility/chrome_content_utility_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 base::Unretained(this))); 201 base::Unretained(this)));
202 } else { 202 } else {
203 FinishInit(); 203 FinishInit();
204 } 204 }
205 } 205 }
206 206
207 TestingProfile::TestingProfile( 207 TestingProfile::TestingProfile(
208 const base::FilePath& path, 208 const base::FilePath& path,
209 Delegate* delegate, 209 Delegate* delegate,
210 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy, 210 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy,
211 scoped_ptr<PrefServiceSyncable> prefs, 211 scoped_ptr<PrefServiceSyncable> prefs)
212 bool off_the_record)
213 : start_time_(Time::Now()), 212 : start_time_(Time::Now()),
214 prefs_(prefs.release()), 213 prefs_(prefs.release()),
215 testing_prefs_(NULL), 214 testing_prefs_(NULL),
216 incognito_(off_the_record), 215 incognito_(false),
217 last_session_exited_cleanly_(true), 216 last_session_exited_cleanly_(true),
218 extension_special_storage_policy_(extension_policy), 217 extension_special_storage_policy_(extension_policy),
219 profile_path_(path), 218 profile_path_(path),
220 profile_dependency_manager_(ProfileDependencyManager::GetInstance()), 219 profile_dependency_manager_(ProfileDependencyManager::GetInstance()),
221 delegate_(delegate) { 220 delegate_(delegate) {
222 221
223 // If no profile path was supplied, create one. 222 // If no profile path was supplied, create one.
224 if (profile_path_.empty()) { 223 if (profile_path_.empty()) {
225 CreateTempProfileDir(); 224 CreateTempProfileDir();
226 profile_path_ = temp_dir_.path(); 225 profile_path_ = temp_dir_.path();
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 #if defined(ENABLE_CONFIGURATION_POLICY) 545 #if defined(ENABLE_CONFIGURATION_POLICY)
547 policy::PolicyServiceImpl::Providers providers; 546 policy::PolicyServiceImpl::Providers providers;
548 policy_service_.reset(new policy::PolicyServiceImpl(providers)); 547 policy_service_.reset(new policy::PolicyServiceImpl(providers));
549 #else 548 #else
550 policy_service_.reset(new policy::PolicyServiceStub()); 549 policy_service_.reset(new policy::PolicyServiceStub());
551 #endif 550 #endif
552 } 551 }
553 return policy_service_.get(); 552 return policy_service_.get();
554 } 553 }
555 554
556 void TestingProfile::SetPrefService(PrefServiceSyncable* prefs) {
557 prefs_.reset(prefs);
558 }
559
560 void TestingProfile::CreateTestingPrefService() { 555 void TestingProfile::CreateTestingPrefService() {
561 DCHECK(!prefs_.get()); 556 DCHECK(!prefs_.get());
562 testing_prefs_ = new TestingPrefServiceSyncable(); 557 testing_prefs_ = new TestingPrefServiceSyncable();
563 prefs_.reset(testing_prefs_); 558 prefs_.reset(testing_prefs_);
564 Profile::RegisterUserPrefs(testing_prefs_->registry()); 559 Profile::RegisterUserPrefs(testing_prefs_->registry());
565 chrome::RegisterUserPrefs(testing_prefs_, testing_prefs_->registry()); 560 chrome::RegisterUserPrefs(testing_prefs_, testing_prefs_->registry());
566 } 561 }
567 562
568 PrefService* TestingProfile::GetPrefs() { 563 PrefService* TestingProfile::GetPrefs() {
569 if (!prefs_.get()) { 564 if (!prefs_.get()) {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { 777 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) {
783 return true; 778 return true;
784 } 779 }
785 780
786 Profile::ExitType TestingProfile::GetLastSessionExitType() { 781 Profile::ExitType TestingProfile::GetLastSessionExitType() {
787 return last_session_exited_cleanly_ ? EXIT_NORMAL : EXIT_CRASHED; 782 return last_session_exited_cleanly_ ? EXIT_NORMAL : EXIT_CRASHED;
788 } 783 }
789 784
790 TestingProfile::Builder::Builder() 785 TestingProfile::Builder::Builder()
791 : build_called_(false), 786 : build_called_(false),
792 delegate_(NULL), 787 delegate_(NULL) {
793 off_the_record_(false) {
794 } 788 }
795 789
796 TestingProfile::Builder::~Builder() { 790 TestingProfile::Builder::~Builder() {
797 } 791 }
798 792
799 void TestingProfile::Builder::SetPath(const base::FilePath& path) { 793 void TestingProfile::Builder::SetPath(const base::FilePath& path) {
800 path_ = path; 794 path_ = path;
801 } 795 }
802 796
803 void TestingProfile::Builder::SetDelegate(Delegate* delegate) { 797 void TestingProfile::Builder::SetDelegate(Delegate* delegate) {
804 delegate_ = delegate; 798 delegate_ = delegate;
805 } 799 }
806 800
807 void TestingProfile::Builder::SetExtensionSpecialStoragePolicy( 801 void TestingProfile::Builder::SetExtensionSpecialStoragePolicy(
808 scoped_refptr<ExtensionSpecialStoragePolicy> policy) { 802 scoped_refptr<ExtensionSpecialStoragePolicy> policy) {
809 extension_policy_ = policy; 803 extension_policy_ = policy;
810 } 804 }
811 805
812 void TestingProfile::Builder::SetPrefService( 806 void TestingProfile::Builder::SetPrefService(
813 scoped_ptr<PrefServiceSyncable> prefs) { 807 scoped_ptr<PrefServiceSyncable> prefs) {
814 pref_service_ = prefs.Pass(); 808 pref_service_ = prefs.Pass();
815 } 809 }
816 810
817 void TestingProfile::Builder::SetOffTheRecord() {
818 off_the_record_ = true;
819 }
820
821 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { 811 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() {
822 DCHECK(!build_called_); 812 DCHECK(!build_called_);
823 build_called_ = true; 813 build_called_ = true;
824 return scoped_ptr<TestingProfile>(new TestingProfile( 814 return scoped_ptr<TestingProfile>(new TestingProfile(
825 path_, 815 path_,
826 delegate_, 816 delegate_,
827 extension_policy_, 817 extension_policy_,
828 pref_service_.Pass(), 818 pref_service_.Pass()));
829 off_the_record_));
830 } 819 }
OLDNEW
« no previous file with comments | « chrome/test/base/testing_profile.h ('k') | chrome/utility/chrome_content_utility_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698