chromium/components/supervised_user/core/browser/supervised_user_service_unittest.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/supervised_user/core/browser/supervised_user_service.h"

#include <memory>
#include <string>
#include <utility>

#include "base/memory/raw_ptr.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/gtest_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/prefs/testing_pref_service.h"
#include "components/signin/public/base/consent_level.h"
#include "components/signin/public/identity_manager/account_capabilities_test_mutator.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "components/supervised_user/core/browser/supervised_user_preferences.h"
#include "components/supervised_user/core/browser/supervised_user_settings_service.h"
#include "components/supervised_user/core/browser/supervised_user_utils.h"
#include "components/supervised_user/core/common/features.h"
#include "components/supervised_user/core/common/pref_names.h"
#include "components/supervised_user/core/common/supervised_user_constants.h"
#include "components/supervised_user/test_support/supervised_user_url_filter_test_utils.h"
#include "components/sync/test/mock_sync_service.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace supervised_user {

namespace {

const char kExampleUrl0[] =;
const char kExampleUrl1[] =;

}  // namespace

class SupervisedUserServiceTestBase : public ::testing::Test {};

class SupervisedUserServiceTest : public SupervisedUserServiceTestBase {};

// Tests that web approvals are enabled for supervised users.
TEST_F(SupervisedUserServiceTest, ApprovalRequestsEnabled) {}

// Tests that restricting all site navigation is applied to supervised users.
TEST_F(SupervisedUserServiceTest, UrlIsBlockedForUser) {}

// Tests that allowing all site navigation is applied to supervised users.
TEST_F(SupervisedUserServiceTest, UrlIsAllowedForUser) {}

// Tests that changes in parent configuration for web filter types are recorded.
TEST_F(SupervisedUserServiceTest, WebFilterTypeOnPrefsChange) {}

// Tests that changes to the allow or blocklist of the parent configuration are
// recorded.
TEST_F(SupervisedUserServiceTest, ManagedSiteListTypeMetricOnPrefsChange) {}

TEST_F(SupervisedUserServiceTest, InterstitialBannerState) {}

class SupervisedUserServiceTestUnsupervised
    : public SupervisedUserServiceTestBase {};

// Tests that web approvals are not enabled for unsupervised users.
TEST_F(SupervisedUserServiceTestUnsupervised, ApprovalRequestsDisabled) {}

// Tests that supervision restrictions do not apply to unsupervised users.
TEST_F(SupervisedUserServiceTestUnsupervised, UrlIsAllowedForUser) {}

// TODO(crbug.com/1364589): Failing consistently on linux-chromeos-dbg
// due to failed timezone conversion assertion.
#if BUILDFLAG(IS_CHROMEOS)
#define MAYBE_DeprecatedFilterPolicy
#else
#define MAYBE_DeprecatedFilterPolicy
#endif
TEST_F(SupervisedUserServiceTest, MAYBE_DeprecatedFilterPolicy) {}

}  // namespace supervised_user