#include "chrome/browser/extensions/test_extension_environment.h"
#include <utility>
#include "base/command_line.h"
#include "base/json/json_writer.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/sessions/session_tab_helper_factory.h"
#include "chrome/test/base/testing_profile.h"
#include "components/sessions/content/session_tab_helper.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "content/public/test/web_contents_tester.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/common/extension_builder.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/login/users/chrome_user_manager_impl.h"
#include "chrome/browser/ash/settings/device_settings_service.h"
#include "chrome/browser/ash/settings/scoped_cros_settings_test_helper.h"
#include "components/user_manager/scoped_user_manager.h"
#endif
namespace extensions {
BrowserThread;
namespace {
base::Value::Dict MakeExtensionManifest(
const base::Value::Dict& manifest_extra) { … }
base::Value::Dict MakePackagedAppManifest() { … }
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
class TestExtensionEnvironment::ChromeOSEnv {
public:
ChromeOSEnv() = default;
ChromeOSEnv(const ChromeOSEnv&) = delete;
ChromeOSEnv& operator=(const ChromeOSEnv&) = delete;
private:
ash::ScopedCrosSettingsTestHelper cros_settings_test_helper_;
user_manager::ScopedUserManager test_user_manager_{
ash::ChromeUserManagerImpl::CreateChromeUserManager()};
};
#endif
ExtensionService* TestExtensionEnvironment::CreateExtensionServiceForProfile(
TestingProfile* profile) { … }
TestExtensionEnvironment::TestExtensionEnvironment(
Type type,
ProfileCreationType profile_creation_mode
#if BUILDFLAG(IS_CHROMEOS_ASH)
,
OSSetupType os_setup_mode
#endif
)
: … { … }
TestExtensionEnvironment::~TestExtensionEnvironment() = default;
void TestExtensionEnvironment::SetProfile(TestingProfile* profile) { … }
TestingProfile* TestExtensionEnvironment::profile() const { … }
TestExtensionSystem* TestExtensionEnvironment::GetExtensionSystem() { … }
ExtensionService* TestExtensionEnvironment::GetExtensionService() { … }
ExtensionPrefs* TestExtensionEnvironment::GetExtensionPrefs() { … }
const Extension* TestExtensionEnvironment::MakeExtension(
const base::Value::Dict& manifest_extra) { … }
const Extension* TestExtensionEnvironment::MakeExtension(
const base::Value::Dict& manifest_extra,
const std::string& id) { … }
scoped_refptr<const Extension> TestExtensionEnvironment::MakePackagedApp(
const std::string& id,
bool install) { … }
std::unique_ptr<content::WebContents> TestExtensionEnvironment::MakeTab()
const { … }
void TestExtensionEnvironment::DeleteProfile() { … }
}