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

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

Issue 23868042: Mark supervised profiles as such immediately when they're created. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 7 years, 2 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/test/base/testing_profile.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"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « chrome/test/base/testing_profile.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698