chromium/chrome/browser/ash/policy/handlers/BUILD.gn

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

import("//build/config/chromeos/ui_mode.gni")

assert(is_chromeos_ash)

static_library("handlers") {
  sources = [
    "adb_sideloading_allowance_mode_policy_handler.cc",
    "adb_sideloading_allowance_mode_policy_handler.h",
    "app_launch_automation_policy_handler.cc",
    "app_launch_automation_policy_handler.h",
    "bluetooth_policy_handler.cc",
    "bluetooth_policy_handler.h",
    "configuration_policy_handler_ash.cc",
    "configuration_policy_handler_ash.h",
    "contextual_google_integrations_policies_handler.cc",
    "contextual_google_integrations_policies_handler.h",
    "device_dlc_predownload_list_policy_handler.cc",
    "device_dlc_predownload_list_policy_handler.h",
    "device_dock_mac_address_source_handler.cc",
    "device_dock_mac_address_source_handler.h",
    "device_name_policy_handler.cc",
    "device_name_policy_handler.h",
    "device_name_policy_handler_impl.cc",
    "device_name_policy_handler_impl.h",
    "device_name_policy_handler_name_generator.cc",
    "device_name_policy_handler_name_generator.h",
    "device_wifi_allowed_handler.cc",
    "device_wifi_allowed_handler.h",
    "help_me_read_policy_handler.cc",
    "help_me_read_policy_handler.h",
    "lacros_availability_policy_handler.cc",
    "lacros_availability_policy_handler.h",
    "lacros_selection_policy_handler.cc",
    "lacros_selection_policy_handler.h",
    "lock_to_single_user_manager.cc",
    "lock_to_single_user_manager.h",
    "minimum_version_policy_handler.cc",
    "minimum_version_policy_handler.h",
    "minimum_version_policy_handler_delegate_impl.cc",
    "minimum_version_policy_handler_delegate_impl.h",
    "multi_screen_capture_policy_handler.cc",
    "multi_screen_capture_policy_handler.h",
    "screen_capture_location_policy_handler.cc",
    "screen_capture_location_policy_handler.h",
    "system_proxy_handler.cc",
    "system_proxy_handler.h",
    "tpm_auto_update_mode_policy_handler.cc",
    "tpm_auto_update_mode_policy_handler.h",
  ]

  public_deps = [ "//chrome/browser:browser_public_dependencies" ]

  deps = [
    "//ash",
    "//ash/components/arc:prefs",
    "//ash/constants",
    "//ash/public/cpp",
    "//base",
    "//build:buildflag_header_h",
    "//build:chromeos_buildflags",
    "//chrome/browser:browser_process",
    "//chrome/browser/ash/accessibility",
    "//chrome/browser/ash/crostini",
    "//chrome/browser/ash/login/session",
    "//chrome/browser/ash/plugin_vm",
    "//chrome/browser/ash/policy/core",
    "//chrome/browser/ash/policy/skyvault",
    "//chrome/browser/ash/profiles",
    "//chrome/browser/ash/settings",
    "//chrome/browser/profiles:profile",
    "//chrome/browser/ui/webui/ash/login",
    "//chrome/browser/web_applications",
    "//chrome/common:chrome_features",
    "//chrome/common:constants",
    "//chromeos/ash/components/cryptohome",
    "//chromeos/ash/components/dbus/concierge",
    "//chromeos/ash/components/dbus/dlcservice",
    "//chromeos/ash/components/dbus/session_manager",
    "//chromeos/ash/components/dbus/update_engine",
    "//chromeos/ash/components/dbus/userdataauth",
    "//chromeos/ash/components/dbus/userdataauth:userdataauth_proto",
    "//chromeos/ash/components/install_attributes",
    "//chromeos/ash/components/login/session",
    "//chromeos/ash/components/network",
    "//chromeos/ash/components/settings",
    "//chromeos/ash/components/standalone_browser",
    "//chromeos/ash/components/system",
    "//chromeos/components/onc",
    "//chromeos/dbus/power",
    "//chromeos/dbus/power:power_manager_proto",
    "//components/crx_file",
    "//components/desks_storage",
    "//components/onc",
    "//components/policy:generated",
    "//components/policy/core/browser",
    "//components/policy/core/common",
    "//components/policy/proto:",
    "//components/prefs",
    "//components/session_manager/core",
    "//components/strings:components_strings",
    "//components/user_manager",
    "//crypto",
    "//device/bluetooth",
    "//device/bluetooth/public/cpp",
    "//third_party/protobuf:protobuf_lite",
    "//ui/chromeos",
    "//url",

    # TODO(b/354839582): Use targets having headers included from
    # chrome/browser/ash/policy/handlers/system_proxy_handler.cc.
    "//chromeos/ash/components/dbus/system_proxy:system_proxy_proto",
  ]

  allow_circular_includes_from = [
    "//chrome/browser/ash/login/session",
    "//chrome/browser/ash/policy/core",
    "//chrome/browser/ash/policy/skyvault",
    "//chrome/browser/ash/settings",
  ]
}

