chromium/chrome/browser/apps/user_type_filter_unittest.cc

// Copyright 2019 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/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 {

// Helper that simulates Json file with embedded user type filter.
base::Value::Dict CreateJsonWithFilter(
    const std::vector<std::string>& user_types) {}

}  // namespace

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  // BUILDFLAG(IS_CHROMEOS)

TEST_F(UserTypeFilterTest, UnmanagedUser) {}

TEST_F(UserTypeFilterTest, EmptyFilter) {}

TEST_F(UserTypeFilterTest, DefaultFilter) {}

}  // namespace apps