blob: ba78825fb7f6576eae2bafc9fa05b8e6c2543b19 [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("//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.
":services",
":threads",
"//ios/web/navigation:core",
"//ios/web/net",
"//ios/web/public",
"//ios/web/public/download",
"//ios/web/public/init",
"//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",
":services",
":threads",
"//base",
"//ios/web/common",
"//ios/web/download",
"//ios/web/favicon",
"//ios/web/init",
"//ios/web/navigation",
"//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/web_state",
"//ios/web/web_state:web_view_internal_creation_util",
"//services/network:network_service",
"//services/network/public/mojom",
"//services/service_manager",
"//services/service_manager/public/cpp",
"//services/service_manager/public/mojom",
]
sources = [
"browser_state.mm",
"browser_url_rewriter_impl.h",
"browser_url_rewriter_impl.mm",
"crw_navigation_item_storage.mm",
"network_context_owner.cc",
"url_scheme_util.mm",
"web_client.mm",
"web_view_creation_util.mm",
]
libs = [ "WebKit.framework" ]
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("services") {
deps = [
":service_names",
"//ios/web/public",
"//services/network:network_service",
"//services/network/public/mojom",
"//services/service_manager",
"//services/service_manager/public/cpp",
"//services/service_manager/public/mojom",
]
sources = [
"service_manager_connection_impl.cc",
"service_manager_connection_impl.h",
"service_manager_context.h",
"service_manager_context.mm",
"web_browser_manifest.h",
"web_browser_manifest.mm",
]
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") {
defines = [ "CHROME_EARL_GREY_1" ]
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
deps = [
":web",
"//base",
"//base/test:test_support",
"//ios/testing/earl_grey:earl_grey_support",
"//ios/third_party/earl_grey:earl_grey+link",
"//ios/web/public/deprecated",
"//ios/web/public/test",
"//ios/web/public/test:element_selector",
"//ios/web/security",
"//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("eg_app_support+eg2") {
defines = [ "CHROME_EARL_GREY_2" ]
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",
"//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/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_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/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_messaging:unittests",
"//ios/web/security:unittests",
"//ios/web/session:unittests",
"//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",
":threads",
":web",
"//base",
"//base/test:test_support",
"//components/url_formatter",
"//ios/net",
"//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",
"network_context_owner_unittest.cc",
"service_manager_connection_impl_unittest.cc",
"test/web_test_unittest.mm",
"url_scheme_util_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",
":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/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_session_controller_unittest.mm",
"navigation/crw_session_storage_unittest.mm",
"navigation/crw_wk_navigation_states_unittest.mm",
"navigation/error_retry_state_machine_unittest.mm",
"navigation/navigation_context_impl_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/wk_back_forward_list_item_holder_unittest.mm",
"navigation/wk_based_navigation_manager_impl_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/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",
"//services/service_manager/public/cpp",
"//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 = [
"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: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/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:ocmock_support",
"//ios/web",
"//ios/web/common",
"//ios/web/find_in_page",
"//ios/web/js_messaging",
"//ios/web/navigation",
"//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/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:context_menu",
"//ios/web/web_state:web_view_internal_creation_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/page_display_state_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_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/find_in_page",
"//ios/web/js_messaging",
"//ios/web/public",
"//ios/web/public/deprecated",
"//ios/web/public/js_messaging",
"//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",
"//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/find_in_page_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/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/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:context_menu",
"//ios/web/web_state/js",
"//ios/web/web_state/ui:crw_context_menu_controller",
"//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_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/html_element_fetch_request_unittest.mm",
"web_state/ui/web_view_js_utils_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/fakes",
"//ios/web/public/webui",
"//ios/web/test:mojo_bindings",
"//ios/web/test:test_constants",
"//ios/web/test:test_support",
"//net:test_support",
"//services/network:test_support",
"//services/service_manager/public/cpp",
"//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/testing:embedded_test_server_support",
"//ios/testing:http_server_bundle_data",
"//ios/web:resources_grit",
"//ios/web/common",
"//ios/web/download:download_inttests",
"//ios/web/favicon:inttests",
"//ios/web/js_messaging:inttests",
"//ios/web/navigation",
"//ios/web/navigation:core",
"//ios/web/navigation:wk_navigation_util",
"//ios/web/public/deprecated",
"//ios/web/public/deprecated:test_doubles",
"//ios/web/public/find_in_page",
"//ios/web/public/js_messaging",
"//ios/web/public/security",
"//ios/web/public/session",
"//ios/web/public/test",
"//ios/web/public/test:element_selector",
"//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",
"//mojo/core/embedder",
"//net:test_support",
"//services/network/public/cpp",
"//services/service_manager/public/cpp",
"//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/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/bad_ssl_response_inttest.mm",
"web_state/error_page_inttest.mm",
"web_state/http_auth_inttest.mm",
"web_state/keep_render_process_alive_inttest.mm",
"web_state/web_state_observer_inttest.mm",
"webui/web_ui_mojo_inttest.mm",
]
assert_no_deps = ios_assert_no_deps
}
js_compile_bundle("main_frame_web_bundle") {
visibility = [ ":js_resources" ]
closure_entry_point = "__crWeb.mainFrameWebBundle"
sources = [
"web_state/js/resources/error.js",
"web_state/js/resources/main_frame_context_menu.js",
"web_state/js/resources/main_frame_web_bundle.js",
"web_state/js/resources/navigation.js",
"web_state/js/resources/scroll_workaround.js",
]
}
js_compile_bundle("all_frames_web_bundle") {
visibility = [ ":js_resources" ]
closure_entry_point = "__crWeb.allFramesWebBundle"
sources = [
"js_messaging/resources/message.js",
"web_state/js/resources/all_frames_context_menu.js",
"web_state/js/resources/all_frames_web_bundle.js",
"web_state/js/resources/base.js",
"web_state/js/resources/common.js",
"web_state/js/resources/find_in_page.js",
]
}
js_compile_bundle("all_frames_document_end_web_bundle") {
visibility = [ ":js_resources" ]
closure_entry_point = "__crWeb.allFramesDocumentEndWebBundle"
sources = [
"js_messaging/resources/setup_frame.js",
"web_state/js/resources/all_frames_document_end_web_bundle.js",
"web_state/js/resources/plugin_placeholder.js",
]
}
js_compile_bundle("main_frame_document_end_web_bundle") {
visibility = [ ":js_resources" ]
closure_entry_point = "__crWeb.mainFrameDocumentEndWebBundle"
sources = [
"favicon/resources/favicon.js",
"web_state/js/resources/main_frame_document_end_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 = [
":all_frames_document_end_web_bundle",
":all_frames_web_bundle",
":main_frame_document_end_web_bundle",
":main_frame_web_bundle",
":nav_bundle",
]
sources = [
"js_messaging/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 = [
"//mojo/public/js:bindings",
]
}