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

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

Issue 442043002: ProfileManager doesn't depend on "--login-profile" switch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc ('k') | no next file » | 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_manager.h" 5 #include "chrome/test/base/testing_profile_manager.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_special_storage_policy.h" 9 #include "chrome/browser/extensions/extension_special_storage_policy.h"
10 #include "chrome/browser/prefs/pref_service_syncable.h" 10 #include "chrome/browser/prefs/pref_service_syncable.h"
11 #include "chrome/browser/profiles/profile_info_cache.h" 11 #include "chrome/browser/profiles/profile_info_cache.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/common/chrome_constants.h"
13 #include "chrome/test/base/testing_browser_process.h" 14 #include "chrome/test/base/testing_browser_process.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
17 #if defined(OS_CHROMEOS)
18 #include "chrome/browser/chromeos/profiles/profile_helper.h"
19 #endif
20
16 const std::string kGuestProfileName = "Guest"; 21 const std::string kGuestProfileName = "Guest";
17 22
18 namespace testing { 23 namespace testing {
19 24
20 class ProfileManager : public ::ProfileManagerWithoutInit { 25 class ProfileManager : public ::ProfileManagerWithoutInit {
21 public: 26 public:
22 explicit ProfileManager(const base::FilePath& user_data_dir) 27 explicit ProfileManager(const base::FilePath& user_data_dir)
23 : ::ProfileManagerWithoutInit(user_data_dir) {} 28 : ::ProfileManagerWithoutInit(user_data_dir) {}
24 29
25 protected: 30 protected:
(...skipping 27 matching lines...) Expand all
53 const std::string& profile_name, 58 const std::string& profile_name,
54 scoped_ptr<PrefServiceSyncable> prefs, 59 scoped_ptr<PrefServiceSyncable> prefs,
55 const base::string16& user_name, 60 const base::string16& user_name,
56 int avatar_id, 61 int avatar_id,
57 const std::string& supervised_user_id, 62 const std::string& supervised_user_id,
58 const TestingProfile::TestingFactories& factories) { 63 const TestingProfile::TestingFactories& factories) {
59 DCHECK(called_set_up_); 64 DCHECK(called_set_up_);
60 65
61 // Create a path for the profile based on the name. 66 // Create a path for the profile based on the name.
62 base::FilePath profile_path(profiles_dir_.path()); 67 base::FilePath profile_path(profiles_dir_.path());
68 #if defined(OS_CHROMEOS)
69 if (profile_name != chrome::kInitialProfile) {
70 profile_path =
71 profile_path.Append(chromeos::ProfileHelper::Get()->GetUserProfileDir(
72 chromeos::ProfileHelper::GetUserIdHashByUserIdForTesting(
73 profile_name)));
74 } else {
75 profile_path = profile_path.AppendASCII(profile_name);
76 }
77 #else
63 profile_path = profile_path.AppendASCII(profile_name); 78 profile_path = profile_path.AppendASCII(profile_name);
79 #endif
64 80
65 // Create the profile and register it. 81 // Create the profile and register it.
66 TestingProfile::Builder builder; 82 TestingProfile::Builder builder;
67 builder.SetPath(profile_path); 83 builder.SetPath(profile_path);
68 builder.SetPrefService(prefs.Pass()); 84 builder.SetPrefService(prefs.Pass());
69 builder.SetSupervisedUserId(supervised_user_id); 85 builder.SetSupervisedUserId(supervised_user_id);
70 86
71 for (TestingProfile::TestingFactories::const_iterator it = factories.begin(); 87 for (TestingProfile::TestingFactories::const_iterator it = factories.begin();
72 it != factories.end(); ++it) { 88 it != factories.end(); ++it) {
73 builder.AddTestingFactory(it->first, it->second); 89 builder.AddTestingFactory(it->first, it->second);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 << "ProfileManager already exists"; 204 << "ProfileManager already exists";
189 205
190 // Set up the directory for profiles. 206 // Set up the directory for profiles.
191 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); 207 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir());
192 208
193 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); 209 profile_manager_ = new testing::ProfileManager(profiles_dir_.path());
194 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. 210 browser_process_->SetProfileManager(profile_manager_); // Takes ownership.
195 211
196 called_set_up_ = true; 212 called_set_up_ = true;
197 } 213 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698