blob: 9875eaeb4bbc22e26fd30699a48ef2e987124ec7 [file] [log] [blame]
# 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("//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 = [
# TODO(crbug.com/616244): Remove private files from public dependencies.
"//ios/web/public",
"//ios/web/public/download",
"//ios/web/public/init",
"//ios/web/web_state/ui",
"//ios/web/web_state/ui:wk_web_view_configuration_provider",
"//ios/web/webui",
]
deps = [
":base_js",
":common_js",
":core",
":js_resources",
":message_js",
":navigation_resources",
":plugin_placeholder_js",
":resources",
":share_workaround_js",
":threads",
"//base",
"//components/leveldb_proto",
"//ios/third_party/webkit",
"//ios/web/common",
"//ios/web/download",
"//ios/web/favicon",
"//ios/web/init",
"//ios/web/navigation",
"//ios/web/navigation:wk_navigation_util",
"//ios/web/net",
"//ios/web/public",
"//ios/web/public/security",
"//ios/web/public/session",
"//ios/web/security",
"//ios/web/session",
"//ios/web/thread",
"//ios/web/ui",
"//ios/web/web_state",
"//ios/web/web_state:web_view_internal_creation_util",
"//services/network:network_service",
]
sources = [
"browser_state.mm",
"browser_url_rewriter_impl.h",
"browser_url_rewriter_impl.mm",
"crw_navigation_item_storage.mm",
"network_context_owner.cc",
"web_client.mm",
]
configs += [ "//build/config/compiler:enable_arc" ]
}
source_set("threads") {
deps = [
"//base",
"//ios/web/public",
]
sources = [
"web_sub_thread.cc",
"web_sub_thread.h",
"web_thread_impl.cc",
"web_thread_impl.h",
]
configs += [ "//build/config/compiler:enable_arc" ]
}
source_set("core") {
configs += [ "//build/config/compiler:enable_arc" ]
deps = [
"//base",
"//url",
]
sources = [
"history_state_util.cc",
"history_state_util.h",
]
}
source_set("eg_app_support+eg2") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
deps = [
":web",
"//base",
"//base/test:test_support",
"//ios/testing/earl_grey:eg_app_support+eg2",
"//ios/third_party/earl_grey2:app_framework+link",
"//ios/web/public/deprecated",
"//ios/web/public/test",
"//ios/web/security",
"//ios/web/web_state:web_state_impl_header",
"//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:test_fixture",
"//ios/web/public/test/http_server",
"//mojo/core/embedder",
]
}
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_text_fragments_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/browsing_data:browsing_data_unittests",
"//ios/web/common:unittests",
"//ios/web/download:download_unittests",
"//ios/web/favicon:unittests",
"//ios/web/find_in_page:find_in_page_unittests",
"//ios/web/js_features/context_menu:unittests",
"//ios/web/js_features/window_error:unittests",
"//ios/web/js_messaging:unittests",
"//ios/web/public/web_view_only:unittests",
"//ios/web/security:unittests",
"//ios/web/session:unittests",
"//ios/web/test:packed_resources",
"//ios/web/web_view: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",
":test_support",
":threads",
":web",
"//base",
"//base/test:test_support",
"//components/url_formatter",
"//ios/net",
"//ios/testing:ocmock_support",
"//ios/web/navigation",
"//ios/web/navigation:core",
"//ios/web/public",
"//ios/web/public/session",
"//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",
"//testing/gmock",
"//testing/gtest",
"//third_party/ocmock",
"//ui/base:test_support",
]
sources = [
"browser_state_unittest.mm",
"crw_navigation_item_storage_unittest.mm",
"history_state_util_unittest.mm",
"network_context_owner_unittest.cc",
"test/web_test_unittest.mm",
"web_client_unittest.mm",
"web_thread_unittest.cc",
]
}
source_set("ios_web_navigation_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:ocmock_support",
"//ios/web/common",
"//ios/web/navigation",
"//ios/web/navigation:block_universal_links_buildflags",
"//ios/web/navigation:core",
"//ios/web/navigation:navigation_manager_util",
"//ios/web/navigation:wk_navigation_util",
"//ios/web/public",
"//ios/web/public/session",
"//ios/web/public/session",
"//ios/web/public/test",
"//ios/web/public/test:test_fixture",
"//ios/web/public/test/fakes",
"//ios/web/session",
"//ios/web/test:mojo_bindings",
"//ios/web/test:test_constants",
"//ios/web/test:test_support",
"//ios/web/test/fakes",
"//ios/web/web_state:web_state_impl_header",
"//ios/web/web_state/ui:crw_web_view_navigation_proxy",
"//ios/web/web_state/ui:web_view_handler",
"//net:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/ocmock",
"//ui/base:test_support",
]
sources = [
"navigation/crw_error_page_helper_unittest.mm",
"navigation/crw_navigation_item_holder_unittest.mm",
"navigation/crw_session_storage_unittest.mm",
"navigation/crw_wk_navigation_states_unittest.mm",
"navigation/navigation_context_impl_unittest.mm",
"navigation/navigation_item_impl_unittest.mm",
"navigation/navigation_item_storage_builder_unittest.mm",
"navigation/navigation_manager_impl_unittest.mm",
"navigation/navigation_manager_util_unittest.mm",
"navigation/nscoder_util_unittest.mm",
"navigation/session_storage_builder_unittest.mm",
"navigation/synthesized_session_restore_unittest.mm",
"navigation/wk_back_forward_list_item_holder_unittest.mm",
"navigation/wk_navigation_action_policy_util_unittest.mm",
"navigation/wk_navigation_action_util_unittest.mm",
"navigation/wk_navigation_util_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:ocmock_support",
"//ios/web/common",
"//ios/web/navigation",
"//ios/web/net/cookies",
"//ios/web/public",
"//ios/web/public/security",
"//ios/web/public/test",
"//ios/web/public/test:test_fixture",
"//ios/web/public/test/fakes",
"//ios/web/security",
"//ios/web/test:mojo_bindings",
"//ios/web/test:test_constants",
"//ios/web/test:test_support",
"//ios/web/test/fakes",
"//net:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/ocmock",
"//ui/base:test_support",
]
sources = [
"net/cookies/crw_wk_http_cookie_store_unittest.mm",
"net/cookies/wk_cookie_util_unittest.mm",
"net/cookies/wk_http_system_cookie_store_unittest.mm",
]
}
source_set("test_support") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"navigation/navigation_item_storage_test_util.h",
"navigation/navigation_item_storage_test_util.mm",
"public/test/crw_fake_web_state_delegate.h",
"public/test/crw_fake_web_state_delegate.mm",
]
deps = [
"//ios/web",
"//ios/web/public/session",
]
}
source_set("ios_web_text_fragments_unittests") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
deps = [
"//base",
"//base/test:test_support",
"//components/shared_highlighting/core/common",
"//components/ukm:test_support",
"//ios/web/common:features",
"//ios/web/navigation:core",
"//ios/web/public/navigation:referrer",
"//ios/web/public/test",
"//ios/web/public/test:test_fixture",
"//ios/web/public/test/fakes",
"//ios/web/text_fragments",
"//ios/web/web_state:web_state_impl_header",
"//ios/web/web_state/ui:web_view_handler",
"//services/metrics/public/cpp:ukm_builders",
"//testing/gmock",
"//testing/gtest",
"//third_party/ocmock",
"//url",
]
sources = [ "text_fragments/text_fragments_manager_impl_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:ocmock_support",
"//ios/web",
"//ios/web/common",
"//ios/web/common:uikit",
"//ios/web/common:web_view_creation_util",
"//ios/web/find_in_page",
"//ios/web/js_features/context_menu",
"//ios/web/js_messaging",
"//ios/web/navigation",
"//ios/web/navigation:core",
"//ios/web/navigation:wk_navigation_util",
"//ios/web/public",
"//ios/web/public/deprecated",
"//ios/web/public/js_messaging",
"//ios/web/public/security",
"//ios/web/public/session",
"//ios/web/public/test",
"//ios/web/public/test:test_fixture",
"//ios/web/public/test/fakes",
"//ios/web/security",
"//ios/web/security",
"//ios/web/session",
"//ios/web/test:mojo_bindings",
"//ios/web/test:test_constants",
"//ios/web/test:test_support",
"//ios/web/test/fakes",
"//ios/web/web_state",
"//ios/web/web_state:page_viewport_state",
"//ios/web/web_state:policy_decision_state_tracker",
"//ios/web/web_state:test_util",
"//ios/web/web_state:web_state_impl_header",
"//ios/web/web_state:web_view_internal_creation_util",
"//ios/web/web_state/ui:web_controller_header",
"//net:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/ocmock",
"//ui/base:test_support",
"//ui/gfx:test_support",
]
sources = [
"web_state/page_display_state_unittest.mm",
"web_state/page_viewport_state_unittest.mm",
"web_state/policy_decision_state_tracker_unittest.mm",
"web_state/web_state_context_menu_bridge_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_policy_decider_bridge_unittest.mm",
"web_state/web_state_policy_decider_unittest.mm",
"web_state/web_state_unittest.mm",
"web_state/web_view_internal_creation_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:ocmock_support",
"//ios/web/common:web_view_creation_util",
"//ios/web/js_features/context_menu",
"//ios/web/js_messaging",
"//ios/web/public",
"//ios/web/public/js_messaging",
"//ios/web/public/test",
"//ios/web/public/test:test_fixture",
"//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/js",
"//net:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/ocmock",
"//ui/base:test_support",
]
sources = [
"web_state/js/common_js_unittest.mm",
"web_state/js/message_js_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:ocmock_support",
"//ios/web/common",
"//ios/web/common:uikit",
"//ios/web/js_features/context_menu",
"//ios/web/js_messaging",
"//ios/web/navigation",
"//ios/web/navigation:block_universal_links_buildflags",
"//ios/web/navigation:core",
"//ios/web/public",
"//ios/web/public/deprecated",
"//ios/web/public/deprecated:test_doubles",
"//ios/web/public/js_messaging",
"//ios/web/public/session",
"//ios/web/public/test",
"//ios/web/security",
"//ios/web/test:mojo_bindings",
"//ios/web/test:test_constants",
"//ios/web/test:test_support",
"//ios/web/test/fakes:fakes",
"//ios/web/web_state:web_state_impl_header",
"//ios/web/web_state/js",
"//ios/web/web_state/ui",
"//ios/web/web_state/ui:crw_context_menu_controller",
"//net:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/ocmock",
"//ui/base:test_support",
]
sources = [
"web_state/ui/crw_html_element_fetch_request_unittest.mm",
"web_state/ui/crw_web_controller_unittest.mm",
"web_state/ui/crw_web_view_content_view_unittest.mm",
"web_state/ui/crw_web_view_proxy_impl_unittest.mm",
"web_state/ui/crw_web_view_scroll_view_proxy_unittest.mm",
"web_state/ui/wk_content_rule_list_util_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:ocmock_support",
"//ios/web/public/test",
"//ios/web/public/test:test_fixture",
"//ios/web/public/test/fakes",
"//ios/web/public/webui",
"//ios/web/test:mojo_bindings",
"//ios/web/test:test_constants",
"//ios/web/test:test_support",
"//ios/web/web_state:web_state_impl_header",
"//ios/web/webui",
"//net:test_support",
"//services/network:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/ocmock",
"//ui/base:test_support",
]
sources = [
"webui/crw_web_ui_scheme_handler_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/net",
"//ios/testing:block_swizzler",
"//ios/testing:embedded_test_server_support",
"//ios/testing:http_server_bundle_data",
"//ios/web:resources_grit",
"//ios/web/common",
"//ios/web/common:uikit",
"//ios/web/common:web_view_creation_util",
"//ios/web/download:download_inttests",
"//ios/web/favicon:inttests",
"//ios/web/find_in_page",
"//ios/web/js_features/context_menu",
"//ios/web/js_messaging:inttests",
"//ios/web/js_messaging:java_script_feature",
"//ios/web/js_messaging:java_script_feature_util",
"//ios/web/navigation",
"//ios/web/navigation:core",
"//ios/web/navigation:wk_navigation_util",
"//ios/web/public/find_in_page",
"//ios/web/public/js_messaging",
"//ios/web/public/permissions",
"//ios/web/public/security",
"//ios/web/public/session",
"//ios/web/public/test",
"//ios/web/public/test:element_selector",
"//ios/web/public/test:test_fixture",
"//ios/web/public/test/http_server",
"//ios/web/public/webui",
"//ios/web/test:mojo_bindings",
"//ios/web/test:packed_resources",
"//ios/web/test:resources",
"//ios/web/test:test_constants",
"//ios/web/test:test_support",
"//ios/web/web_state",
"//ios/web/web_state:test_util",
"//ios/web/web_state:web_state_impl_header",
"//ios/web/web_state/ui",
"//ios/web/web_state/ui:crw_context_menu_controller",
"//ios/web/web_state/ui:web_controller_header",
"//mojo/core/embedder",
"//net:test_support",
"//services/network/public/cpp",
"//services/network/public/cpp",
"//services/network/public/mojom",
"//testing/gtest",
"//ui/base:test_support",
"//ui/resources",
]
sources = [
"browser_state_web_view_partition_inttest.mm",
"find_in_page/find_in_page_manager_inttest.mm",
"navigation/crw_error_page_helper_inttest.mm",
"navigation/crw_wk_navigation_handler_inttest.mm",
"navigation/history_state_operations_inttest.mm",
"navigation/meta_tag_inttest.mm",
"navigation/window_location_inttest.mm",
"plugin_placeholder_inttest.mm",
"public/test/http_server_inttest.mm",
"test/run_all_unittests.cc",
"url_loader_inttest.mm",
"web_state/error_page_inttest.mm",
"web_state/http_auth_inttest.mm",
"web_state/keep_render_process_alive_inttest.mm",
"web_state/permissions_inttest.mm",
"web_state/ui/crw_context_menu_element_fetcher_inttest.mm",
"web_state/web_state_observer_inttest.mm",
"webui/web_ui_inttest.mm",
"webui/web_ui_mojo_inttest.mm",
]
assert_no_deps = ios_assert_no_deps
}
js_compile_bundle("plugin_placeholder_js") {
visibility = [ ":web" ]
closure_entry_point = "__crWeb.pluginPlaceholder"
sources = [ "web_state/js/resources/plugin_placeholder.js" ]
}
js_compile_bundle("share_workaround_js") {
visibility = [ ":web" ]
closure_entry_point = "__crWeb.shareWorkaround"
sources = [ "web_state/js/resources/share_workaround.js" ]
}
js_compile_bundle("base_js") {
visibility = [ ":web" ]
closure_entry_point = "__crWeb.base"
sources = [ "web_state/js/resources/base.js" ]
}
js_compile_bundle("common_js") {
visibility = [ ":web" ]
closure_entry_point = "__crWeb.common"
sources = [ "web_state/js/resources/common.js" ]
}
js_compile_bundle("message_js") {
visibility = [ ":web" ]
closure_entry_point = "__crWeb.message"
sources = [ "js_messaging/resources/message.js" ]
}
js_compile_checked("js_resources") {
js_modules = [
"//ios/web/web_state/js/resources/base.js",
"//ios/web/web_state/js/resources/common.js",
"//ios/web/js_messaging/resources/message.js",
]
sources = [ "js_messaging/resources/window_id.js" ]
}
bundle_data("navigation_resources") {
sources = [
"navigation/resources/error_page_injected.html",
"navigation/resources/error_page_loaded.html",
"navigation/resources/error_page_reloaded.html",
"navigation/resources/restore_session.html",
]
outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
}
grit("resources") {
source = "ios_web_resources.grd"
# Required due to flattenhtml="true" on a generated file.
enable_input_discovery_for_gn_analyze = false
outputs = [
"grit/ios_web_resources.h",
"ios_web_resources.pak",
]
deps = [ "//mojo/public/js:bindings" ]
}