# Copyright 2018 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//ios/web/public/js_messaging/optimize_js.gni") import("//ios/web/public/js_messaging/optimize_ts.gni") import("//testing/libfuzzer/fuzzer_test.gni") import("//testing/test.gni") source_set("form_util") { sources = [ "form_activity_observer.h", "form_activity_observer_bridge.h", "form_activity_observer_bridge.mm", "form_activity_params.h", "form_activity_params.mm", "form_activity_tab_helper.h", "form_activity_tab_helper.mm", ] deps = [ ":child_frame_registrar", "//base", "//components/autofill/core/common", "//components/autofill/ios/browser:util", "//components/autofill/ios/common", "//ios/web/public", "//ios/web/public/js_messaging", ] configs += [ "//build/config/compiler:wexit_time_destructors" ] } source_set("form_handler_feature") { sources = [ "form_handlers_java_script_feature.h", "form_handlers_java_script_feature.mm", ] deps = [ ":autofill_form_features", ":child_frame_registration_lib_js", ":form_handlers_js", ":form_util", ":frame_registration_feature", ":register_remote_frame_token_js", "//base", "//components/autofill/core/common:features", "//components/autofill/ios/common", "//components/autofill/ios/common:autofill_optimization_features", "//ios/web/public/js_messaging", ] configs += [ "//build/config/compiler:wexit_time_destructors" ] } source_set("renderer_id_test_util") { testonly = true sources = [ "renderer_id_test_util.h", "renderer_id_test_util.mm", ] deps = [ "//base", "//components/autofill/core/common", "//ios/web/public/js_messaging", ] } # For inclusion by other TS/JS files, so they can check feature state compile_ts("autofill_form_features_ts") { sources = [ "resources/autofill_form_features.ts" ] deps = [ "//ios/web/public/js_messaging:gcrweb" ] } # For bundling with autofill_form_features, which enables/disables features optimize_js("autofill_form_features_ts_bundling") { deps = [ ":autofill_form_features_ts", "//ios/web/public/js_messaging:gcrweb", ] _script = filter_include(get_target_outputs(":autofill_form_features_ts"), [ "*autofill_form_features.js" ]) primary_script = _script[0] sources = _script } source_set("frame_registration_feature") { sources = [ "remote_frame_registration_java_script_feature.h", "remote_frame_registration_java_script_feature.mm", ] deps = [ ":autofill_form_features", ":child_frame_registrar", ":child_frame_registration_ts", "//base", "//components/autofill/core/common:features", "//components/autofill/ios/common", "//ios/web/public", "//ios/web/public/js_messaging", ] } compile_ts("child_frame_registration_ts") { sources = [ "resources/child_frame_registration_lib.ts" ] deps = [ ":autofill_form_features_ts", ":fill_js_constants", "//ios/web/public/js_messaging:gcrweb", "//ios/web/public/js_messaging:util_scripts", ] } optimize_js("child_frame_registration_lib_js") { deps = [ ":autofill_form_features_ts", ":child_frame_registration_ts", ":fill_js_constants", "//ios/web/public/js_messaging:gcrweb", "//ios/web/public/js_messaging:util_scripts", ] _script = filter_include(get_target_outputs(":child_frame_registration_ts"), [ "*child_frame_registration_lib.js" ]) primary_script = _script[0] sources = _script output_name = "child_frame_registration_lib" } compile_ts("child_frame_registration_test_ts") { sources = [ "resources/child_frame_registration_test.ts" ] deps = [ ":child_frame_registration_ts" ] } compile_ts("fill_js_dependencies") { sources = [ "resources/fill_element_inference.ts", "resources/fill_element_inference_util.ts", "resources/fill_util.ts", "resources/fill_web_form.ts", "resources/form_utils.ts", ] deps = [ ":autofill_form_features_ts", ":autofill_renderer_id_js", ":child_frame_registration_ts", ":fill_js_constants", "//ios/web/public/js_messaging:gcrweb", "//ios/web/public/js_messaging:util_scripts", ] } compile_ts("fill_js_constants") { sources = [ "resources/fill_constants.ts" ] deps = [ "//ios/web/public/js_messaging:gcrweb" ] } optimize_ts("fill_util_test_js") { sources = [ "resources/fill_util_test.ts" ] deps = [ ":child_frame_registration_test_ts", ":fill_js_dependencies", "//ios/web/public/js_messaging:gcrweb", ] } optimize_ts("form_util_test_js") { sources = [ "resources/form_util_tests.ts" ] deps = [ ":fill_js_dependencies", "//ios/web/public/js_messaging:gcrweb", ] } optimize_ts("form_handlers_js") { sources = [ "resources/form_handlers.ts" ] deps = [ ":child_frame_registration_ts", ":fill_js_dependencies", "//ios/web/public/js_messaging:gcrweb", "//ios/web/public/js_messaging:util_scripts", ] } optimize_ts("register_remote_frame_token_js") { sources = [ "resources/register_remote_frame_token.ts" ] deps = [ ":child_frame_registration_ts", ":fill_js_dependencies", "//ios/web/public/js_messaging:gcrweb", "//ios/web/public/js_messaging:util_scripts", ] } compile_ts("autofill_renderer_id_js") { sources = [ "resources/renderer_id.ts" ] deps = [ ":fill_js_constants" ] } optimize_ts("renderer_id_test") { sources = [ "resources/renderer_id_test.ts" ] deps = [ ":autofill_renderer_id_js" ] } source_set("programmatic_form_submission_handler_feature") { sources = [ "programmatic_form_submission_handler_java_script_feature.h", "programmatic_form_submission_handler_java_script_feature.mm", ] deps = [ ":autofill_form_features", ":form_util", ":programatic_form_submission_js", "//base", "//components/autofill/ios/common", "//components/autofill/ios/common:autofill_optimization_features", "//ios/web/public/js_messaging", "//ios/web/public/js_messaging:content_world_header", ] configs += [ "//build/config/compiler:wexit_time_destructors" ] } optimize_ts("programatic_form_submission_js") { sources = [ "resources/programmatic_form_submission_handler.ts" ] deps = [ ":fill_js_dependencies", "//ios/web/public/js_messaging:gcrweb", ] } source_set("test_support") { testonly = true sources = [ "autofill_test_with_web_state.h", "autofill_test_with_web_state.mm", "test_form_activity_observer.h", "test_form_activity_observer.mm", "test_form_activity_tab_helper.h", "test_form_activity_tab_helper.mm", ] deps = [ ":form_handler_feature", ":form_util", "//base", "//base/test:test_support", "//components/autofill/core/common", "//ios/web/public", "//ios/web/public/js_messaging", "//ios/web/public/test", "//ios/web/public/test:test_fixture", "//testing/gtest", ] } source_set("child_frame_registrar") { sources = [ "child_frame_registrar.h", "child_frame_registrar.mm", ] deps = [ "//base", "//components/autofill/core/common", "//components/autofill/ios/browser:util", "//components/autofill/ios/common", "//ios/web/public", "//ios/web/public/js_messaging", ] } source_set("autofill_form_features") { sources = [ "autofill_form_features_java_script_feature.h", "autofill_form_features_java_script_feature.mm", ] deps = [ ":autofill_form_features_ts_bundling", "//base", "//components/autofill/core/common:features", "//components/autofill/ios/common", "//ios/web/public/js_messaging", ] configs += [ "//build/config/compiler:wexit_time_destructors" ] } source_set("unit_tests") { testonly = true sources = [ "child_frame_registrar_unittest.mm", "fill_js_unittest.mm", "form_activity_observer_bridge_unittest.mm", "form_activity_tab_helper_unittest.mm", "form_unittest.mm", "remote_frame_token_registration_unittest.mm", ] deps = [ ":autofill_form_features", ":child_frame_registrar", ":fill_util_test_js", ":form_handler_feature", ":form_util", ":form_util_test_js", ":programmatic_form_submission_handler_feature", ":renderer_id_test", ":renderer_id_test_util", ":test_support", "//base", "//base/test:test_support", "//components/autofill/core/common", "//components/autofill/core/common:test_support", "//components/autofill/ios/browser", "//components/autofill/ios/browser:test_support", "//components/autofill/ios/browser:util", "//components/autofill/ios/common", "//components/autofill/ios/common:autofill_optimization_features", "//ios/web/public/js_messaging", "//ios/web/public/js_messaging:content_world_header", "//ios/web/public/js_messaging:web_view_js_utils", "//ios/web/public/test:javascript_test", "//ios/web/public/test:test_fixture", "//ios/web/public/test:util", "//ios/web/public/test/fakes", "//testing/gmock", "//testing/gtest", "//url", ] } if (is_ios) { fuzzer_test("form_activity_tab_helper_fuzzer") { additional_configs = [ "//testing/libfuzzer:build_for_ios_clusterfuzz_job" ] sources = [ "form_activity_tab_helper_fuzzer.mm" ] deps = [ ":form_util", "//base/test:test_support", "//ios/web/public", "//ios/web/public/js_messaging", "//ios/web/public/js_messaging/fuzzer_support", "//ios/web/public/js_messaging/fuzzer_support:js_message_proto", "//ios/web/public/test", "//ios/web/public/test:fuzzer_support", "//ios/web/public/test:test_fixture", "//third_party/libprotobuf-mutator", ] # TODO(crbug.com/505034799): Migrate to FUZZ_TEST. is_fuzztest_compatible = false } }