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

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

Issue 1693383003: ChromeOS cryptohome should be able to use gaia id as user identifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit tests. Created 4 years, 9 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.cc ('k') | chromeos/BUILD.gn » ('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_manager.h" 5 #include "chrome/test/base/testing_profile_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 #else 81 #else
82 profile_path = profile_path.AppendASCII(profile_name); 82 profile_path = profile_path.AppendASCII(profile_name);
83 #endif 83 #endif
84 84
85 // Create the profile and register it. 85 // Create the profile and register it.
86 TestingProfile::Builder builder; 86 TestingProfile::Builder builder;
87 builder.SetPath(profile_path); 87 builder.SetPath(profile_path);
88 builder.SetPrefService(std::move(prefs)); 88 builder.SetPrefService(std::move(prefs));
89 builder.SetSupervisedUserId(supervised_user_id); 89 builder.SetSupervisedUserId(supervised_user_id);
90 builder.SetProfileName(profile_name);
90 91
91 for (TestingProfile::TestingFactories::const_iterator it = factories.begin(); 92 for (TestingProfile::TestingFactories::const_iterator it = factories.begin();
92 it != factories.end(); ++it) { 93 it != factories.end(); ++it) {
93 builder.AddTestingFactory(it->first, it->second); 94 builder.AddTestingFactory(it->first, it->second);
94 } 95 }
95 96
96 TestingProfile* profile = builder.Build().release(); 97 TestingProfile* profile = builder.Build().release();
97 profile->set_profile_name(profile_name);
98 profile_manager_->AddProfile(profile); // Takes ownership. 98 profile_manager_->AddProfile(profile); // Takes ownership.
99 99
100 // Update the user metadata. 100 // Update the user metadata.
101 ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); 101 ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache();
102 size_t index = cache.GetIndexOfProfileWithPath(profile_path); 102 size_t index = cache.GetIndexOfProfileWithPath(profile_path);
103 cache.SetAvatarIconOfProfileAtIndex(index, avatar_id); 103 cache.SetAvatarIconOfProfileAtIndex(index, avatar_id);
104 cache.SetSupervisedUserIdOfProfileAtIndex(index, supervised_user_id); 104 cache.SetSupervisedUserIdOfProfileAtIndex(index, supervised_user_id);
105 // SetNameOfProfileAtIndex may reshuffle the list of profiles, so we do it 105 // SetNameOfProfileAtIndex may reshuffle the list of profiles, so we do it
106 // last. 106 // last.
107 cache.SetNameOfProfileAtIndex(index, user_name); 107 cache.SetNameOfProfileAtIndex(index, user_name);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // Set up the directory for profiles. 247 // Set up the directory for profiles.
248 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); 248 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir());
249 249
250 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); 250 profile_manager_ = new testing::ProfileManager(profiles_dir_.path());
251 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. 251 browser_process_->SetProfileManager(profile_manager_); // Takes ownership.
252 252
253 profile_manager_->GetProfileInfoCache(). 253 profile_manager_->GetProfileInfoCache().
254 set_disable_avatar_download_for_testing(true); 254 set_disable_avatar_download_for_testing(true);
255 called_set_up_ = true; 255 called_set_up_ = true;
256 } 256 }
OLDNEW
« no previous file with comments | « chrome/test/base/testing_profile.cc ('k') | chromeos/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698