summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/policy
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/chrome/browser/policy')
-rw-r--r--chromium/chrome/browser/policy/BUILD.gn203
-rw-r--r--chromium/chrome/browser/policy/android/BUILD.gn62
2 files changed, 257 insertions, 8 deletions
diff --git a/chromium/chrome/browser/policy/BUILD.gn b/chromium/chrome/browser/policy/BUILD.gn
index 4093dac5b37..fd96ddcc4c9 100644
--- a/chromium/chrome/browser/policy/BUILD.gn
+++ b/chromium/chrome/browser/policy/BUILD.gn
@@ -2,6 +2,7 @@
# 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")
import("//build/config/features.gni")
source_set("path_parser") {
@@ -9,6 +10,8 @@ source_set("path_parser") {
if (is_chromeos || is_linux) {
sources += [ "policy_path_parser_linux.cc" ]
+ } else if (is_fuchsia) {
+ sources += [ "policy_path_parser_fuchsia.cc" ]
} else if (is_mac) {
sources += [ "policy_path_parser_mac.mm" ]
} else if (is_win) {
@@ -31,3 +34,203 @@ source_set("path_parser") {
libs = [ "wtsapi32.lib" ]
}
}
+
+source_set("test_support") {
+ testonly = true
+
+ sources = [
+ "cloud/cloud_policy_test_utils.cc",
+ "cloud/cloud_policy_test_utils.h",
+ ]
+
+ deps = [
+ "//base",
+ "//build:chromeos_buildflags",
+ "//components/policy/core/common",
+ "//components/policy/core/common:common_constants",
+ ]
+
+ if (is_chromeos_ash) {
+ deps += [
+ "//ash:ash",
+ "//ash/public/cpp:cpp",
+ ]
+ }
+
+ if (!is_android) {
+ sources += [
+ "policy_test_utils.cc",
+ "policy_test_utils.h",
+ "url_blocking_policy_test_utils.cc",
+ "url_blocking_policy_test_utils.h",
+ ]
+
+ deps += [
+ "//base/test:test_support",
+ "//chrome/browser/profiles:profile",
+ "//chrome/browser/ui:ui",
+ "//chrome/common:constants",
+ "//chrome/common/net:net",
+ "//chrome/test:test_support",
+ "//components/omnibox/browser:browser",
+ "//components/policy/core/browser:browser",
+ "//components/policy/core/common:test_support",
+ "//components/security_interstitials/content:security_interstitial_page",
+ "//components/security_interstitials/core:core",
+ "//components/variations:test_support",
+ "//content/public/browser:browser",
+ "//content/public/common:common",
+ "//content/test:test_support",
+ "//mojo/public/cpp/bindings:bindings",
+ "//net:net",
+ "//net:test_support",
+ "//services/network/public/mojom:mojom",
+ "//ui/snapshot:snapshot",
+ "//url:url",
+ ]
+ }
+}
+
+# Browser tests for specific policies.
+source_set("policy_specific_browser_tests") {
+ testonly = true
+
+ defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
+
+ sources = []
+
+ if (!is_android) {
+ sources += [
+ "test/autoplay_policy_browsertest.cc",
+ "test/bookmark_bar_enabled_browsertest.cc",
+ "test/component_updater_policy_browsertest.cc",
+ "test/developer_tools_policy_browsertest.cc",
+ "test/download_directory_browsertest.cc",
+ "test/hide_webstore_icon_policy_browsertest.cc",
+ "test/media_stream_policy_browsertest.cc",
+ "test/signed_exchange_browsertest.cc",
+ "test/task_manager_end_process_enabled_browsertest.cc",
+ "test/web_rtc_event_log_collection_allowed_policy_browsertest.cc",
+ "test/web_rtc_local_ips_allowed_urls_policy_browsertest.cc",
+ ]
+
+ deps = [
+ ":test_support",
+ "//base",
+ "//chrome/app:command_ids",
+ "//chrome/browser",
+ "//chrome/browser/devtools:test_support",
+ "//chrome/browser/profiles:profile",
+ "//chrome/common",
+ "//chrome/test:test_support",
+ "//components/bookmarks/common:common",
+ "//components/enterprise",
+ "//components/enterprise:test_support",
+ "//components/policy:chrome_settings_proto_generated_compile",
+ "//components/policy/core/browser",
+ "//components/policy/core/common",
+ "//components/policy/core/common:common_constants",
+ "//components/policy/proto",
+ "//components/policy/test_support",
+ "//components/prefs",
+ "//components/webrtc:webrtc",
+ "//content/test:test_support",
+ "//testing/gmock",
+ ]
+ }
+
+ if (!is_android && !is_chromeos_ash) {
+ sources += [ "policy_startup_browsertest.cc" ]
+ }
+}
+
+source_set("browser_tests") {
+ testonly = true
+
+ defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
+
+ sources = [
+ "cloud/cloud_policy_browsertest.cc",
+ "cloud/cloud_policy_manager_browsertest.cc",
+ ]
+
+ deps = [
+ ":policy_specific_browser_tests",
+ ":test_support",
+ "//base",
+ "//build:branding_buildflags",
+ "//build:chromeos_buildflags",
+ "//chrome/browser",
+ "//chrome/browser/profiles:profile",
+ "//chrome/common",
+ "//chrome/test:test_support",
+ "//components/enterprise",
+ "//components/enterprise:test_support",
+ "//components/invalidation/impl:test_support",
+ "//components/invalidation/public:public",
+ "//components/keyed_service/core",
+ "//components/policy:chrome_settings_proto_generated_compile",
+ "//components/policy/core/browser",
+ "//components/policy/core/common",
+ "//components/policy/core/common:common_constants",
+ "//components/policy/proto",
+ "//components/policy/test_support",
+ "//components/prefs",
+ "//components/signin/public/identity_manager:test_support",
+ "//components/user_manager",
+ "//content/test:test_support",
+ "//google_apis",
+ "//net",
+ "//services/network:test_support",
+ "//services/network/public/cpp",
+ "//services/network/public/mojom",
+ "//testing/gmock",
+ ]
+
+ if (is_android) {
+ sources += [
+ "cloud/chrome_browser_cloud_management_browsertest_delegate_android.cc",
+ ]
+ }
+
+ if (is_chromeos_ash) {
+ deps += [
+ "//chrome/browser/chromeos",
+ "//chromeos/cryptohome",
+ "//chromeos/dbus/constants",
+ "//chromeos/dbus/userdataauth",
+ "//components/account_id",
+ ]
+ }
+
+ if (is_mac) {
+ sources += [
+ "cloud/chrome_browser_cloud_management_browsertest_mac_util.h",
+ "cloud/chrome_browser_cloud_management_browsertest_mac_util.mm",
+ ]
+ }
+
+ if (!is_android) {
+ sources += [ "cloud/component_cloud_policy_browsertest.cc" ]
+
+ deps += [
+ "//chrome/browser/ui:ui",
+ "//chrome/test:test_support",
+ ]
+ }
+
+ if (!is_chromeos_ash) {
+ sources += [
+ "cloud/chrome_browser_cloud_management_browsertest.cc",
+ "cloud/chrome_browser_cloud_management_browsertest_delegate.h",
+ ]
+
+ deps += [ "//components/signin/public/identity_manager" ]
+ }
+
+ if (!is_android && !is_chromeos_ash) {
+ sources += [
+ "cloud/chrome_browser_cloud_management_browsertest_delegate_desktop.cc",
+ ]
+ }
+}
diff --git a/chromium/chrome/browser/policy/android/BUILD.gn b/chromium/chrome/browser/policy/android/BUILD.gn
index ffef53d0171..14b6c9be39d 100644
--- a/chromium/chrome/browser/policy/android/BUILD.gn
+++ b/chromium/chrome/browser/policy/android/BUILD.gn
@@ -4,25 +4,66 @@
import("//build/config/android/rules.gni")
-_jni_sources = [
- "java/src/org/chromium/chrome/browser/policy/CloudManagementSharedPreferences.java",
- "java/src/org/chromium/chrome/browser/policy/PolicyServiceFactory.java",
-]
+android_library("util_java") {
+ sources = [ "java/src/org/chromium/chrome/browser/policy/CloudManagementSharedPreferences.java" ]
-android_library("java") {
deps = [
"//base:base_java",
"//chrome/browser/preferences:java",
+ "//components/policy/android:policy_java",
+ ]
+
+ annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
+}
+
+android_library("java") {
+ sources = [
+ "java/src/org/chromium/chrome/browser/policy/CloudManagementAndroidConnection.java",
+ "java/src/org/chromium/chrome/browser/policy/PolicyServiceFactory.java",
+ ]
+
+ deps = [
+ "//base:base_java",
"//chrome/browser/profiles/android:java",
"//components/policy/android:policy_java",
"//third_party/androidx:androidx_annotation_annotation_java",
]
+
+ public_deps = [
+ ":delegate_java",
+ ":util_java",
+ ]
+
annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
- sources = _jni_sources
+}
+
+android_library("delegate_java") {
+ sources = [
+ "java/src/org/chromium/chrome/browser/policy/CloudManagementAndroidConnectionDelegate.java",
+ "java/src/org/chromium/chrome/browser/policy/CloudManagementAndroidConnectionDelegateImpl.java",
+ ]
+
+ # Add the actual implementation where necessary so that downstream
+ # targets can provide their own implementations.
+ jar_excluded_patterns =
+ [ "*/CloudManagementAndroidConnectionDelegateImpl.class" ]
+}
+
+android_library("delegate_public_impl_java") {
+ sources = [ "java/src/org/chromium/chrome/browser/policy/CloudManagementAndroidConnectionDelegateImpl.java" ]
+
+ deps = [
+ ":delegate_java",
+ ":util_java",
+ ]
}
generate_jni("jni_headers") {
- sources = _jni_sources
+ sources = [
+ "java/src/org/chromium/chrome/browser/policy/CloudManagementAndroidConnection.java",
+ "java/src/org/chromium/chrome/browser/policy/CloudManagementSharedPreferences.java",
+ "java/src/org/chromium/chrome/browser/policy/PolicyServiceFactory.java",
+ ]
}
android_library("junit") {
@@ -30,10 +71,15 @@ android_library("junit") {
bypass_platform_checks = true
testonly = true
- sources = [ "java/src/org/chromium/chrome/browser/policy/CloudManagementSharedPreferencesTest.java" ]
+ sources = [
+ "java/src/org/chromium/chrome/browser/policy/CloudManagementAndroidConnectionTest.java",
+ "java/src/org/chromium/chrome/browser/policy/CloudManagementSharedPreferencesTest.java",
+ ]
deps = [
+ ":delegate_java",
":java",
+ ":util_java",
"//base:base_junit_test_support",
"//chrome/browser/preferences:java",
"//third_party/android_deps:robolectric_all_java",