#include "chrome/test/base/testing_profile_manager.h"
#include <stddef.h>
#include <utility>
#include "base/feature_list.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/not_fatal_until.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/test_file_util.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_destroyer.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/fake_profile_manager.h"
#include "chrome/test/base/testing_browser_process.h"
#include "components/supervised_user/core/common/supervised_user_constants.h"
#include "components/sync_preferences/pref_service_syncable.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "chromeos/ash/components/browser_context_helper/browser_context_types.h"
#include "components/account_id/account_id.h"
#include "components/user_manager/fake_user_manager.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chrome/browser/lacros/account_manager/account_profile_mapper.h"
#endif
const char kGuestProfileName[] = …;
#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID)
const char kSystemProfileName[] = …;
#endif
TestingProfileManager::TestingProfileManager(TestingBrowserProcess* process)
: … { … }
TestingProfileManager::TestingProfileManager(
TestingBrowserProcess* process,
ScopedTestingLocalState* local_state)
: … { … }
TestingProfileManager::~TestingProfileManager() { … }
bool TestingProfileManager::SetUp(
const base::FilePath& profiles_path,
std::unique_ptr<ProfileManager> profile_manager) { … }
TestingProfile* TestingProfileManager::CreateTestingProfile(
const std::string& profile_name,
std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs,
const std::u16string& user_name,
int avatar_id,
TestingProfile::TestingFactories testing_factories,
bool is_supervised_profile,
std::optional<bool> is_new_profile,
std::optional<std::unique_ptr<policy::PolicyService>> policy_service,
bool is_main_profile,
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory) { … }
TestingProfile* TestingProfileManager::CreateTestingProfile(
const std::string& name,
bool is_main_profile,
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory) { … }
TestingProfile* TestingProfileManager::CreateTestingProfile(
const std::string& name,
TestingProfile::TestingFactories testing_factories,
bool is_main_profile,
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory) { … }
TestingProfile* TestingProfileManager::CreateGuestProfile() { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID)
TestingProfile* TestingProfileManager::CreateSystemProfile() { … }
#endif
void TestingProfileManager::DeleteTestingProfile(const std::string& name) { … }
void TestingProfileManager::DeleteAllTestingProfiles() { … }
void TestingProfileManager::DeleteGuestProfile() { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID)
void TestingProfileManager::DeleteSystemProfile() { … }
#endif
void TestingProfileManager::DeleteProfileAttributesStorage() { … }
base::FilePath TestingProfileManager::GetProfilePath(
const std::string& profile_name) { … }
#if BUILDFLAG(IS_CHROMEOS_LACROS)
void TestingProfileManager::SetAccountProfileMapper(
std::unique_ptr<AccountProfileMapper> mapper) {
DCHECK(!profile_manager_->account_profile_mapper_)
<< "AccountProfileMapper must be set before the first usage";
profile_manager_->account_profile_mapper_ = std::move(mapper);
}
#endif
const base::FilePath& TestingProfileManager::profiles_dir() { … }
ProfileManager* TestingProfileManager::profile_manager() { … }
ProfileAttributesStorage* TestingProfileManager::profile_attributes_storage() { … }
void TestingProfileManager::OnProfileWillBeDestroyed(Profile* profile) { … }
void TestingProfileManager::SetUpInternal(
const base::FilePath& profiles_path,
std::unique_ptr<ProfileManager> profile_manager) { … }