static_library("test_support") {
  testonly = true

  sources = [
    "fake_device_name_policy_handler.cc",
    "fake_device_name_policy_handler.h",
    "minimum_version_policy_test_helpers.cc",
    "minimum_version_policy_test_helpers.h",
  ]

  deps = [
    ":handlers",
    "//base",

    # Handling transitive dependency error.
    # TODO: split ash::UpdateEngineClient::Observer into a dedicated file
    # by renaming ash::UpdateEngineClientObserver should resolve this.
    "//chromeos/ash/components/dbus",
  ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "adb_sideloading_allowance_mode_policy_handler_unittest.cc",
    "bluetooth_policy_handler_unittest.cc",
    "configuration_policy_handler_ash_unittest.cc",
    "device_dlc_predownload_list_policy_handler_unittest.cc",
    "device_dock_mac_address_source_handler_unittest.cc",
    "device_name_policy_handler_impl_unittest.cc",
    "device_name_policy_handler_name_generator_unittest.cc",
    "extension_cache_unittest.cc",
    "help_me_read_policy_handler_unittest.cc",
    "lock_to_single_user_manager_unittest.cc",
    "minimum_version_policy_handler_unittest.cc",
    "multi_screen_capture_policy_handler_unittest.cc",
    "screen_capture_location_policy_handler_unittest.cc",
    "system_proxy_handler_unittest.cc",
    "tpm_auto_update_mode_policy_handler_unittest.cc",
  ]

  deps = [
    ":handlers",
    ":test_support",
    "//ash/components/arc",
    "//ash/components/arc:arc_test_support",
    "//ash/components/arc:prefs",
    "//ash/components/arc/session",
    "//ash/constants",
    "//ash/public/cpp",
    "//base",
    "//base/test:test_support",
    "//chrome/browser",
    "//chrome/browser/ash",
    "//chrome/browser/ash/app_list/arc:test_support",
    "//chrome/browser/ash/arc/session",
    "//chrome/browser/ash/arc/test:arc_test_support",
    "//chrome/browser/ash/login/users:test_support",
    "//chrome/browser/ash/net",
    "//chrome/browser/ash/notifications:unit_tests",
    "//chrome/browser/ash/plugin_vm",
    "//chrome/browser/ash/settings",
    "//chrome/browser/ash/settings:test_support",
    "//chrome/browser/extensions",
    "//chrome/browser/ui",
    "//chrome/browser/ui/ash/shelf",
    "//chrome/common:chrome_features",
    "//chrome/common:constants",
    "//chrome/test:test_support",
    "//chromeos/ash/components/dbus",
    "//chromeos/ash/components/dbus/anomaly_detector",
    "//chromeos/ash/components/dbus/chunneld",
    "//chromeos/ash/components/dbus/cicerone",
    "//chromeos/ash/components/dbus/concierge",
    "//chromeos/ash/components/dbus/debug_daemon",
    "//chromeos/ash/components/dbus/dlcservice",
    "//chromeos/ash/components/dbus/seneschal",
    "//chromeos/ash/components/dbus/session_manager",
    "//chromeos/ash/components/dbus/shill",
    "//chromeos/ash/components/dbus/system_proxy",
    "//chromeos/ash/components/dbus/system_proxy:system_proxy_proto",
    "//chromeos/ash/components/dbus/update_engine",
    "//chromeos/ash/components/dbus/userdataauth",
    "//chromeos/ash/components/dbus/vm_plugin_dispatcher",
    "//chromeos/ash/components/install_attributes:test_support",
    "//chromeos/ash/components/login/session",
    "//chromeos/ash/components/network",
    "//chromeos/ash/components/network:test_support",
    "//chromeos/ash/components/settings",
    "//chromeos/ash/components/system",
    "//chromeos/dbus/power",
    "//components/account_id",
    "//components/policy:generated",
    "//components/policy/core/browser",
    "//components/policy/core/common",
    "//components/policy/core/common:common_constants",
    "//components/policy/core/common:test_support",
    "//components/policy/proto:",
    "//components/prefs",
    "//components/prefs:test_support",
    "//components/proxy_config",
    "//components/user_manager",
    "//components/user_manager:test_support",
    "//content/test:test_support",
    "//device/bluetooth",
    "//device/bluetooth:mocks",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/protobuf:protobuf_lite",
  ]
}

