chromium/chrome/browser/supervised_user/BUILD.gn

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

import("//third_party/jni_zero/jni_zero.gni")
import("//tools/grit/grit_rule.gni")

static_library("test_support") {
  testonly = true
  sources = [
    "supervised_user_test_util.cc",
    "supervised_user_test_util.h",
  ]
  deps = [
    "//chrome/browser",
    "//chrome/browser/profiles:profile",
    "//chrome/common:constants",
    "//components/content_settings/core/browser",
    "//components/prefs",
    "//components/supervised_user/core/browser",
    "//components/supervised_user/core/common",
  ]
  if (is_android) {
    sources += [ "android/supervised_user_settings_test_bridge.cc" ]
    deps += [
      ":test_support_jni_headers",
      "//components/signin/public/identity_manager:test_support",
      "//services/network:test_support",
    ]
  }
}

if (is_android) {
  android_resources("java_resources") {
    sources = [
      "android/java/res/drawable/ic_family_link.xml",
      "android/java/res/layout/website_approval_bottom_sheet.xml",
      "android/java/res/values/dimens.xml",
    ]
  }

  android_library("parent_auth_delegate_java") {
    sources = [
      "android/java/src/org/chromium/chrome/browser/supervised_user/ParentAuthDelegate.java",
      "android/java/src/org/chromium/chrome/browser/supervised_user/ParentAuthDelegateImpl.java",
    ]
    deps = [
      "//base:base_java",
      "//ui/android:ui_no_recycler_view_java",
      "//url:gurl_java",
    ]

    # Add the actual implementation where necessary so that downstream targets
    # can provide their own implementations.
    jar_excluded_patterns = [ "*/ParentAuthDelegateImpl.class" ]
  }

  android_library("supervised_user_metrics_java") {
    sources = [ "android/java/src/org/chromium/chrome/browser/supervised_user/WebsiteParentApprovalMetrics.java" ]
    deps = [
      "//base:base_java",
      "//third_party/androidx:androidx_annotation_annotation_java",
    ]
  }

  android_library("parent_auth_delegate_impl_java") {
    sources = [ "android/java/src/org/chromium/chrome/browser/supervised_user/ParentAuthDelegateImpl.java" ]
    deps = [
      ":parent_auth_delegate_java",
      "//base:base_java",
      "//ui/android:ui_no_recycler_view_java",
      "//url:gurl_java",
    ]
  }

  java_cpp_enum("local_web_approval_outcome_java_enum_srcjar") {
    sources =
        [ "//chrome/browser/supervised_user/android/website_parent_approval.h" ]
  }

  android_library("website_parent_approval_java") {
    deps = [
      ":java_resources",
      ":parent_auth_delegate_java",
      ":supervised_user_metrics_java",
      "//base:base_java",
      "//build/android:build_java",
      "//chrome/browser/profiles/android:java",
      "//chrome/browser/signin/services/android:java",
      "//chrome/browser/ui/android/strings:ui_strings_grd",
      "//components/browser_ui/bottomsheet/android:java",
      "//components/browser_ui/widget/android:java",
      "//components/signin/public/android:java",
      "//components/url_formatter/android:url_formatter_java",
      "//third_party/androidx:androidx_annotation_annotation_java",
      "//third_party/androidx:androidx_appcompat_appcompat_java",
      "//third_party/jni_zero:jni_zero_java",
      "//ui/android:ui_java",
      "//ui/android:ui_no_recycler_view_java",
      "//url:gurl_java",
    ]

    srcjar_deps = [
      ":local_web_approval_outcome_java_enum_srcjar",
      ":website_parent_approval_jni_headers",
    ]

    sources = [
      "android/java/src/org/chromium/chrome/browser/supervised_user/ParentAuthDelegateProvider.java",
      "android/java/src/org/chromium/chrome/browser/supervised_user/WebsiteParentApproval.java",
      "android/java/src/org/chromium/chrome/browser/supervised_user/website_approval/WebsiteApprovalCoordinator.java",
      "android/java/src/org/chromium/chrome/browser/supervised_user/website_approval/WebsiteApprovalMediator.java",
      "android/java/src/org/chromium/chrome/browser/supervised_user/website_approval/WebsiteApprovalProperties.java",
      "android/java/src/org/chromium/chrome/browser/supervised_user/website_approval/WebsiteApprovalSheetContent.java",
      "android/java/src/org/chromium/chrome/browser/supervised_user/website_approval/WebsiteApprovalViewBinder.java",
    ]
    resources_package = "org.chromium.chrome.browser.supervised_user"
  }

  generate_jni("website_parent_approval_jni_headers") {
    sources = [ "android/java/src/org/chromium/chrome/browser/supervised_user/WebsiteParentApproval.java" ]
  }

  android_library("supervised_user_service_platform_delegate_java") {
    deps = [
      "//base:base_java",
      "//chrome/browser/tabmodel:java",
      "//third_party/jni_zero:jni_zero_java",
    ]

    srcjar_deps = [ ":supervised_user_service_platform_delegate_jni_headers" ]

    sources = [ "android/java/src/org/chromium/chrome/browser/supervised_user/SupervisedUserServicePlatformDelegate.java" ]
    resources_package = "org.chromium.chrome.browser.supervised_user"
  }

  generate_jni("supervised_user_service_platform_delegate_jni_headers") {
    sources = [ "android/java/src/org/chromium/chrome/browser/supervised_user/SupervisedUserServicePlatformDelegate.java" ]
  }

  generate_jni("test_support_jni_headers") {
    testonly = true
    sources = [ "android/java/src/org/chromium/chrome/browser/supervised_user/SupervisedUserSettingsTestBridge.java" ]
  }

  android_library("test_support_java") {
    testonly = true
    srcjar_deps = [ ":test_support_jni_headers" ]
    sources = [ "android/java/src/org/chromium/chrome/browser/supervised_user/SupervisedUserSettingsTestBridge.java" ]
    deps = [
      ":test_support_jni_headers",
      "//build/android:build_java",
      "//chrome/android:chrome_java",
      "//chrome/browser/profiles/android:java",
      "//components/browser_ui/bottomsheet/android/test:java",
      "//content/public/test/android:content_java_test_support",
      "//third_party/jni_zero:jni_zero_java",
    ]
  }

  android_library("javatests") {
    testonly = true
    resources_package = "org.chromium.chrome.browser.supervised_user"
    sources = [
      "android/javatests/src/org/chromium/chrome/browser/supervised_user/IncognitoSignInInteractionTest.java",
      "android/javatests/src/org/chromium/chrome/browser/supervised_user/SupervisedUserCriticalJourneysIntegrationTest.java",
      "android/javatests/src/org/chromium/chrome/browser/supervised_user/SupervisedUserSettingsTestUtils.java",
      "android/javatests/src/org/chromium/chrome/browser/supervised_user/WebsiteParentApprovalNativesTest.java",
      "android/javatests/src/org/chromium/chrome/browser/supervised_user/WebsiteParentApprovalTest.java",
      "android/javatests/src/org/chromium/chrome/browser/supervised_user/WebsiteParentApprovalTestUtils.java",
      "android/javatests/src/org/chromium/chrome/browser/supervised_user/website_approval/WebsiteApprovalSheetContentTest.java",
    ]
    deps = [
      ":java_resources",
      ":test_support_java",
      "//base:base_java",
      "//base:base_java_test_support",
      "//chrome/android:chrome_java",
      "//chrome/browser/flags:java",
      "//chrome/browser/profiles/android:java",
      "//chrome/browser/signin/services/android:java",
      "//chrome/browser/supervised_user:parent_auth_delegate_java",
      "//chrome/browser/supervised_user:supervised_user_metrics_java",
      "//chrome/browser/supervised_user:website_parent_approval_java",
      "//chrome/browser/tab:java",
      "//chrome/browser/ui/android/appmenu:java",
      "//chrome/browser/ui/android/appmenu/test:test_support_java",
      "//chrome/test/android:chrome_java_integration_test_support",
      "//chrome/test/android:pagecontroller_utils_java",
      "//components/browser_ui/bottomsheet/android:java",
      "//components/browser_ui/bottomsheet/android:manager_java",
      "//components/browser_ui/bottomsheet/android/test:java",
      "//components/signin/public/android:java",
      "//components/signin/public/android:signin_java_test_support",
      "//content/public/android:content_java",
      "//content/public/test/android:content_java_test_support",
      "//net/android:net_java_test_support",
      "//third_party/android_deps:espresso_java",
      "//third_party/androidx:androidx_test_runner_java",
      "//third_party/hamcrest:hamcrest_java",
      "//third_party/jni_zero:jni_zero_java",
      "//third_party/junit:junit",
      "//third_party/mockito:mockito_java",
      "//ui/android:ui_java_test_support",
      "//ui/android:ui_no_recycler_view_java",
      "//url:gurl_java",
    ]
  }

  robolectric_library("junit") {
    testonly = true
    resources_package = "org.chromium.chrome.browser.supervised_user"
    sources = [ "android/javatests/src/org/chromium/chrome/browser/supervised_user/WebsiteParentApprovalMetricsTest.java" ]
    deps = [
      ":java_resources",
      ":supervised_user_metrics_java",
      "//base:base_java",
      "//base:base_java_test_support",
      "//base:base_junit_test_support",
      "//chrome/android:chrome_java",
      "//third_party/android_deps:robolectric_all_java",
      "//third_party/androidx:androidx_test_runner_java",
      "//third_party/junit:junit",
    ]
  }
}