# Copyright 2015 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("//ios/build/config.gni") import("//ios/web/js_compile.gni") import("//mojo/public/tools/bindings/mojom.gni") import("//testing/test.gni") import("//tools/grit/grit_rule.gni") group("all_tests") { testonly = true deps = [ ":ios_web_inttests", ":ios_web_unittests", ] } source_set("web") { public_deps = [ ":service_names", # TODO(crbug.com/616244): Remove private files from public dependencies. "//ios/web/navigation:core", "//ios/web/net", "//ios/web/public", "//ios/web/public/download", "//ios/web/web_state", "//ios/web/web_state:error_translation_util", "//ios/web/web_state:navigation_context", "//ios/web/web_state:web_state_impl_header", "//ios/web/web_state/ui", "//ios/web/web_state/ui:wk_web_view_configuration_provider", "//ios/web/webui", "//net", ] deps = [ ":core", ":js_resources", ":navigation_resources", ":resources", "//base", "//ios/web/download", "//ios/web/interstitials", "//ios/web/navigation", "//ios/web/net", "//ios/web/public", "//ios/web/web_state:web_view_internal_creation_util", "//services/catalog/public/cpp", "//services/service_manager", "//services/service_manager/embedder", "//services/service_manager/runner/common", ] sources = [ "browser_state.mm", "browser_url_rewriter_impl.h", "browser_url_rewriter_impl.mm", "crw_navigation_item_storage.mm", "features.mm", "load_committed_details.cc", "service_manager_connection_impl.cc", "service_manager_connection_impl.h", "service_manager_context.h", "service_manager_context.mm", "url_scheme_util.mm", "url_util.cc", "web_client.mm", "web_kit_constants.cc", "web_thread_impl.cc", "web_thread_impl.h", "web_view_creation_util.mm", ] libs = [ "WebKit.framework" ] configs += [ "//build/config/compiler:enable_arc" ] } mojom("service_names") { sources = [ "public/service_names.mojom", ] } source_set("core") { configs += [ "//build/config/compiler:enable_arc" ] deps = [ "//base", "//url", ] sources = [ "history_state_util.cc", "history_state_util.h", ] } source_set("earl_grey_test_support") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true deps = [ ":web", "//base", "//base/test:test_support", "//ios/testing:ios_test_support", "//ios/testing/earl_grey:earl_grey_support", "//ios/third_party/earl_grey:earl_grey+link", "//ios/web/interstitials", "//ios/web/public/test", "//net", ] sources = [ "public/test/earl_grey/js_test_util.h", "public/test/earl_grey/js_test_util.mm", "public/test/earl_grey/web_view_actions.h", "public/test/earl_grey/web_view_actions.mm", "public/test/earl_grey/web_view_matchers.h", "public/test/earl_grey/web_view_matchers.mm", ] } source_set("run_all_unittests") { testonly = true sources = [ "test/run_all_unittests.cc", ] deps = [ "//base", "//base/test:test_support", "//ios/web/public/test", "//ios/web/public/test/http_server", "//mojo/edk/system", ] } bundle_data("ios_web_unittests_bundle_data") { testonly = true sources = [ "test/data/chrome.html", "test/data/testbadpass.pkpass", "test/data/testfavicon.png", "test/data/testpass.pkpass", ] outputs = [ "{{bundle_resources_dir}}/{{source_root_relative_dir}}/" + "{{source_file_part}}", ] } test("ios_web_unittests") { deps = [ # Ensure all required data are present in the bundle, and that the # test runner is linked. ":ios_web_unittests_bundle_data", ":run_all_unittests", # Add individual test source_set targets here. ":ios_web_general_unittests", ":ios_web_navigation_unittests", ":ios_web_net_unittests", ":ios_web_public_unittests", ":ios_web_web_state_js_unittests", ":ios_web_web_state_ui_unittests", ":ios_web_web_state_unittests", ":ios_web_webui_unittests", "//ios/testing:http_server_bundle_data", "//ios/web/download:download_unittests", "//ios/web/interstitials:interstitials_unittests", ] assert_no_deps = ios_assert_no_deps configs += [ "//build/config/compiler:enable_arc" ] } source_set("ios_web_general_unittests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true deps = [ ":core", ":web", "//base", "//base/test:test_support", "//components/url_formatter", "//ios/net", "//ios/testing:ios_test_support", "//ios/testing:ocmock_support", "//ios/web/public", "//ios/web/public/test", "//ios/web/public/test/fakes", "//ios/web/test:mojo_bindings", "//ios/web/test:test_constants", "//ios/web/test:test_support", "//net:test_support", "//services/service_manager/public/cpp", "//testing/gmock", "//testing/gtest", "//third_party/ocmock", "//ui/base:test_support", ] sources = [ "browser_state_unittest.cc", "history_state_util_unittest.mm", "service_manager_connection_impl_unittest.cc", "test/web_test_unittest.mm", "url_scheme_util_unittest.mm", "url_util_unittest.cc", ] } source_set("ios_web_navigation_unittests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true deps = [ ":core", ":web", "//base", "//base/test:test_support", "//components/url_formatter", "//ios/net", "//ios/testing:ios_test_support", "//ios/testing:ocmock_support", "//ios/web/navigation", "//ios/web/navigation:core", "//ios/web/public", "//ios/web/public/test", "//ios/web/public/test/fakes", "//ios/web/test:mojo_bindings", "//ios/web/test:test_constants", "//ios/web/test:test_support", "//ios/web/test/fakes", "//ios/web/web_state/ui:crw_web_view_navigation_proxy", "//net:test_support", "//services/service_manager/public/cpp", "//testing/gmock", "//testing/gtest", "//third_party/ocmock", "//ui/base:test_support", ] sources = [ "navigation/crw_navigation_item_holder_unittest.mm", "navigation/crw_navigation_item_storage_unittest.mm", "navigation/crw_placeholder_navigation_info_unittest.mm", "navigation/crw_session_controller_unittest.mm", "navigation/crw_session_storage_unittest.mm", "navigation/navigation_item_impl_unittest.mm", "navigation/navigation_item_storage_test_util.h", "navigation/navigation_item_storage_test_util.mm", "navigation/navigation_manager_impl_unittest.mm", "navigation/navigation_manager_util_unittest.mm", "navigation/nscoder_util_unittest.mm", "navigation/placeholder_navigation_util_unittest.mm", "navigation/serializable_user_data_manager_impl_unittest.mm", "navigation/wk_based_navigation_manager_impl_unittest.mm", ] } source_set("ios_web_net_unittests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true deps = [ ":core", ":web", "//base", "//base/test:test_support", "//components/url_formatter", "//ios/net", "//ios/net:test_support", "//ios/testing:ios_test_support", "//ios/testing:ocmock_support", "//ios/web/navigation", "//ios/web/net/cookies", "//ios/web/public", "//ios/web/public/test", "//ios/web/public/test/fakes", "//ios/web/test:mojo_bindings", "//ios/web/test:test_constants", "//ios/web/test:test_support", "//ios/web/test/fakes", "//ios/web/web_state:wk_web_view_security_util", "//net:test_support", "//services/service_manager/public/cpp", "//testing/gmock", "//testing/gtest", "//third_party/ocmock", "//ui/base:test_support", ] sources = [ "net/cert_host_pair_unittest.cc", "net/cert_policy_unittest.cc", "net/cookies/wk_cookie_util_unittest.mm", "net/cookies/wk_http_system_cookie_store_unittest.mm", "net/crw_cert_verification_controller_unittest.mm", "net/crw_ssl_status_updater_unittest.mm", "net/request_group_util_unittest.mm", "net/request_tracker_impl_unittest.mm", "net/web_http_protocol_handler_delegate_unittest.mm", ] } source_set("test_support") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true sources = [ "public/test/crw_mock_web_state_delegate.h", "public/test/crw_mock_web_state_delegate.mm", ] deps = [ "//ios/testing:ocmock_support", "//ios/web", ] } source_set("ios_web_public_unittests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true deps = [ ":core", ":test_support", ":web", "//base", "//base/test:test_support", "//components/url_formatter", "//ios/net", "//ios/net:ios_net_unittests", "//ios/testing:ios_test_support", "//ios/testing:ocmock_support", "//ios/web/public", "//ios/web/public/test", "//ios/web/public/test/fakes", "//ios/web/test:mojo_bindings", "//ios/web/test:test_constants", "//ios/web/test:test_support", "//ios/web/web_state:page_viewport_state", "//net:test_support", "//services/service_manager/public/cpp", "//testing/gmock", "//testing/gtest", "//third_party/ocmock", "//ui/base:test_support", ] sources = [ "public/crw_session_certificate_policy_cache_storage_unittest.mm", "public/origin_util_unittest.mm", "public/referrer_util_unittest.cc", "public/serializable_user_data_manager_unittest.mm", "public/ssl_status_unittest.cc", "public/user_agent_unittest.mm", "public/web_state/page_viewport_state_unittest.mm", ] } source_set("ios_web_web_state_unittests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true deps = [ ":core", ":test_support", ":web", "//base", "//base/test:test_support", "//components/url_formatter", "//ios/net", "//ios/testing:ios_test_support", "//ios/testing:ocmock_support", "//ios/web", "//ios/web/public", "//ios/web/public/test", "//ios/web/public/test/fakes", "//ios/web/test:mojo_bindings", "//ios/web/test:test_constants", "//ios/web/test:test_support", "//ios/web/web_state:context_menu", "//ios/web/web_state:crw_pass_kit_downloader", "//ios/web/web_state:session_certificate_policy_cache", "//ios/web/web_state:web_view_internal_creation_util", "//ios/web/web_state:wk_web_view_security_util", "//net:test_support", "//services/service_manager/public/cpp", "//testing/gmock", "//testing/gtest", "//third_party/ocmock", "//ui/base:test_support", "//ui/gfx:test_support", ] sources = [ "web_state/context_menu_params_utils_unittest.mm", "web_state/crw_pass_kit_downloader_unittest.mm", "web_state/error_translation_util_unittest.mm", "web_state/navigation_context_impl_unittest.mm", "web_state/page_display_state_unittest.mm", "web_state/session_certificate_policy_cache_impl_unittest.mm", "web_state/session_certificate_policy_cache_storage_builder_unittest.mm", "web_state/web_state_delegate_bridge_unittest.mm", "web_state/web_state_impl_unittest.mm", "web_state/web_state_observer_bridge_unittest.mm", "web_state/web_state_unittest.mm", "web_state/web_view_internal_creation_util_unittest.mm", "web_state/wk_web_view_security_util_unittest.mm", ] } source_set("ios_web_web_state_js_unittests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true deps = [ ":core", ":web", "//base", "//base/test:test_support", "//components/url_formatter", "//ios/net", "//ios/testing:ios_test_support", "//ios/testing:ocmock_support", "//ios/web/public", "//ios/web/public/test", "//ios/web/public/test/fakes", "//ios/web/test:mojo_bindings", "//ios/web/test:test_constants", "//ios/web/test:test_support", "//ios/web/web_state:context_menu", "//ios/web/web_state/js", "//ios/web/web_state/ui:crw_wk_script_message_router", "//net:test_support", "//services/service_manager/public/cpp", "//testing/gmock", "//testing/gtest", "//third_party/ocmock", "//ui/base:test_support", ] sources = [ "web_state/js/common_js_unittest.mm", "web_state/js/context_menu_js_unittest.mm", "web_state/js/crw_js_injection_manager_unittest.mm", "web_state/js/crw_js_post_request_loader_unittest.mm", "web_state/js/crw_js_window_id_manager_unittest.mm", "web_state/js/page_script_util_unittest.mm", ] } source_set("ios_web_web_state_ui_unittests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true deps = [ ":core", ":web", "//base", "//base/test:test_support", "//components/url_formatter", "//ios/net", "//ios/testing:ios_test_support", "//ios/testing:ocmock_support", "//ios/web/navigation", "//ios/web/navigation:core", "//ios/web/public", "//ios/web/public/test", "//ios/web/public/test/fakes", "//ios/web/test:mojo_bindings", "//ios/web/test:test_constants", "//ios/web/test:test_support", "//ios/web/test/fakes:fakes", "//ios/web/web_state:wk_web_view_security_util", "//ios/web/web_state/js", "//ios/web/web_state/ui:crw_wk_script_message_router", "//ios/web/web_state/ui:web_view_js_utils", "//net:test_support", "//services/service_manager/public/cpp", "//testing/gmock", "//testing/gtest", "//third_party/ocmock", "//ui/base:test_support", ] sources = [ "web_state/ui/crw_web_controller_container_view_unittest.mm", "web_state/ui/crw_web_controller_unittest.mm", "web_state/ui/crw_web_view_scroll_view_proxy_unittest.mm", "web_state/ui/crw_wk_navigation_states_unittest.mm", "web_state/ui/crw_wk_script_message_router_unittest.mm", "web_state/ui/web_view_js_utils_unittest.mm", "web_state/ui/wk_back_forward_list_item_holder_unittest.mm", "web_state/ui/wk_web_view_configuration_provider_unittest.mm", ] } source_set("ios_web_webui_unittests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true deps = [ ":core", ":web", "//base", "//base/test:test_support", "//components/url_formatter", "//ios/net", "//ios/testing:ios_test_support", "//ios/testing:ocmock_support", "//ios/web/public", "//ios/web/public/test", "//ios/web/public/test/fakes", "//ios/web/test:mojo_bindings", "//ios/web/test:test_constants", "//ios/web/test:test_support", "//net:test_support", "//services/service_manager/public/cpp", "//testing/gmock", "//testing/gtest", "//third_party/ocmock", "//ui/base:test_support", ] sources = [ "webui/crw_web_ui_manager_unittest.mm", "webui/crw_web_ui_page_builder_unittest.mm", "webui/mojo_facade_unittest.mm", "webui/url_fetcher_block_adapter_unittest.mm", ] } test("ios_web_inttests") { configs += [ "//build/config/compiler:enable_arc" ] deps = [ ":web", "//base/test:test_support", "//ios/testing:http_server_bundle_data", "//ios/testing:ios_test_support", "//ios/web:resources_grit", "//ios/web/download:download_inttests", "//ios/web/navigation:core", "//ios/web/public/test", "//ios/web/public/test/fakes", "//ios/web/public/test/http_server", "//ios/web/test:mojo_bindings", "//ios/web/test:packed_resources", "//ios/web/test:resources", "//ios/web/test:test_constants", "//ios/web/test:test_support", "//mojo/edk/system", "//net:test_support", "//services/service_manager/public/cpp", "//testing/gtest", "//ui/base:test_support", ] sources = [ "browser_state_web_view_partition_inttest.mm", "navigation/history_state_operations_inttest.mm", "navigation/window_location_inttest.mm", "public/test/http_server_inttest.mm", "test/run_all_unittests.cc", "web_state/favicon_callbacks_inttest.mm", "web_state/http_auth_inttest.mm", "web_state/navigation_and_load_callbacks_inttest.mm", "webui/web_ui_mojo_inttest.mm", ] assert_no_deps = ios_assert_no_deps } js_compile_bundle("web_ui_bundle") { visibility = [ ":js_resources" ] closure_entry_point = "__crWeb.webUIBundle" sources = [ "webui/resources/mojo_api.js", "webui/resources/web_ui_base.js", "webui/resources/web_ui_bind.js", "webui/resources/web_ui_bundle.js", "webui/resources/web_ui_send.js", ] } js_compile_bundle("web_bundle") { visibility = [ ":js_resources" ] closure_entry_point = "__crWeb.webBundle" sources = [ "web_state/js/resources/base.js", "web_state/js/resources/common.js", "web_state/js/resources/console.js", "web_state/js/resources/context_menu.js", "web_state/js/resources/error.js", "web_state/js/resources/form.js", "web_state/js/resources/legacy.js", "web_state/js/resources/message.js", "web_state/js/resources/navigation.js", "web_state/js/resources/scroll_workaround.js", "web_state/js/resources/web_bundle.js", ] } js_compile_bundle("nav_bundle") { visibility = [ ":js_resources" ] closure_entry_point = "__crWeb.legacynavigation" sources = [ "web_state/js/resources/legacy_navigation.js", ] } js_compile_checked("js_resources") { public_deps = [ ":nav_bundle", ":web_bundle", ":web_ui_bundle", ] sources = [ "web_state/js/resources/plugin_placeholder.js", "web_state/js/resources/post_request.js", "web_state/js/resources/window_id.js", ] } bundle_data("navigation_resources") { sources = [ "navigation/resources/restore_session.html", ] outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}", ] } grit("resources") { source = "ios_web_resources.grd" # The .grd contains references to generated files. source_is_generated = true outputs = [ "grit/ios_web_resources.h", "ios_web_resources.pak", ] grit_flags = [ "-E", "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), ] deps = [ "//ios/web/public/app:browser_manifest", "//ios/web/public/app:packaged_services_manifest", "//mojo/public/js:new_bindings", ] }