#include "chrome/browser/apps/user_type_filter.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/values.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/profiles/profile_test_util.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace apps {
namespace {
base::Value::Dict CreateJsonWithFilter(
const std::vector<std::string>& user_types) { … }
}
class UserTypeFilterTest : public testing::Test { … };
TEST_F(UserTypeFilterTest, ChildUser) { … }
TEST_F(UserTypeFilterTest, GuestUser) { … }
TEST_F(UserTypeFilterTest, ManagedUser) { … }
#if BUILDFLAG(IS_CHROMEOS)
TEST_F(UserTypeFilterTest, ManagedGuestUser) {
profiles::testing::ScopedTestManagedGuestSession test_managed_guest_session;
const auto profile = CreateProfile();
profile->GetProfilePolicyConnector()->OverrideIsManagedForTesting(true);
EXPECT_FALSE(Match(profile, CreateJsonWithFilter({kUserTypeManaged})));
EXPECT_TRUE(Match(profile, CreateJsonWithFilter({kUserTypeManagedGuest})));
EXPECT_TRUE(Match(profile, CreateJsonWithFilter(
{kUserTypeUnmanaged, kUserTypeManagedGuest})));
}
#endif
TEST_F(UserTypeFilterTest, UnmanagedUser) { … }
TEST_F(UserTypeFilterTest, EmptyFilter) { … }
TEST_F(UserTypeFilterTest, DefaultFilter) { … }
}