chromium/chrome/browser/ui/webui/policy/policy_test_ui_browsertest.cc

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

#include <stddef.h>

#include <string_view>

#include "base/test/mock_callback.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/enterprise/browser_management/browser_management_service.h"
#include "chrome/browser/enterprise/browser_management/management_service_factory.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector_builder.h"
#include "chrome/browser/policy/schema_registry_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_impl.h"
#include "chrome/browser/ui/webui/policy/policy_ui.h"
#include "chrome/browser/ui/webui/policy/policy_ui_handler.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/chrome_test_utils.h"
#include "chrome/test/base/platform_browser_test.h"
#include "chrome/test/base/testing_browser_process.h"
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/common/configuration_policy_provider.h"
#include "components/policy/core/common/local_test_policy_provider.h"
#include "components/policy/core/common/management/management_service.h"
#include "components/policy/core/common/management/scoped_management_service_override_for_testing.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_namespace.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/policy/core/common/policy_types.h"
#include "components/policy/core/common/policy_utils.h"
#include "components/policy/policy_constants.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/base/signin_pref_names.h"
#include "components/version_info/channel.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_web_ui.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"

#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/ui/browser.h"
#endif

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS)
#include "chrome/browser/first_run/scoped_relaunch_chrome_browser_override.h"
#endif

_;
Return;

namespace {
class PolicyTestPageVisibilityTest
    : public PlatformBrowserTest,
      public ::testing::WithParamInterface<std::tuple<bool, bool, bool>> {};

// Verify that the chrome://policy/test page is visible only when both the flag
// and policy are enabled, and invisible otherwise.
IN_PROC_BROWSER_TEST_P(PolicyTestPageVisibilityTest,
                       TestPageVisibleWhenEnabled) {}

INSTANTIATE_TEST_SUITE_P();

class PolicyTestHandlerTest : public PlatformBrowserTest {};

IN_PROC_BROWSER_TEST_F(PolicyTestHandlerTest,
                       HandleSetLocalTestPoliciesNotSupported) {}

IN_PROC_BROWSER_TEST_F(PolicyTestHandlerTest,
                       HandleSetAndRevertLocalTestPolicies) {}

IN_PROC_BROWSER_TEST_F(PolicyTestHandlerTest, FilterSensitivePolicies) {}

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS)
// TODO(b:293632195) Implement test on android and chromeos
// Test that test policies stored in the pref kLocalTestPoliciesForNextStartup
// are applied after restart.
IN_PROC_BROWSER_TEST_F(PolicyTestHandlerTest,
                       PRE_PRE_ApplyTestPoliciesAfterRestart) {}

IN_PROC_BROWSER_TEST_F(PolicyTestHandlerTest,
                       PRE_ApplyTestPoliciesAfterRestart) {}

IN_PROC_BROWSER_TEST_F(PolicyTestHandlerTest, ApplyTestPoliciesAfterRestart) {}

class PolicyTestHandlerTestDisabledByPolicy : public PolicyTestHandlerTest {};

IN_PROC_BROWSER_TEST_F(PolicyTestHandlerTestDisabledByPolicy,
                       PRE_PRE_ApplyTestPoliciesAfterRestart) {}

IN_PROC_BROWSER_TEST_F(PolicyTestHandlerTestDisabledByPolicy,
                       PRE_ApplyTestPoliciesAfterRestart) {}

IN_PROC_BROWSER_TEST_F(PolicyTestHandlerTestDisabledByPolicy,
                       ApplyTestPoliciesAfterRestart) {}
#endif  // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS)

namespace {

const char kExtensionId[] =;
const char kExtensionSchemaJson[] =;

class PolicyTestUITest : public PlatformBrowserTest {};
}  // namespace

IN_PROC_BROWSER_TEST_F(PolicyTestUITest, TestRowAddedWhenAddPolicyClicked) {}

IN_PROC_BROWSER_TEST_F(PolicyTestUITest, TestRowDeletedWhenRemoveClicked) {}

IN_PROC_BROWSER_TEST_F(PolicyTestUITest, TestPresetAutofill) {}

IN_PROC_BROWSER_TEST_F(PolicyTestUITest, GetSchema) {}

IN_PROC_BROWSER_TEST_F(PolicyTestUITest, TestExtensionPoliciesIncluded) {}

IN_PROC_BROWSER_TEST_F(PolicyTestUITest, TestSchemaChangeReflected) {}

IN_PROC_BROWSER_TEST_F(PolicyTestUITest, TestPolicyNameChangesInputType) {}

IN_PROC_BROWSER_TEST_F(PolicyTestUITest, TestErrorStateWhenNameNotSelected) {}

IN_PROC_BROWSER_TEST_F(PolicyTestUITest, TestIncorrectValueTypeRaisesError) {}

IN_PROC_BROWSER_TEST_F(PolicyTestUITest, TestClearPoliciesButton) {}
}  // namespace