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_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" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 DCHECK(called_set_up_); | 53 DCHECK(called_set_up_); |
54 | 54 |
55 // Create a path for the profile based on the name. | 55 // Create a path for the profile based on the name. |
56 base::FilePath profile_path(profiles_dir_.path()); | 56 base::FilePath profile_path(profiles_dir_.path()); |
57 profile_path = profile_path.AppendASCII(profile_name); | 57 profile_path = profile_path.AppendASCII(profile_name); |
58 | 58 |
59 // Create the profile and register it. | 59 // Create the profile and register it. |
60 TestingProfile::Builder builder; | 60 TestingProfile::Builder builder; |
61 builder.SetPath(profile_path); | 61 builder.SetPath(profile_path); |
62 builder.SetPrefService(prefs.Pass()); | 62 builder.SetPrefService(prefs.Pass()); |
| 63 builder.SetManagedUserId(managed_user_id); |
| 64 |
63 TestingProfile* profile = builder.Build().release(); | 65 TestingProfile* profile = builder.Build().release(); |
64 profile_manager_->AddProfile(profile); // Takes ownership. | 66 profile_manager_->AddProfile(profile); // Takes ownership. |
65 | 67 |
66 // Update the user metadata. | 68 // Update the user metadata. |
67 ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); | 69 ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); |
68 size_t index = cache.GetIndexOfProfileWithPath(profile_path); | 70 size_t index = cache.GetIndexOfProfileWithPath(profile_path); |
69 cache.SetAvatarIconOfProfileAtIndex(index, avatar_id); | 71 cache.SetAvatarIconOfProfileAtIndex(index, avatar_id); |
70 cache.SetManagedUserIdOfProfileAtIndex(index, managed_user_id); | 72 cache.SetManagedUserIdOfProfileAtIndex(index, managed_user_id); |
71 // SetNameOfProfileAtIndex may reshuffle the list of profiles, so we do it | 73 // SetNameOfProfileAtIndex may reshuffle the list of profiles, so we do it |
72 // last. | 74 // last. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 << "ProfileManager already exists"; | 128 << "ProfileManager already exists"; |
127 | 129 |
128 // Set up the directory for profiles. | 130 // Set up the directory for profiles. |
129 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); | 131 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); |
130 | 132 |
131 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); | 133 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); |
132 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. | 134 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. |
133 | 135 |
134 called_set_up_ = true; | 136 called_set_up_ = true; |
135 } | 137 } |
OLD | NEW |