#include <memory>
#include <utility>
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
#include "chrome/browser/extensions/extension_service_user_test_base.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/browser_task_environment.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
#include "components/account_id/account_id.h"
#include "components/user_manager/scoped_user_manager.h"
#include "components/user_manager/user_names.h"
#endif
namespace extensions {
ExtensionServiceUserTestBase::ExtensionServiceUserTestBase() = default;
ExtensionServiceUserTestBase::~ExtensionServiceUserTestBase() = default;
ExtensionServiceUserTestBase::ExtensionServiceUserTestBase(
std::unique_ptr<content::BrowserTaskEnvironment> task_environment)
: … { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
void ExtensionServiceUserTestBase::SetUp() {
ExtensionServiceTestBase::SetUp();
scoped_user_manager_ = std::make_unique<user_manager::ScopedUserManager>(
std::make_unique<ash::FakeChromeUserManager>());
account_id_ =
AccountId::FromUserEmailGaiaId("[email protected]", "1234567890");
}
void ExtensionServiceUserTestBase::TearDown() {
ExtensionServiceTestBase::TearDown();
scoped_user_manager_.reset();
}
void ExtensionServiceUserTestBase::LoginChromeOSAshUser(
const user_manager::User* user,
const AccountId& account_id) {
ASSERT_TRUE(user);
GetFakeUserManager()->LoginUser(account_id,
false);
ASSERT_TRUE(GetFakeUserManager()->IsUserLoggedIn());
ASSERT_TRUE(user == GetFakeUserManager()->GetActiveUser());
}
#endif
void ExtensionServiceUserTestBase::MaybeSetUpTestUser(bool is_guest) { … }
}