source_set("browser_tests") {
  testonly = true

  defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]

  sources = [
    "device_i18n_shortcuts_enabled_browsertest.cc",
    "device_quirks_policy_browsertest.cc",
    "device_system_use_24hour_clock_browsertest.cc",
    "device_system_wide_tracing_enabled_browsertest.cc",
    "minimum_version_policy_handler_browsertest.cc",
    "power_policy_browsertest.cc",
    "restore_on_startup_browsertest.cc",
    "site_isolation_flag_handling_browsertest.cc",
    "variations_service_policy_browsertest.cc",
  ]

  deps = [
    ":handlers",
    ":test_support",
    "//ash:test_support",
    "//ash/constants",
    "//ash/public/cpp",
    "//base",
    "//base",
    "//base/test:test_support",
    "//chrome/browser",
    "//chrome/browser:browser_process",
    "//chrome/browser/ash/app_mode:test_support",
    "//chrome/browser/ash/login",
    "//chrome/browser/ash/login:test_support",
    "//chrome/browser/ash/login/app_mode/test:test_support",
    "//chrome/browser/ash/login/session",
    "//chrome/browser/ash/login/session:test_support",
    "//chrome/browser/ash/login/test:test_support",
    "//chrome/browser/ash/login/ui",
    "//chrome/browser/ash/login/users",
    "//chrome/browser/ash/policy/core",
    "//chrome/browser/ash/policy/core:test_support",
    "//chrome/browser/ash/policy/login:test_support",
    "//chrome/browser/ash/profiles",
    "//chrome/browser/ash/system",
    "//chrome/browser/profiles:profile",
    "//chrome/browser/ui",
    "//chrome/browser/ui/webui/ash/login",
    "//chrome/common:constants",
    "//chrome/test:test_support",
    "//chrome/test:test_support_ui",
    "//chromeos/ash/components/cryptohome",
    "//chromeos/ash/components/dbus",
    "//chromeos/ash/components/dbus/session_manager",
    "//chromeos/ash/components/dbus/shill",
    "//chromeos/ash/components/dbus/update_engine",
    "//chromeos/ash/components/dbus/userdataauth",
    "//chromeos/ash/components/install_attributes:test_support",
    "//chromeos/ash/components/network:test_support",
    "//chromeos/ash/components/settings",
    "//chromeos/dbus/constants",
    "//chromeos/dbus/power",
    "//chromeos/dbus/power:power_manager_proto",
    "//components/account_id",
    "//components/flags_ui",
    "//components/policy:generated",
    "//components/policy/core/browser",
    "//components/policy/core/common",
    "//components/policy/core/common:common_constants",
    "//components/policy/core/common:test_support",
    "//components/policy/proto",
    "//components/prefs",
    "//components/quirks",
    "//components/session_manager/core",
    "//components/user_manager",
    "//components/user_manager:common",
    "//components/variations",
    "//components/variations/service",
    "//content/public/browser",
    "//content/public/common",
    "//content/test:test_support",
    "//extensions/browser/api/power",
    "//extensions/common/api",
    "//net",
    "//testing/gmock",
    "//testing/gtest",
    "//ui/base:features",
    "//url",
  ]
}