blob: ef92ebe22890df34ced0fb818a5b03d3c561582e [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/jumbo.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//third_party/libprotobuf-mutator/fuzzable_proto_library.gni")
if (is_android) {
import("//build/config/android/config.gni")
}
# TODO(crbug.com/706392): Fix password reuse detection for Android.
password_reuse_detection_support = !is_android && !is_ios
config("password_reuse_detection_config") {
if (password_reuse_detection_support) {
defines = [ "SYNC_PASSWORD_REUSE_DETECTION_ENABLED" ]
}
}
jumbo_static_library("browser") {
sources = [
"android_affiliation/affiliated_match_helper.cc",
"android_affiliation/affiliated_match_helper.h",
"android_affiliation/affiliation_backend.cc",
"android_affiliation/affiliation_backend.h",
"android_affiliation/affiliation_database.cc",
"android_affiliation/affiliation_database.h",
"android_affiliation/affiliation_fetch_throttler.cc",
"android_affiliation/affiliation_fetch_throttler.h",
"android_affiliation/affiliation_fetch_throttler_delegate.h",
"android_affiliation/affiliation_fetcher.cc",
"android_affiliation/affiliation_fetcher.h",
"android_affiliation/affiliation_fetcher_delegate.h",
"android_affiliation/affiliation_service.cc",
"android_affiliation/affiliation_service.h",
"android_affiliation/affiliation_utils.cc",
"android_affiliation/affiliation_utils.h",
"android_affiliation/facet_manager.cc",
"android_affiliation/facet_manager.h",
"android_affiliation/facet_manager_host.h",
"android_affiliation/lookup_affiliation_response_parser.cc",
"android_affiliation/lookup_affiliation_response_parser.h",
"android_affiliation/test_affiliation_fetcher_factory.h",
"blacklisted_duplicates_cleaner.cc",
"blacklisted_duplicates_cleaner.h",
"browser_save_password_progress_logger.cc",
"browser_save_password_progress_logger.h",
"credential_manager_impl.cc",
"credential_manager_impl.h",
"credential_manager_logger.cc",
"credential_manager_logger.h",
"credential_manager_password_form_manager.cc",
"credential_manager_password_form_manager.h",
"credential_manager_pending_prevent_silent_access_task.cc",
"credential_manager_pending_prevent_silent_access_task.h",
"credential_manager_pending_request_task.cc",
"credential_manager_pending_request_task.h",
"credentials_cleaner.cc",
"credentials_cleaner.h",
"credentials_cleaner_runner.cc",
"credentials_cleaner_runner.h",
"credentials_filter.h",
"export/csv_writer.cc",
"export/csv_writer.h",
"export/password_csv_writer.cc",
"export/password_csv_writer.h",
"export/password_manager_exporter.cc",
"export/password_manager_exporter.h",
"form_fetcher.h",
"form_fetcher_impl.cc",
"form_fetcher_impl.h",
"form_saver.h",
"form_saver_impl.cc",
"form_saver_impl.h",
"form_submission_observer.h",
"http_password_store_migrator.cc",
"http_password_store_migrator.h",
"import/csv_reader.cc",
"import/csv_reader.h",
"import/password_csv_reader.cc",
"import/password_csv_reader.h",
"import/password_importer.cc",
"import/password_importer.h",
"invalid_realm_credential_cleaner.cc",
"invalid_realm_credential_cleaner.h",
"keychain_migration_status_mac.h",
"log_manager.cc",
"log_manager.h",
"log_receiver.h",
"log_router.cc",
"log_router.h",
"login_database.cc",
"login_database.h",
"login_database_ios.cc",
"login_database_mac.cc",
"login_database_win.cc",
"login_model.cc",
"login_model.h",
"manage_passwords_referrer.h",
"new_password_form_manager.cc",
"new_password_form_manager.h",
"password_autofill_manager.cc",
"password_autofill_manager.h",
"password_bubble_experiment.cc",
"password_bubble_experiment.h",
"password_form_filling.cc",
"password_form_filling.h",
"password_form_manager.cc",
"password_form_manager.h",
"password_form_manager_for_ui.h",
"password_form_metrics_recorder.cc",
"password_form_metrics_recorder.h",
"password_form_user_action.h",
"password_generation_manager.cc",
"password_generation_manager.h",
"password_list_sorter.cc",
"password_list_sorter.h",
"password_manager.cc",
"password_manager.h",
"password_manager_client.cc",
"password_manager_client.h",
"password_manager_client_helper.cc",
"password_manager_client_helper.h",
"password_manager_constants.cc",
"password_manager_constants.h",
"password_manager_driver.h",
"password_manager_internals_service.cc",
"password_manager_internals_service.h",
"password_manager_metrics_recorder.cc",
"password_manager_metrics_recorder.h",
"password_manager_metrics_util.cc",
"password_manager_metrics_util.h",
"password_manager_util.cc",
"password_manager_util.h",
"password_requirements_service.cc",
"password_requirements_service.h",
"password_store.cc",
"password_store.h",
"password_store_change.cc",
"password_store_change.h",
"password_store_consumer.cc",
"password_store_consumer.h",
"password_store_default.cc",
"password_store_default.h",
"password_store_factory_util.cc",
"password_store_factory_util.h",
"password_store_sync.cc",
"password_store_sync.h",
"password_sync_util.cc",
"password_sync_util.h",
"password_ui_utils.cc",
"password_ui_utils.h",
"psl_matching_helper.cc",
"psl_matching_helper.h",
"site_affiliation/asset_link_data.cc",
"site_affiliation/asset_link_data.h",
"sql_table_builder.cc",
"sql_table_builder.h",
"statistics_table.cc",
"statistics_table.h",
"store_metrics_reporter.cc",
"store_metrics_reporter.h",
"suppressed_form_fetcher.cc",
"suppressed_form_fetcher.h",
"sync/password_data_type_controller.cc",
"sync/password_data_type_controller.h",
"sync/password_model_type_controller.cc",
"sync/password_model_type_controller.h",
"sync/password_model_worker.cc",
"sync/password_model_worker.h",
"sync/password_sync_bridge.cc",
"sync/password_sync_bridge.h",
"sync/password_syncable_service.cc",
"sync/password_syncable_service.h",
"sync/password_syncable_service_based_model_type_controller.cc",
"sync/password_syncable_service_based_model_type_controller.h",
"sync_credentials_filter.cc",
"sync_credentials_filter.h",
"ui/credential_provider_interface.h",
"ui/export_flow.h",
"ui/export_progress_status.h",
"ui/import_flow.h",
"votes_uploader.cc",
"votes_uploader.h",
]
all_dependent_configs = [ ":password_reuse_detection_config" ]
if (password_reuse_detection_support) {
sources += [
"password_reuse_detection_manager.cc",
"password_reuse_detection_manager.h",
"password_reuse_detector.cc",
"password_reuse_detector.h",
"password_reuse_detector_consumer.cc",
"password_reuse_detector_consumer.h",
]
if (is_win || is_mac || is_linux || is_chromeos) {
sources += [
"password_store_signin_notifier.cc",
"password_store_signin_notifier.h",
]
}
}
public_deps = [
"//base",
"//components/sync",
]
deps = [
":hash_password_manager",
":password_hash_data",
":proto",
"//base:i18n",
"//components/autofill/core/browser",
"//components/autofill/core/browser:password_generator",
"//components/autofill/core/browser/proto",
"//components/autofill/core/common",
"//components/favicon/core",
"//components/keyed_service/core",
"//components/os_crypt",
"//components/password_manager/core/browser/form_parsing",
"//components/password_manager/core/common",
"//components/pref_registry",
"//components/prefs",
"//components/security_state/core",
"//components/signin/core/browser",
"//components/strings",
"//components/sync",
"//components/sync_preferences",
"//components/url_formatter",
"//components/variations",
"//components/webdata/common",
"//google_apis",
"//net",
"//services/identity/public/cpp:cpp",
"//services/metrics/public/cpp:metrics_cpp",
"//services/metrics/public/cpp:ukm_builders",
"//services/network/public/cpp",
"//sql",
"//third_party/protobuf:protobuf_lite",
"//third_party/re2",
"//ui/base",
"//ui/gfx",
"//url",
]
if (!is_ios) {
sources += [
"hsts_query.cc",
"hsts_query.h",
"http_credentials_cleaner.cc",
"http_credentials_cleaner.h",
]
deps += [ "//components/safe_browsing/common:safe_browsing_prefs" ]
}
if (is_posix && !is_mac && !is_ios) {
sources += [ "login_database_posix.cc" ]
}
if (is_mac && !is_ios) {
sources += [
"password_recovery_util_mac.cc",
"password_recovery_util_mac.h",
]
}
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
}
if (is_android) {
java_cpp_enum("password_manager_java_enums_srcjar") {
sources = [
"manage_passwords_referrer.h",
]
}
}
fuzzable_proto_library("proto") {
sources = [
"android_affiliation/affiliation_api.proto",
]
}
jumbo_static_library("password_hash_data") {
sources = [
"password_hash_data.cc",
"password_hash_data.h",
]
deps = [
"//base",
"//crypto",
"//google_apis",
]
}
static_library("hash_password_manager") {
sources = [
"hash_password_manager.cc",
"hash_password_manager.h",
]
deps = [
":password_hash_data",
"//base:base",
"//components/os_crypt",
"//components/password_manager/core/common",
"//components/prefs",
]
}
jumbo_static_library("test_support") {
testonly = true
sources = [
"android_affiliation/fake_affiliation_api.cc",
"android_affiliation/fake_affiliation_api.h",
"android_affiliation/fake_affiliation_fetcher.cc",
"android_affiliation/fake_affiliation_fetcher.h",
"android_affiliation/mock_affiliated_match_helper.cc",
"android_affiliation/mock_affiliated_match_helper.h",
"android_affiliation/mock_affiliation_consumer.cc",
"android_affiliation/mock_affiliation_consumer.h",
"fake_form_fetcher.cc",
"fake_form_fetcher.h",
"mock_password_store.cc",
"mock_password_store.h",
"password_manager_test_utils.cc",
"password_manager_test_utils.h",
"stub_credentials_filter.cc",
"stub_credentials_filter.h",
"stub_form_saver.cc",
"stub_form_saver.h",
"stub_log_manager.cc",
"stub_log_manager.h",
"stub_password_manager_client.cc",
"stub_password_manager_client.h",
"stub_password_manager_driver.cc",
"stub_password_manager_driver.h",
"test_password_store.cc",
"test_password_store.h",
]
public_deps = [
":browser",
":hash_password_manager",
"//components/ukm",
"//services/network/public/cpp",
"//testing/gmock",
"//url:url",
]
deps = [
"//base",
"//components/autofill/core/common",
"//net:net",
"//testing/gtest",
]
}
bundle_data("unit_tests_bundle_data") {
visibility = [ ":unit_tests" ]
testonly = true
sources = [
"//components/test/data/password_manager/affiliation_db_v1.sql",
"//components/test/data/password_manager/affiliation_db_v2.sql",
"//components/test/data/password_manager/login_db_v1.sql",
"//components/test/data/password_manager/login_db_v10.sql",
"//components/test/data/password_manager/login_db_v11.sql",
"//components/test/data/password_manager/login_db_v12.sql",
"//components/test/data/password_manager/login_db_v13.sql",
"//components/test/data/password_manager/login_db_v14.sql",
"//components/test/data/password_manager/login_db_v15.sql",
"//components/test/data/password_manager/login_db_v16.sql",
"//components/test/data/password_manager/login_db_v17.sql",
"//components/test/data/password_manager/login_db_v18.sql",
"//components/test/data/password_manager/login_db_v19.sql",
"//components/test/data/password_manager/login_db_v1_broken.sql",
"//components/test/data/password_manager/login_db_v2.sql",
"//components/test/data/password_manager/login_db_v2_broken.sql",
"//components/test/data/password_manager/login_db_v3.sql",
"//components/test/data/password_manager/login_db_v3_broken.sql",
"//components/test/data/password_manager/login_db_v4.sql",
"//components/test/data/password_manager/login_db_v5.sql",
"//components/test/data/password_manager/login_db_v6.sql",
"//components/test/data/password_manager/login_db_v7.sql",
"//components/test/data/password_manager/login_db_v8.sql",
"//components/test/data/password_manager/login_db_v9.sql",
"//components/test/data/password_manager/login_db_v9_without_use_additional_auth_field.sql",
]
outputs = [
"{{bundle_resources_dir}}/" +
"{{source_root_relative_dir}}/{{source_file_part}}",
]
}
source_set("unit_tests") {
testonly = true
sources = [
"android_affiliation/affiliated_match_helper_unittest.cc",
"android_affiliation/affiliation_backend_unittest.cc",
"android_affiliation/affiliation_database_unittest.cc",
"android_affiliation/affiliation_fetch_throttler_unittest.cc",
"android_affiliation/affiliation_fetcher_unittest.cc",
"android_affiliation/affiliation_service_unittest.cc",
"android_affiliation/affiliation_utils_unittest.cc",
"android_affiliation/facet_manager_unittest.cc",
"blacklisted_duplicates_cleaner_unittest.cc",
"browser_save_password_progress_logger_unittest.cc",
"credential_manager_impl_unittest.cc",
"credential_manager_logger_unittest.cc",
"credential_manager_password_form_manager_unittest.cc",
"credentials_cleaner_runner_unittest.cc",
"credentials_cleaner_unittest.cc",
"export/csv_writer_unittest.cc",
"export/password_csv_writer_unittest.cc",
"export/password_manager_exporter_unittest.cc",
"form_fetcher_impl_unittest.cc",
"form_saver_impl_unittest.cc",
"http_password_store_migrator_unittest.cc",
"import/csv_reader_unittest.cc",
"import/password_csv_reader_unittest.cc",
"import/password_importer_unittest.cc",
"invalid_realm_credential_cleaner_unittest.cc",
"log_manager_unittest.cc",
"log_router_unittest.cc",
"login_database_unittest.cc",
"login_model_unittest.cc",
"new_password_form_manager_unittest.cc",
"password_autofill_manager_unittest.cc",
"password_bubble_experiment_unittest.cc",
"password_form_filling_unittest.cc",
"password_form_manager_unittest.cc",
"password_form_metrics_recorder_unittest.cc",
"password_generation_manager_unittest.cc",
"password_hash_data_unittest.cc",
"password_list_sorter_unittest.cc",
"password_manager_metrics_recorder_unittest.cc",
"password_manager_unittest.cc",
"password_manager_util_unittest.cc",
"password_requirements_service_unittest.cc",
"password_store_default_unittest.cc",
"password_store_origin_unittest.h",
"password_store_unittest.cc",
"password_sync_util_unittest.cc",
"password_ui_utils_unittest.cc",
"psl_matching_helper_unittest.cc",
"site_affiliation/asset_link_data_unittest.cc",
"sql_table_builder_unittest.cc",
"statistics_table_unittest.cc",
"store_metrics_reporter_unittest.cc",
"suppressed_form_fetcher_unittest.cc",
"sync/password_syncable_service_unittest.cc",
"sync_credentials_filter_unittest.cc",
"sync_username_test_base.cc",
"sync_username_test_base.h",
"vote_uploads_test_matchers.h",
"votes_uploader_unittest.cc",
]
if (is_mac) {
sources -= [ "password_store_default_unittest.cc" ]
}
if (is_ios) {
sources += [ "login_database_ios_unittest.cc" ]
} else {
sources += [
"hsts_query_unittest.cc",
"http_credentials_cleaner_unittest.cc",
]
}
if (password_reuse_detection_support) {
sources += [
"password_reuse_detection_manager_unittest.cc",
"password_reuse_detector_unittest.cc",
]
}
if (is_win || is_mac || is_linux || is_chromeos) {
sources += [ "hash_password_manager_unittest.cc" ]
}
deps = [
":hash_password_manager",
":password_hash_data",
":test_support",
":unit_tests_bundle_data",
"//base/test:test_support",
"//components/autofill/core/browser:test_support",
"//components/autofill/core/browser/proto",
"//components/autofill/core/common",
"//components/favicon/core/test:test_support",
"//components/os_crypt",
"//components/os_crypt:test_support",
"//components/password_manager/core/browser:proto",
"//components/password_manager/core/browser/form_parsing:unit_tests",
"//components/password_manager/core/browser/form_parsing/fuzzer:unit_tests",
"//components/password_manager/core/common",
"//components/prefs:test_support",
"//components/security_state/core",
"//components/signin/core/browser:test_support",
"//components/strings",
"//components/sync:test_support_driver",
"//components/sync:test_support_model",
"//components/sync_preferences:test_support",
"//components/ukm:test_support",
"//components/variations",
"//google_apis:google_apis",
"//net:test_support",
"//services/identity/public/cpp:test_support",
"//services/metrics/public/cpp:ukm_builders",
"//services/network:network_service",
"//services/network:test_support",
"//services/network/public/cpp",
"//sql:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/sqlite",
"//ui/base",
"//ui/gfx:test_support",
"//url",
]
if (password_reuse_detection_support) {
deps += [
"//components/safe_browsing:features",
"//components/safe_browsing/common:safe_browsing_prefs",
]
}
}
fuzzer_test("csv_reader_fuzzer") {
sources = [
"import/password_csv_reader_fuzzer.cc",
]
deps = [
":browser",
"//base:i18n",
"//components/autofill/core/common:common",
]
seed_corpus = "import/password_csv_reader_corpus"
dict = "import/password_csv_reader_fuzzer.dict"
}
if (use_libfuzzer) {
fuzzer_test("lookup_affiliation_response_parser_fuzzer") {
sources = [
"android_affiliation/lookup_affiliation_response_parser_fuzzer.cc",
]
deps = [
":browser",
":proto",
"//base:base",
"//base:i18n",
"//third_party/libprotobuf-mutator",
]
}
}