# 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.
import("//base/debug/debug.gni")
import("//build/config/chrome_build.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//components/compose/features.gni")
import("//components/enterprise/buildflags/buildflags.gni")
import("//components/nacl/features.gni")
import("//components/optimization_guide/features.gni")
import("//components/safe_browsing/buildflags.gni")
import("//components/supervised_user/buildflags.gni")
import("//extensions/buildflags/buildflags.gni")
import("//media/media_options.gni")
import("//net/features.gni")
import("//pdf/features.gni")
import("//printing/buildflags/buildflags.gni")
import("//rlz/buildflags/buildflags.gni")
import("//services/screen_ai/buildflags/features.gni")
import("//testing/test.gni")
import("//third_party/widevine/cdm/widevine.gni")
import("//tools/grit/repack.gni")
if (is_android) {
import("//build/config/android/rules.gni")
import("//build/config/compiler/compiler.gni")
}
if (is_ios) {
import("//ios/build/config.gni")
}
if (is_ios) {
bundle_data("components_tests_pak_bundle_data") {
testonly = true
public_deps = [
":components_tests_pak",
"//ui/resources:ui_test_pak",
]
sources = [
"$root_out_dir/components_tests_resources.pak",
"$root_out_dir/ui_test.pak",
]
if (use_blink) {
public_deps += [ "//content/shell:pak" ]
sources += [ "$root_out_dir/content_shell.pak" ]
}
outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
}
if (use_blink) {
bundle_data("components_tests_distiller_bundle_data") {
testonly = true
sources = [
"//third_party/dom_distiller_js/dist/test/data/out/domdistillerjstest.js",
"//third_party/dom_distiller_js/dist/test/data/war/test.html",
"//third_party/node/node_modules/chai/chai.js",
"//third_party/node/node_modules/mocha/mocha.js",
"dom_distiller/core/javascript/dom_distiller_viewer.js",
"dom_distiller/core/javascript/domdistiller.js",
"dom_distiller/core/javascript/extract_features.js",
]
outputs = [ "{{bundle_resources_dir}}/" +
"{{source_root_relative_dir}}/{{source_file_part}}" ]
}
}
}
# Omit Lacros because it allows //components to depend on //chrome, which in
# turn depends on //extensions.
if (!is_chromeos_lacros) {
disallowed_extension_deps_ = [
# Components should largely not depend on //extensions. Since // extensions
# is not a component target and is linked with //chrome, depending on most
# //extensions targets will result in duplicate code. See
# //docs/component_build.md#dependencies-between-targets and
# https://bugs.chromium.org/p/chromium/issues/detail?id=1215550#c6 for an
# example of this going awry.
# However, there are two //extensions targets we allow:
# //extensions/buildflags (needed to see if extensions are enabled) and
# //extensions/common:common_constants (which *is* a component target, and
# is needed by a number of components).
# Since there's no way to say "no //extensions targets _except_", we
# instead list ~all the other targets here.
"//extensions/browser/*",
"//extensions/common",
"//extensions/common:mojom",
"//extensions/common:core_api_provider",
"//extensions/common/api/*",
"//extensions/renderer/*",
"//extensions/shell/*",
"//extensions/components/*",
"//extensions/strings/*",
]
}
# To add a unit test to this target, make a "unit_tests" source_set in your
# component(it's important to use a source_set instead of a static library or
# no tests will run) and add a reference here.You can add more than one unit
# test target if convenient.
test("components_unittests") {
use_xvfb = use_xvfb_in_this_config
if (is_android || is_linux || is_chromeos || is_mac || is_win || is_fuchsia) {
# Ideally these would be added to the specific :unit_tests targets they are
# relevant for. Please try to do this rather than add to this list.
data = [
"test/data/ads_observer/",
"test/data/ad_tagging/",
"test/data/autofill/",
"test/data/bookmarks/",
"test/data/browsing_topics/",
"test/data/crx_file/",
"test/data/custom_handlers/",
"test/data/device_signals/",
"test/data/dom_distiller/",
"test/data/explore_sites/",
"test/data/feed/",
"test/data/fenced_frames/",
"test/data/headless/",
"test/data/history/",
"test/data/html_viewer/",
"test/data/json_schema/",
"test/data/language/",
"test/data/media_router/",
"test/data/ntp/",
"test/data/offline_pages/",
"test/data/omnibox/",
"test/data/optimization_guide/",
"test/data/paint_preview/",
"test/data/password_manager/",
"test/data/payments/",
"test/data/performance_manager/",
"test/data/printing/",
"test/data/protocol_handler/",
"test/data/resource_provider/",
"test/data/safe_browsing/",
"test/data/search_engines/",
"test/data/search_provider_logos/",
"test/data/segmentation_platform/",
"test/data/service_worker/",
"test/data/sessions/",
"test/data/shared_highlighting/",
"test/data/storage/",
"test/data/subresource_filter/",
"test/data/translate/",
"test/data/ui_devtools/",
"test/data/unzip_service/",
"test/data/update_client/",
"test/data/url_rewrite/",
"test/data/value_store/",
"test/data/webapps/",
"test/data/webcrypto/",
"test/data/web_database/",
"test/data/web_package/",
"test/data/webp_transcode/",
"test/data/web_view/",
]
}
if (is_fuchsia) {
additional_manifest_fragments = [
"//build/config/fuchsia/test/fonts.shard.test-cml",
# TODO(crbug.com/40055105): Investigate removing the requirement
# for VmexResource.
"//build/config/fuchsia/test/mark_vmo_executable.shard.test-cml",
"//build/config/fuchsia/test/network.shard.test-cml",
"//build/config/fuchsia/test/present_view.shard.test-cml",
"//third_party/fuchsia-sdk/sdk/pkg/vulkan/client.shard.cml",
]
}
# Add only ":unit_tests" dependencies here.If your tests have dependencies
#(this would at least include the component itself), they should be on the
# test source set and not here.
deps = [
"//base",
"//components/affiliations/core/browser:unit_tests",
"//components/aggregation_service:unit_tests",
"//components/apdu:unit_tests",
"//components/assist_ranker:unit_tests",
"//components/attribution_reporting:unit_tests",
"//components/autofill/core/browser:unit_tests",
"//components/autofill/core/common:unit_tests",
"//components/base32:unit_tests",
"//components/blocklist/opt_out_blocklist:unit_tests",
"//components/blocklist/opt_out_blocklist/sql:unit_tests",
"//components/bookmarks/browser:unit_tests",
"//components/bookmarks/managed:unit_tests",
"//components/breadcrumbs/core:unit_tests",
"//components/browser_sync:unit_tests",
"//components/browsing_data/core:unit_tests",
"//components/captive_portal/core:unit_tests",
"//components/cbor:unit_tests",
"//components/certificate_matching:unit_tests",
"//components/client_update_protocol:unit_tests",
"//components/cloud_devices/common:unit_tests",
"//components/commerce/core:shopping_service_unit_tests",
"//components/commerce/core:utils_unit_tests",
"//components/commerce/core/product_specifications:unit_tests",
"//components/component_updater:unit_tests",
"//components/component_updater/installer_policies:unit_tests",
"//components/consent_auditor:unit_tests",
"//components/content_capture/common:unit_tests",
"//components/content_settings/core/browser:unit_tests",
"//components/content_settings/core/common:unit_tests",
"//components/country_codes:unit_tests",
"//components/crash/core/common:unit_tests",
"//components/cross_device/logging:unit_tests",
"//components/crx_file:unit_tests",
"//components/data_sharing:unit_tests",
"//components/device_event_log:unit_tests",
"//components/device_reauth:unit_tests",
"//components/device_signals/core:unit_tests",
"//components/dom_distiller/core:unit_tests",
"//components/download:unit_tests",
"//components/encrypted_messages:unit_tests",
"//components/enterprise:unit_tests",
"//components/enterprise/common:unit_tests",
"//components/enterprise/obfuscation/core:unit_tests",
"//components/facilitated_payments/core/metrics:unit_tests",
"//components/facilitated_payments/core/util:unit_tests",
"//components/favicon/core:unit_tests",
"//components/favicon_base:unit_tests",
"//components/feature_engagement:unit_tests",
"//components/filename_generation:unit_tests",
"//components/flags_ui:unit_tests",
"//components/gcm_driver:unit_tests",
"//components/gcm_driver/crypto:unit_tests",
"//components/google/core/common:unit_tests",
"//components/grpc_support/test:unit_tests",
"//components/heap_profiling/in_process:unit_tests",
"//components/history/core/browser:unit_tests",
"//components/history/metrics:unit_tests",
"//components/image_fetcher/core:unit_tests",
"//components/ip_protection:unit_tests",
"//components/keyed_service/core:unit_tests",
"//components/language/core/browser:unit_tests",
"//components/language/core/common:unit_tests",
"//components/language/core/language_model:unit_tests",
"//components/language_detection/core:unit_tests",
"//components/lens:unit_tests",
"//components/leveldb_proto:unit_tests",
"//components/local_state:unit_tests",
"//components/lookalikes/core:unit_tests",
"//components/memory_pressure:unit_tests",
"//components/metrics:unit_tests",
"//components/metrics/demographics:unit_tests",
"//components/named_mojo_ipc_server:unit_tests",
"//components/navigation_metrics:unit_tests",
"//components/net_log:unit_tests",
"//components/network_session_configurator/browser:unit_tests",
"//components/network_time:unit_tests",
"//components/network_time/time_tracker:unit_tests",
"//components/ntp_tiles:unit_tests",
"//components/offline_items_collection/core:unit_tests",
"//components/omnibox/browser:unit_tests",
"//components/open_from_clipboard:unit_tests",
"//components/openscreen_platform:unittests",
"//components/optimization_guide/core:unit_tests",
"//components/os_crypt/async/browser:unit_tests",
"//components/os_crypt/async/common:unit_tests",
"//components/os_crypt/sync:unit_tests",
"//components/page_image_service:unit_tests",
"//components/page_info/core:unit_tests",
"//components/password_manager/core/browser:unit_tests",
"//components/password_manager/core/browser/affiliation:affiliation_fetching_unittests",
"//components/password_manager/core/browser/affiliation:unit_tests",
"//components/password_manager/core/browser/export:unit_tests",
"//components/password_manager/core/browser/features:unit_tests",
"//components/password_manager/core/browser/form_parsing:unit_tests",
"//components/password_manager/core/browser/generation:unit_tests",
"//components/password_manager/core/browser/import:csv_unit_tests",
"//components/password_manager/core/browser/leak_detection:unit_tests",
"//components/password_manager/core/browser/password_store:unit_tests",
"//components/password_manager/core/browser/sharing:unit_tests",
"//components/password_manager/core/browser/sync:unit_tests",
"//components/password_manager/core/browser/ui:unit_tests",
"//components/password_manager/core/browser/well_known_change_password:unit_tests",
"//components/password_manager/core/common:unit_tests",
"//components/payments/core:unit_tests",
"//components/plus_addresses:unit_tests",
"//components/plus_addresses/metrics:unit_tests",
"//components/plus_addresses/settings:unit_tests",
"//components/plus_addresses/webdata:unit_tests",
"//components/policy/core/browser:unit_tests",
"//components/policy/core/common:unit_tests",
"//components/power_bookmarks/core:unit_tests",
"//components/power_bookmarks/storage:unit_tests",
"//components/power_metrics:unit_tests",
"//components/prefs:unit_tests",
"//components/profile_metrics:unit_tests",
"//components/proxy_config:unit_tests",
"//components/push_notification:unit_tests",
"//components/qr_code_generator:unit_tests",
"//components/query_parser:unit_tests",
"//components/reading_list/core:unit_tests",
"//components/reporting/client:unit_tests",
"//components/reporting/compression:unit_tests",
"//components/reporting/encryption:unit_tests",
"//components/reporting/metrics:unit_tests",
"//components/reporting/storage:unit_tests",
"//components/reporting/util:unit_tests",
"//components/safe_browsing/core/browser:safe_browsing_hats_delegate_unittest",
"//components/safe_browsing/core/browser:safe_browsing_metrics_collector_unittest",
"//components/safe_browsing/core/browser:token_fetcher_unit_tests",
"//components/safe_browsing/core/browser/hashprefix_realtime:unit_tests",
"//components/safe_browsing/core/browser/password_protection:unit_tests",
"//components/safe_browsing/core/browser/realtime:unit_tests",
"//components/safe_browsing/core/browser/tailored_security_service:unit_tests",
"//components/safe_browsing/core/browser/utils:unit_tests",
"//components/safe_browsing/core/common:unit_tests",
"//components/safe_browsing/core/common/hashprefix_realtime:unit_tests",
"//components/safe_search_api:unit_tests",
"//components/saved_tab_groups:unit_tests",
"//components/search:unit_tests",
"//components/search_engines:unit_tests",
"//components/search_provider_logos:unit_tests",
"//components/security_interstitials/core:unit_tests",
"//components/security_state/core:unit_tests",
"//components/segmentation_platform:unit_tests",
"//components/services/heap_profiling/public/cpp:unit_tests",
"//components/services/unzip:unit_tests",
"//components/sessions:unit_tests",
"//components/shared_highlighting/core/common:unit_tests",
"//components/sharing_message:unit_tests",
"//components/sharing_message:unit_tests",
"//components/signin/core/browser:unit_tests",
"//components/signin/internal/identity_manager:unit_tests",
"//components/signin/public/base:unit_tests",
"//components/signin/public/identity_manager:unit_tests",
"//components/signin/public/webdata:unit_tests",
"//components/speech:unit_tests",
"//components/sqlite_proto:unit_tests",
"//components/ssl_errors:unit_tests",
"//components/subresource_filter/core/browser:unit_tests",
"//components/subresource_filter/core/common:unit_tests",
"//components/subresource_filter/tools:unit_tests",
"//components/sync:unit_tests",
"//components/sync_bookmarks:unit_tests",
"//components/sync_device_info:unit_tests",
"//components/sync_preferences:unit_tests",
"//components/sync_user_events:unit_tests",
"//components/system_cpu:unit_tests",
"//components/system_media_controls:unit_tests",
"//components/test:run_all_unittests",
"//components/tpcd/metadata/browser:unit_tests",
"//components/tpcd/metadata/common:unit_tests",
"//components/translate/core/browser:unit_tests",
"//components/translate/core/common:unit_tests",
"//components/translate/core/language_detection:unit_tests",
"//components/ukm:unit_tests",
"//components/undo:unit_tests",
"//components/unexportable_keys:unit_tests",
"//components/unified_consent:unit_tests",
"//components/upload_list:unit_tests",
"//components/url_deduplication:unit_tests",
"//components/url_formatter:unit_tests",
"//components/url_formatter/spoof_checks/common_words:unit_tests",
"//components/url_formatter/spoof_checks/top_domains:unit_tests",
"//components/url_matcher:unit_tests",
"//components/url_pattern_index:unit_tests",
"//components/user_annotations:unit_tests",
"//components/variations:unit_tests",
"//components/variations/field_trial_config:unit_tests",
"//components/variations/service:unit_tests",
"//components/web_resource:unit_tests",
"//components/webdata/common:unit_tests",
"//components/webdata_services:unit_tests",
]
if (enable_supervised_users) {
deps += [
"//components/supervised_user/core/browser:unit_tests",
"//components/supervised_user/core/common:unit_tests",
]
}
if (build_allocation_stack_trace_recorder) {
deps += [
"//components/allocation_recorder/crash_client:unit_tests",
"//components/allocation_recorder/crash_handler:unit_tests",
]
}
data_deps = [ "//testing/buildbot/filters:components_unittests_filters" ]
if (toolkit_views) {
deps += [
"//components/fullscreen_control:unit_tests",
"//components/global_media_controls:unit_tests",
"//components/media_message_center:unit_tests",
"//components/ui_devtools:unit_tests",
"//components/user_education/views:unit_tests",
"//components/user_education/webui:unit_tests",
]
}
if (toolkit_views && enable_extensions) {
deps += [ "//components/ui_devtools/views:unit_tests" ]
}
if (enable_nacl) {
deps += [ "//components/nacl/browser:unit_tests" ]
}
if (is_fuchsia) {
deps += [
"//components/fuchsia_component_support:unit_tests",
"//components/fuchsia_legacymetrics:unit_tests",
]
} else {
# TODO(crbug.com/40818181): Enable all relevant tests on Fuchsia too.
deps += [
"//components/browser_sync:unit_tests",
"//components/send_tab_to_self:unit_tests",
"//components/sync_sessions:unit_tests",
"//components/update_client:unit_tests",
"//components/visited_url_ranking/internal:unit_tests",
]
}
if (use_blink) {
deps += [
"//components/autofill/content/browser:unit_tests",
"//components/autofill/core/common/mojom:unit_tests",
"//components/browsing_data/content:unit_tests",
"//components/browsing_topics:unit_tests",
"//components/browsing_topics/common:unit_tests",
"//components/captive_portal/content:unit_tests",
"//components/cast_receiver:unit_tests",
"//components/cast_streaming:unit_tests",
"//components/certificate_transparency:unit_tests",
"//components/commerce/content/browser:unit_tests",
"//components/content_capture/browser:unit_tests",
"//components/content_relationship_verification:unit_tests",
"//components/content_settings/browser:unit_tests",
"//components/contextual_search/core/browser:unit_tests",
"//components/continuous_search/browser:unit_tests",
"//components/continuous_search/common:unit_tests",
"//components/custom_handlers:unit_tests",
"//components/devtools/simple_devtools_protocol_client:unit_tests",
"//components/discardable_memory/client:unit_tests",
"//components/discardable_memory/common:unit_tests",
"//components/discardable_memory/service:unit_tests",
"//components/dom_distiller/content/browser:unit_tests",
"//components/domain_reliability:unit_tests",
"//components/drive:unit_tests",
"//components/embedder_support:unit_tests",
"//components/endpoint_fetcher:unit_tests",
"//components/enterprise/content:unit_tests",
"//components/favicon/content:unit_tests",
"//components/feed/core/v2:core_unit_tests",
"//components/feed/core/v2:ios_shared_unit_tests",
"//components/file_access:unit_tests",
"//components/gcm_driver/instance_id:unit_tests",
"//components/heavy_ad_intervention:unit_tests",
"//components/history/content/browser:unit_tests",
"//components/history_clusters/core:unit_tests",
"//components/history_embeddings:unit_tests",
"//components/input:unit_tests",
"//components/invalidation:unit_tests",
"//components/invalidation/impl:unit_tests",
"//components/javascript_dialogs:unit_tests",
"//components/js_injection/common:unit_tests",
"//components/keyed_service/content:unit_tests",
"//components/language/content/browser:unit_tests",
"//components/link_header_util:unit_tests",
"//components/media_device_salt:unit_tests",
"//components/media_effects:unit_tests",
"//components/miracle_parameter/common:unit_tests",
"//components/mirroring:mirroring_tests",
"//components/navigation_interception:unit_tests",
"//components/no_state_prefetch/browser:unit_tests",
"//components/no_state_prefetch/common:unit_tests",
"//components/offline_pages:unit_tests",
"//components/optimization_guide/content/browser:unit_tests",
"//components/optimization_guide/content/renderer:unit_tests",
"//components/origin_trials:unit_tests",
"//components/page_content_annotations/core:unit_tests",
"//components/page_image_annotation/content/renderer:unit_tests",
"//components/page_image_annotation/core:unit_tests",
"//components/page_load_metrics/browser:unit_tests",
"//components/page_load_metrics/browser/observers/ad_metrics:unit_tests",
"//components/page_load_metrics/renderer:unit_tests",
"//components/paint_preview/browser:unit_tests",
"//components/paint_preview/common:unit_tests",
"//components/paint_preview/player:unit_tests",
"//components/paint_preview/renderer:unit_tests",
"//components/password_manager/content/browser:unit_tests",
"//components/password_manager/services/csv_password:unit_tests",
"//components/payments/content:unit_tests",
"//components/payments/content/utility:unit_tests",
"//components/pdf/common:unit_tests",
"//components/performance_manager:unit_tests",
"//components/policy/content:unit_tests",
"//components/reduce_accept_language/browser:unit_tests",
"//components/reporting/resources:unit_tests",
"//components/services/heap_profiling:unit_tests",
"//components/services/paint_preview_compositor:unit_tests",
"//components/services/storage:tests",
"//components/session_proto_db:unit_tests",
"//components/subresource_filter/content/browser:unit_tests",
"//components/subresource_filter/content/renderer:unit_tests",
"//components/subresource_filter/content/shared/browser:unit_tests",
"//components/tracing:unit_tests",
"//components/translate/content/browser:unit_tests",
"//components/translate/content/renderer:unit_tests",
"//components/ukm/content:unit_tests",
"//components/url_rewrite:unit_tests",
"//components/user_education/common:unit_tests",
"//components/value_store:unit_tests",
"//components/visited_url_ranking/public:unit_tests",
"//components/visitedlink/test:unit_tests",
"//components/web_cache/browser:unit_tests",
"//components/web_package:unit_tests",
"//components/web_package/test_support:unit_tests",
"//components/webapps/browser:unit_tests",
"//components/webapps/services/web_app_origin_association:unit_tests",
"//components/webauthn/core/browser:unit_tests",
"//components/webauthn/json:unit_tests",
"//components/webcrypto:unit_tests",
"//components/webrtc:unit_tests",
"//components/webrtc_logging:unit_tests",
"//components/webrtc_logging/browser:unit_tests",
"//components/webrtc_logging/common:unit_tests",
]
}
if (is_linux || is_win || is_mac || is_android || is_ios) {
deps += [ "//components/enterprise/idle:unit_tests" ]
}
if (is_linux || is_win || is_mac) {
deps += [ "//components/named_system_lock:unit_tests" ]
}
if (is_ios) {
bundle_deps = [ ":components_tests_pak_bundle_data" ]
if (use_blink) {
bundle_deps += [ "//testing/buildbot/filters:components_unittests_use_blink_filters_bundle_data" ]
}
deps += [
"//components/autofill/ios/browser:unit_tests",
"//components/autofill/ios/form_util:unit_tests",
"//components/commerce/ios/browser:unit_tests",
"//components/crash/core/app:unit_tests",
"//components/feed/core/v2/public/ios:feed_ios_unit_tests",
"//components/image_fetcher/ios:unit_tests",
"//components/language/ios/browser:unit_tests",
"//components/password_manager/core/common:unit_tests",
"//components/password_manager/ios:unit_tests",
"//components/previous_session_info:unit_tests",
"//components/safe_browsing/ios/browser:unit_tests",
"//components/security_state/ios:unit_tests",
"//components/shared_highlighting/ios:unit_tests",
"//components/signin/ios/browser:unit_tests",
"//components/signin/public/identity_manager/objc:unit_tests",
"//components/translate/ios/browser:unit_tests",
"//components/ukm/ios:unit_tests",
]
if (use_blink) {
deps += [ ":components_tests_distiller_bundle_data" ]
}
} else { #!is_ios
deps += [
"//components/autofill/content/renderer:unit_tests",
"//components/background_sync:unit_tests",
"//components/blocked_content:unit_tests",
"//components/content_settings/browser/ui:unit_tests",
"//components/facilitated_payments/content/renderer:unit_tests",
"//components/fingerprinting_protection_filter/browser:unit_tests",
"//components/fingerprinting_protection_filter/renderer:unit_tests",
"//components/headless/test:unit_tests",
"//components/media_router/browser:unit_tests",
"//components/media_router/common:unit_tests",
"//components/media_router/common/providers/cast/channel:unit_tests",
"//components/page_info:unit_tests",
"//components/permissions:unit_tests",
"//components/permissions/prediction_service:unit_tests",
"//components/privacy_sandbox:unit_tests",
"//components/privacy_sandbox/privacy_sandbox_attestations:unit_tests",
"//components/safety_check:unit_tests",
"//components/security_interstitials/content:unit_tests",
"//components/services/quarantine:unit_tests",
"//components/site_engagement/content:unit_tests",
"//components/site_isolation:unit_tests",
"//components/spellcheck/browser:unit_tests",
"//components/spellcheck/renderer:unit_tests",
]
if (!is_win) { #!iOS and!Windows
deps += [ "//components/cast:unit_tests" ]
}
if (!is_fuchsia) { #!iOS and!Fuchsia
deps += [
"//components/crash/content/browser:unit_tests",
"//components/crash/core/app:unit_tests",
]
}
data_deps += [
":components_tests_pak",
"//third_party/angle:includes",
"//ui/resources:ui_test_pak_data",
]
} # iOS / !iOS
if (is_mac || is_linux || is_chromeos) {
data_deps += [ "//content/shell:pak" ]
}
if (is_android) {
deps += [
"//base:base_unittest_support_java",
"//components/android_autofill/browser:unit_tests",
"//components/browser_ui/accessibility/android:unit_tests",
"//components/browser_ui/site_settings/android:unit_tests",
"//components/browser_ui/sms/android:unit_tests",
"//components/cdm/browser:unit_tests",
"//components/component_updater/android:embedded_component_loader_java",
"//components/component_updater/android:embedded_component_loader_unittests",
"//components/content_settings/android:native_java_unittests_java",
"//components/content_settings/android:unit_tests",
"//components/crash/android:java",
"//components/crash/android:unit_tests",
"//components/data_sharing/internal:internal_java",
"//components/data_sharing/internal:native_test_helper_java",
"//components/download/internal/common:internal_java",
"//components/embedder_support/android:native_java_unittests_java",
"//components/embedder_support/android/metrics:test_support_java",
"//components/embedder_support/android/metrics:unit_tests",
"//components/facilitated_payments/android:unit_tests",
"//components/facilitated_payments/android/java",
"//components/facilitated_payments/content/browser:unit_tests",
"//components/facilitated_payments/core/browser:unit_tests",
"//components/gcm_driver/instance_id:test_support",
"//components/gcm_driver/instance_id/android:instance_id_driver_java",
"//components/gcm_driver/instance_id/android:instance_id_driver_test_support_java",
"//components/invalidation/impl",
"//components/media_router/browser/android:java",
"//components/media_router/browser/android:test_support_java",
"//components/messages/android:java",
"//components/messages/android:unit_tests",
"//components/metrics:metrics_java",
"//components/offline_items_collection/core:native_java_unittests_java",
"//components/paint_preview/browser/android:java",
"//components/paint_preview/player/android:unit_tests",
"//components/payments/content/android",
"//components/permissions/android:java",
"//components/policy/android:native_test_support_java",
"//components/policy/android:policy_java",
"//components/saved_tab_groups:native_java_unittests_java",
"//components/search_engines/android:java",
"//components/search_engines/android:test_utils_java",
"//components/sensitive_content:unit_tests",
"//components/signin/core/browser",
"//components/signin/public/android:java",
"//components/signin/public/android:signin_java_test_support",
"//components/spellcheck/browser/android:java",
"//components/translate/content/android:unit_tests",
"//components/variations/android:variations_java",
"//components/webapps/browser/android:java",
"//components/webapps/browser/android:unit_tests",
"//components/webauthn/android:unit_tests",
"//content/public/android:content_java",
"//content/public/browser",
"//gin:v8_snapshot_assets",
"//net",
"//services/data_decoder/public/cpp/android:safe_json_java",
"//ui/android:ui_java",
"//ui/base",
"//ui/gfx",
]
if (enable_chrome_android_internal) {
data_deps += [ "//clank/build/bot/filters:components_unittests_filters" ]
}
} else { #!is_android
deps += [
"//components/keep_alive_registry:unit_tests",
"//components/manta:unit_tests",
"//components/trusted_vault:unit_tests",
]
}
# Desktop - only deps.
if (!is_android && !is_ios) {
deps += [
"//components/access_code_cast/common:unit_tests",
# See comment in components / guest_view / browser / BUILD.gn for why
# guest_view is currently non - mobile.
"//components/guest_view/browser:unit_tests",
"//components/live_caption:unit_tests",
"//components/soda:unit_tests",
"//components/storage_monitor:unit_tests",
"//components/web_modal:unit_tests",
"//components/zoom:unit_tests",
]
}
if (!is_android && !is_ios && (!is_fuchsia || !optimize_for_size)) {
deps += [
"//components/autofill_prediction_improvements/core/browser:unit_tests",
]
}
if (!is_android) {
deps += [ "//components/feedback:unit_tests" ]
deps += [ "//components/feedback/redaction_tool:unit_tests" ]
}
if (!is_android) {
deps += [
"//components/commerce/core:account_checker_unittests",
"//components/commerce/core:commerce_heuristics_data_unittests",
"//components/commerce/core:feature_list_unittests",
"//components/commerce/core:heuristics_provider_unittests",
"//components/commerce/core/subscriptions:subscriptions_unit_tests",
"//components/commerce/core/webui:unit_tests",
]
}
if (enable_library_cdms) {
deps += [ "//components/cdm/common:unit_tests" ]
}
if (enable_rlz_support) {
deps += [ "//components/rlz:unit_tests" ]
}
if (is_chromeos_ash) {
deps += [
"//components/arc:unit_tests",
"//components/cross_device/nearby:unit_tests",
"//components/desks_storage:unit_tests",
"//components/guest_os:unit_tests",
"//components/ownership:unit_tests",
"//components/peripherals/logging:unit_tests",
"//components/user_manager:unit_tests",
"//components/variations/cros_evaluate_seed:unit_tests",
]
}
if (is_chromeos) {
deps += [
"//components/account_manager_core:unit_tests",
"//components/arc/common:unit_tests",
"//components/reporting/health:unit_tests",
]
}
if (toolkit_views) {
deps += [ "//components/constrained_window:unit_tests" ]
}
if (is_win || is_linux || is_chromeos || is_mac) {
deps += [ "//components/stability_report:unit_tests" ]
}
if (is_win) {
deps += [
"//components/services/font_data:unit_tests",
"//components/winhttp:unit_tests",
]
}
if (enterprise_watermark) {
deps += [ "//components/enterprise/watermarking:unit_tests" ]
}
if (enable_printing) {
deps += [
"//components/printing/browser/print_to_pdf:unit_tests",
"//components/printing/common:unit_tests",
"//components/services/print_compositor:unit_tests",
]
}
if (enable_print_preview) {
deps += [ "//components/pwg_encoder:unit_tests" ]
}
if (safe_browsing_mode != 0) {
deps += [
"//components/safe_browsing/content/browser:unit_tests",
"//components/safe_browsing/content/browser/download:unittests",
"//components/safe_browsing/content/common:file_type_policies_unittest",
"//components/safe_browsing/content/common:unit_tests",
"//components/safe_browsing/core/browser:safe_browsing_url_checker_unittest",
]
}
if (safe_browsing_mode != 0 && !is_ios) {
deps += [
# TODO(chromium: 1169835) components / reporting / storage / resources: unit_tests
# can't be run on iOS until they are updated.
"//components/safe_browsing/content/browser/password_protection:password_protection_unittest",
"//components/safe_browsing/content/browser/triggers:unit_tests",
"//components/safe_browsing/content/browser/web_ui:unit_tests",
"//components/safe_browsing/content/common:file_type_policies_policy_util_unittest",
]
}
if (safe_browsing_mode == 1) {
deps += [
"//components/safe_browsing/content/renderer:throttles_unittest",
"//components/safe_browsing/content/renderer/phishing_classifier:unit_tests",
"//components/safe_browsing/core/browser:ping_manager_unittest",
"//components/safe_browsing/core/browser:user_population_unittest",
"//components/safe_browsing/core/browser:verdict_cache_manager_unittest",
"//components/safe_browsing/core/browser/db:unit_tests_local_db",
"//components/safe_browsing/core/browser/db:v4_test_util",
"//components/safe_browsing/core/browser/password_protection:unit_tests",
"//components/safe_browsing/core/browser/sync:unittests",
"//components/safe_browsing/core/common:unit_tests",
]
} else if (safe_browsing_mode == 2) {
deps += [
"//components/safe_browsing/android:native_java_unittests_java",
"//components/safe_browsing/android:unit_tests_mobile",
]
}
if (use_dbus) {
deps += [
"//components/dbus/menu:unit_tests",
"//components/dbus/properties:unit_tests",
]
}
if (enable_pdf) {
deps += [
"//components/pdf/browser:unit_tests",
"//components/pdf/renderer:unit_tests",
]
}
if (is_win || is_mac || is_linux || is_chromeos) {
deps += [
"//components/metrics/structured:unit_tests",
"//components/metrics/structured/mojom:unit_tests",
"//components/user_notes/browser:unit_tests",
"//components/user_notes/storage:unit_tests",
]
}
if (enable_compose) {
deps += [ "//components/compose/core/browser:unit_tests" ]
}
# Only supported on cast-enabled platforms.
if (enable_cast_receiver) {
deps += [ "//components/cast_receiver:unit_tests" ]
}
if (is_mac) {
deps += [
"//components/remote_cocoa/app_shim:unit_tests",
"//components/remote_cocoa/common:unit_tests",
]
}
if (enable_reporting) {
deps += [ "//components/tpcd/enterprise_reporting:unit_tests" ]
}
# On LaCrOS, tests use ash - chrome as a window manager, thus the dependency.
# On other platforms, no components should depend on Chrome.
# Since //chrome depends on //extensions, we also only assert_no_deps on
# extensions targets for non-lacros builds.
if (!is_chromeos_lacros) {
assert_no_deps = [ "//chrome/*" ]
assert_no_deps += disallowed_extension_deps_
}
if (is_ios) {
assert_no_deps += ios_assert_no_deps
}
}
repack("components_tests_pak") {
sources = [
"$root_gen_dir/components/arc/input_overlay_resources.pak",
"$root_gen_dir/components/autofill/core/browser/autofill_address_rewriter_resources.pak",
"$root_gen_dir/components/components_resources.pak",
"$root_gen_dir/components/omnibox/resources/omnibox_pedal_synonyms_en-US.pak",
"$root_gen_dir/components/strings/components_locale_settings_en-US.pak",
"$root_gen_dir/components/strings/components_strings_en-US.pak",
]
output = "$root_out_dir/components_tests_resources.pak"
deps = [
# TODO(b/207518736): Input overlay resources will be changed to proto soon,
# thus not going to move this resource pak to under ash.
"//ash/components/arc/input_overlay/resources:resources_grit",
"//components/autofill/core/browser:autofill_address_rewriter_resources",
"//components/omnibox/resources:omnibox_pedal_synonyms",
"//components/resources",
"//components/strings",
]
sources += [ "${root_gen_dir}/components/strings/components_${branding_path_product}_strings_en-US.pak" ]
}
if (is_android) {
android_assets("components_browsertests_assets") {
testonly = true
sources = [
"$root_out_dir/components_tests_resources.pak",
"$root_out_dir/content_shell.pak",
]
deps = [
":components_tests_pak",
"//content/shell:pak",
"//gin:v8_snapshot_assets",
"//third_party/icu:icu_assets",
]
}
android_library("components_browsertests_java") {
testonly = true
deps = [
":components_browsertests_resources",
"//base:base_java",
"//base:base_java_test_support",
"//content/public/test/android:content_java_test_support",
"//content/shell/android:content_shell_browsertests_java",
"//testing/android/native_test:native_browser_test_java",
"//ui/android:ui_full_java",
]
sources = [
"test/android/browsertests_apk/src/org/chromium/components_browsertests_apk/ComponentsBrowserTestsActivity.java",
"test/android/browsertests_apk/src/org/chromium/components_browsertests_apk/ComponentsBrowserTestsApplication.java",
]
resources_package = "org.chromium.components_browsertests_apk"
}
jinja_template("components_browsertests_manifest") {
testonly = true
input =
"//components/test/android/browsertests_apk/AndroidManifest.xml.jinja2"
output =
"${target_gen_dir}/components_browsertests_manifest/AndroidManifest.xml"
}
android_resources("components_browsertests_resources") {
testonly = true
sources = [
"//components/test/android/browsertests_apk/res/layout/test_activity.xml",
]
}
}
if (use_blink) {
test("components_browsertests") {
use_xvfb = use_xvfb_in_this_config
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
sources = [
"browsing_data/content/browsing_data_helper_browsertest.h",
"browsing_data/content/local_storage_helper_browsertest.cc",
"content_settings/renderer/content_settings_agent_impl_browsertest.cc",
"continuous_search/renderer/search_result_extractor_browsertest.cc",
"dom_distiller/content/browser/distillable_page_utils_browsertest.cc",
"dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc",
"dom_distiller/content/browser/test/distilled_page_js_browsertest.cc",
"dom_distiller/content/browser/test/dom_distiller_js_browsertest.cc",
"dom_distiller/content/browser/test/test_util.cc",
"dom_distiller/content/browser/test/test_util.h",
"optimization_guide/content/renderer/page_text_agent_browsertest.cc",
"paint_preview/renderer/paint_preview_recorder_browsertest.cc",
"ukm/content/source_url_recorder_browsertest.cc",
"url_rewrite/browser/url_request_rewrite_rules_manager_browsertest.cc",
]
if (is_android && target_cpu == "arm64") {
sources += [ "memory_system/memory_system_tests.cc" ]
}
data = [
"$root_out_dir/components_tests_resources.pak",
"$root_out_dir/content_shell.pak",
"test/data/",
"dom_distiller/core/javascript/",
"security_state/content/testdata/",
"//content/test/data/",
"//third_party/node/node_modules/chai",
"//third_party/dom_distiller_js/dist/test/data/",
"//third_party/node/node_modules/mocha/mocha.js",
]
deps = [
"//base",
"//base/test:test_support",
"//components/autofill/content/browser",
"//components/autofill/content/browser:browser_tests",
"//components/autofill/content/renderer",
"//components/autofill/content/renderer:browser_tests",
"//components/autofill/content/renderer:test_support",
"//components/autofill/core/browser",
"//components/browsing_data/content",
"//components/content_capture/browser:browser_tests",
"//components/content_settings/core/common",
"//components/content_settings/renderer",
"//components/continuous_search/common/public/mojom",
"//components/continuous_search/renderer",
"//components/custom_handlers:browser_tests",
"//components/dom_distiller/content/browser",
"//components/dom_distiller/core",
"//components/dom_distiller/core:test_support",
"//components/error_page/content/browser:browser_tests",
"//components/facilitated_payments/content/renderer:browser_tests",
"//components/input:browser_tests",
"//components/js_injection/browser:browser_tests",
"//components/metrics:content",
"//components/optimization_guide/content/renderer",
"//components/paint_preview/renderer",
"//components/password_manager/content/browser",
"//components/performance_manager:browser_tests",
"//components/security_state/content",
"//components/security_state/core",
"//components/shared_highlighting/core/common",
"//components/strings",
"//components/ukm:test_support",
"//components/ukm/content",
"//components/url_rewrite/browser",
"//content/public/browser",
"//content/shell:content_shell_lib",
"//content/test:browsertest_support",
"//content/test:default_content_test_launcher",
"//content/test:test_support",
"//device/bluetooth",
"//google_apis",
"//ipc:test_support",
"//net:test_support",
"//printing/buildflags",
"//services/device/public/cpp:test_support",
"//services/device/public/mojom",
"//services/service_manager/public/cpp",
"//services/service_manager/public/mojom",
"//testing/gmock",
"//testing/gtest",
"//ui/base",
"//ui/native_theme:native_theme",
"//url",
]
data_deps = [
":components_tests_pak",
"//third_party/angle:includes",
]
if (is_mac) {
data_deps += [ "//content/shell:content_shell" ]
data += [ "$root_out_dir/Content Shell.app/" ]
}
if (toolkit_views && !is_mac) {
# TODO(crbug.com/349781050): Enable test on Mac.
deps += [ "//components/constrained_window:browser_tests" ]
}
if (is_ios) {
entitlements_path = "//content/app/ios/appex/app.entitlements"
bundle_deps = [
":components_tests_distiller_bundle_data",
":components_tests_pak_bundle_data",
"test:dom_distiller_test_bundle_data",
"test:url_rewrite_test_bundle_data",
"//content/test:content_process_bundle",
"//content/test:content_test_bundle_data",
"//content/test:gpu_process_bundle",
"//content/test:network_process_bundle",
]
}
if (enable_pdf) {
sources += [
"pdf/browser/pdf_document_helper_browsertest.cc",
"pdf/renderer/pdf_accessibility_tree_browsertest.cc",
]
deps += [
"//components/pdf/browser",
"//components/pdf/renderer",
"//pdf:accessibility",
"//pdf:features",
"//ui/strings:auto_image_annotation_strings",
]
}
if (enable_screen_ai_service) {
deps += [
"//services/screen_ai",
"//services/screen_ai:test_support",
"//services/screen_ai/public/mojom",
"//skia",
]
}
if (is_android) {
sources += [
"browser_ui/client_certificate/android/ssl_client_certificate_request_browsertest.cc",
"test/android/browsertests_apk/components_browser_tests_jni_onload.cc",
]
deps += [
"//components/browser_ui/client_certificate/android",
"//components/browser_ui/client_certificate/android:java",
"//components/download/internal/common:internal_java",
"//components/metrics:metrics_java",
"//components/version_info",
"//content/public/test/android:android_test_message_pump_support_java",
"//content/shell:content_shell_app",
"//content/test:android_test_message_pump_support",
"//testing/android/native_test:native_test_support",
]
use_default_launcher = false
android_manifest = "${target_gen_dir}/components_browsertests_manifest/AndroidManifest.xml"
android_manifest_dep = ":components_browsertests_manifest"
deps += [
":components_browsertests_assets",
":components_browsertests_java",
]
}
if (is_linux || is_chromeos) {
# content_extractor_browsertest is a standalone content extraction tool built as
# a MANUAL component_browsertest.
sources += [ "dom_distiller/standalone/content_extractor_browsertest.cc" ]
deps += [
"//components/leveldb_proto",
"//components/prefs:test_support",
"//components/sync_preferences:test_support",
]
}
if (is_chromeos) {
sources += [ "feedback/content/content_tracing_manager_browsertest.cc" ]
deps += [
"//base",
"//base/test:test_support",
"//components/feedback",
"//components/feedback/content",
"//services/network:test_support",
"//testing/gmock",
"//testing/gtest",
]
}
if (enable_printing) {
sources += [ "printing/test/print_render_frame_helper_browsertest.cc" ]
deps += [
"//build:chromeos_buildflags",
"//components/printing/browser",
"//components/printing/common:mojo_interfaces",
"//components/printing/test:test_support",
]
}
# On LaCrOS, tests use ash - chrome as a window manager, thus the
# dependency. On other platforms, no components should depend on Chrome.
# Since //chrome depends on //extensions, we also only assert_no_deps on
# extensions targets for non-lacros builds.
if (!is_chromeos_lacros) {
assert_no_deps = [ "//chrome/*" ]
assert_no_deps += disallowed_extension_deps_
}
if (is_fuchsia) {
additional_manifest_fragments = [
"//build/config/fuchsia/test/present_view.shard.test-cml",
"//build/config/fuchsia/test/fonts.shard.test-cml",
"//build/config/fuchsia/test/mark_vmo_executable.shard.test-cml",
"//build/config/fuchsia/test/network.shard.test-cml",
]
}
# This test won't work as-is on POSIX platforms, where fork()+exec() is
# used to launch child processes, failure does not happen until exec().
# See also ServiceProcessLauncherTest.FailToLaunchProcess and
# UtilityProcessHostBrowserTest.FailToLaunchProcess.
if (!is_posix || is_mac) {
sources += [
"metrics/content/content_stability_metrics_provider_browsertest.cc",
]
deps += [
"//components/prefs:test_support",
"//components/variations",
"//content/test:content_test_mojo_bindings",
"//sandbox",
]
}
}
test("components_perftests") {
sources = [
"attribution_reporting/aggregatable_utils_perftest.cc",
"attribution_reporting/privacy_math_perftest.cc",
"discardable_memory/common/discardable_shared_memory_heap_perftest.cc",
"omnibox/browser/history_quick_provider_performance_unittest.cc",
"subresource_filter/core/common/perftests/indexed_ruleset_perftest.cc",
"test/run_all_perftests.cc",
"visitedlink/test/visitedlink_perftest.cc",
]
deps = [
"//base",
"//components/attribution_reporting",
"//components/bookmarks/test",
"//components/discardable_memory/common",
"//components/history/core/test",
"//components/omnibox/browser",
"//components/omnibox/browser:test_support",
"//components/subresource_filter/core/common",
"//components/subresource_filter/tools:tools_lib",
"//components/test:test_support",
"//components/visitedlink/browser",
"//testing/perf",
"//third_party/google_benchmark:google_benchmark",
"//url",
]
data_deps = [
":components_tests_pak",
"//ui/resources:ui_test_pak_data",
# Needed for isolate script to execute.
"//testing:run_perf_test",
]
data = [
"//components/subresource_filter/core/common/perftests/data/",
"//third_party/subresource-filter-ruleset/data/",
]
if (is_android) {
deps += [
"//gin:v8_snapshot_assets",
"//ui/android:ui_java",
]
}
if (safe_browsing_mode == 1 || is_ios) {
sources += [ "safe_browsing/core/browser/db/v4_store_perftest.cc" ]
deps += [
"//components/safe_browsing/core/browser/db:v4_protocol_manager_util",
"//components/safe_browsing/core/browser/db:v4_store",
"//components/safe_browsing/core/browser/db:v4_test_util",
"//crypto",
]
}
}
}
if (is_android) {
robolectric_binary("components_junit_tests") {
deps = [
"//components/android_autofill/browser/junit:components_autofill_junit_tests",
"//components/autofill/android:payments_autofill_junit_tests",
"//components/background_task_scheduler:components_background_task_scheduler_junit_tests",
"//components/browser_ui/bottomsheet/android/internal:junit_tests",
"//components/browser_ui/client_certificate/android:junit",
"//components/browser_ui/media/android:junit",
"//components/browser_ui/photo_picker/android:junit",
"//components/browser_ui/settings/android:junit",
"//components/browser_ui/util/android:junit",
"//components/browser_ui/webshare/android:junit",
"//components/browser_ui/widget/android:junit",
"//components/commerce/core/android:junit_tests",
"//components/content_capture/android/junit:components_content_capture_junit_tests",
"//components/crash/android:junit",
"//components/data_sharing/internal:data_sharing_junit_tests",
"//components/download/network:junit",
"//components/embedder_support/android:components_embedder_support_junit_tests",
"//components/facilitated_payments/android/junit",
"//components/gcm_driver/android:components_gcm_driver_junit_tests",
"//components/image_fetcher:junit",
"//components/installedapp/android:junit",
"//components/language/android:junit",
"//components/media_router/browser/android:junit",
"//components/messages/android:junit",
"//components/messages/android/internal:junit",
"//components/payments/content/android:junit",
"//components/permissions/android:components_permissions_junit_tests",
"//components/policy/android:components_policy_junit_tests",
"//components/prefs/android:junit",
"//components/signin/public/android:junit",
"//components/stylus_handwriting/android:stylus_handwriting_junit_tests",
"//components/subresource_filter/android:junit",
"//components/variations/android:components_variations_junit_tests",
"//components/webapk/android/libs/client:junit",
"//components/webapps/browser/android:junit",
"//components/webauthn/android:junit",
]
shared_libraries = [ "//components/robolectric:libcomponents_junit_tests($robolectric_toolchain)" ]
}
}