blob: cdcdb13f07e7c7b943bea02b0f66ea6273dc463d [file] [log] [blame]
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/web_applications/test/with_crosapi_param.h"
#include "build/chromeos_buildflags.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_features.h"
#include "chrome/common/chrome_features.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
namespace web_app {
namespace test {
WithCrosapiParam::WithCrosapiParam() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
if (GetParam() == CrosapiParam::kEnabled) {
scoped_feature_list_.InitWithFeatures(
{ash::features::kLacrosSupport, ash::features::kLacrosPrimary,
ash::features::kLacrosOnly,
// Disable profile migration to avoid potential Ash restart.
ash::features::kLacrosProfileMigrationForceOff,
features::kWebAppsCrosapi},
{});
} else {
scoped_feature_list_.InitWithFeatures(
{}, {features::kWebAppsCrosapi, ash::features::kLacrosSupport,
ash::features::kLacrosPrimary, ash::features::kLacrosOnly});
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
}
WithCrosapiParam::~WithCrosapiParam() = default;
// static
std::string WithCrosapiParam::ParamToString(
testing::TestParamInfo<CrosapiParam> param) {
switch (param.param) {
case CrosapiParam::kDisabled:
return "WebAppsCrosapiDisabled";
case CrosapiParam::kEnabled:
return "WebAppsCrosapiEnabled";
}
}
} // namespace test
} // namespace web_app