mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-12-01 01:36:09 +03:00
955 lines
27 KiB
Plaintext
955 lines
27 KiB
Plaintext
# 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("//build/config/chrome_build.gni")
|
|
import("//build/util/process_version.gni")
|
|
import("//headless/headless.gni")
|
|
import("//mojo/public/tools/bindings/mojom.gni")
|
|
import("//printing/features/features.gni")
|
|
import("//services/service_manager/public/service_manifest.gni")
|
|
import("//testing/test.gni")
|
|
import("//third_party/closure_compiler/compile_js.gni")
|
|
import("//tools/grit/grit_rule.gni")
|
|
import("//tools/grit/repack.gni")
|
|
|
|
config("headless_implementation") {
|
|
defines = [ "HEADLESS_IMPLEMENTATION" ]
|
|
|
|
if (headless_use_embedded_resources) {
|
|
defines += [ "HEADLESS_USE_EMBEDDED_RESOURCES" ]
|
|
}
|
|
}
|
|
|
|
group("headless_lib") {
|
|
deps = [
|
|
":headless",
|
|
]
|
|
}
|
|
|
|
repack("pak") {
|
|
sources = [
|
|
"$root_gen_dir/blink/public/resources/blink_resources.pak",
|
|
"$root_gen_dir/blink/public/resources/blink_scaled_resources_100_percent.pak",
|
|
"$root_gen_dir/components/components_resources.pak",
|
|
"$root_gen_dir/components/strings/components_strings_en-US.pak",
|
|
"$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
|
|
"$root_gen_dir/content/app/strings/content_strings_en-US.pak",
|
|
"$root_gen_dir/content/browser/devtools/devtools_resources.pak",
|
|
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
|
|
"$root_gen_dir/content/content_resources.pak",
|
|
"$root_gen_dir/headless/headless_lib_resources.pak",
|
|
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
|
|
"$root_gen_dir/net/net_resources.pak",
|
|
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
|
|
"$root_gen_dir/ui/resources/webui_resources.pak",
|
|
"$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
|
|
"$root_gen_dir/ui/strings/ui_strings_en-US.pak",
|
|
]
|
|
|
|
if (is_chrome_branded) {
|
|
sources += [ "${root_gen_dir}/components/strings/components_google_chrome_strings_en-US.pak" ]
|
|
} else {
|
|
sources += [ "${root_gen_dir}/components/strings/components_chromium_strings_en-US.pak" ]
|
|
}
|
|
|
|
deps = [
|
|
":resources",
|
|
"//components/resources:components_resources",
|
|
"//components/strings",
|
|
"//content:resources",
|
|
"//content/app/resources",
|
|
"//content/app/strings",
|
|
"//content/browser/devtools:resources",
|
|
"//content/browser/tracing:resources",
|
|
"//mojo/public/js:resources",
|
|
"//net:net_resources",
|
|
"//third_party/WebKit/public:resources",
|
|
"//third_party/WebKit/public:scaled_resources_100_percent",
|
|
"//ui/resources",
|
|
"//ui/strings",
|
|
]
|
|
|
|
output = "$root_out_dir/headless_lib.pak"
|
|
}
|
|
|
|
action("embed_resources") {
|
|
# TODO(altimin): Consider zipping file here, it can reduce size up to 80%.
|
|
script = "lib/embed_data.py"
|
|
|
|
inputs = [
|
|
"$root_out_dir/headless_lib.pak",
|
|
]
|
|
|
|
outputs = [
|
|
"$root_gen_dir/headless/embedded_resource_pak.cc",
|
|
"$root_gen_dir/headless/embedded_resource_pak.h",
|
|
]
|
|
|
|
args = [
|
|
"--data_file",
|
|
rebase_path("$root_out_dir/headless_lib.pak", root_build_dir),
|
|
"--gendir",
|
|
rebase_path("$root_gen_dir", root_build_dir),
|
|
"--header_file",
|
|
"headless/embedded_resource_pak.h",
|
|
"--source_file",
|
|
"headless/embedded_resource_pak.cc",
|
|
"--namespace",
|
|
"headless",
|
|
"--variable_name",
|
|
"kHeadlessResourcePak",
|
|
]
|
|
|
|
deps = [
|
|
":pak",
|
|
]
|
|
}
|
|
|
|
mojom("tab_socket") {
|
|
sources = [
|
|
"lib/tab_socket.mojom",
|
|
]
|
|
}
|
|
|
|
mojom("headless_render_frame_controller") {
|
|
sources = [
|
|
"lib/headless_render_frame_controller.mojom",
|
|
]
|
|
}
|
|
|
|
service_manifest("headless_browser_manifest_overlay") {
|
|
source = "lib/browser/headless_browser_manifest_overlay.json"
|
|
}
|
|
|
|
service_manifest("headless_packaged_services_manifest_overlay") {
|
|
source = "lib/browser/headless_packaged_services_manifest_overlay.json"
|
|
packaged_services =
|
|
[ "//components/printing/service:pdf_compositor_manifest" ]
|
|
}
|
|
|
|
grit("resources") {
|
|
source = "lib/resources/headless_lib_resources.grd"
|
|
outputs = [
|
|
"grit/headless_lib_resources.h",
|
|
"$root_gen_dir/headless/headless_lib_resources.pak",
|
|
]
|
|
source_is_generated = true
|
|
grit_flags = [
|
|
"-E",
|
|
"mojom_root=" + rebase_path(root_gen_dir, root_build_dir),
|
|
]
|
|
deps = [
|
|
":headless_browser_manifest_overlay",
|
|
":headless_packaged_services_manifest_overlay",
|
|
":headless_render_frame_controller_js",
|
|
":tab_socket_js",
|
|
]
|
|
}
|
|
|
|
devtools_domains = [
|
|
"accessibility",
|
|
"animation",
|
|
"application_cache",
|
|
"browser",
|
|
"cache_storage",
|
|
"console",
|
|
"css",
|
|
"database",
|
|
"debugger",
|
|
"device_orientation",
|
|
"dom",
|
|
"dom_debugger",
|
|
"dom_snapshot",
|
|
"dom_storage",
|
|
"emulation",
|
|
"headless_experimental",
|
|
"heap_profiler",
|
|
"indexeddb",
|
|
"input",
|
|
"inspector",
|
|
"io",
|
|
"layer_tree",
|
|
"log",
|
|
"memory",
|
|
"network",
|
|
"page",
|
|
"performance",
|
|
"profiler",
|
|
"runtime",
|
|
"security",
|
|
"service_worker",
|
|
"target",
|
|
"tracing",
|
|
]
|
|
|
|
generated_devtools_api = []
|
|
generated_devtools_api_js = []
|
|
generated_devtools_api_js_externs = []
|
|
foreach(domain, devtools_domains) {
|
|
generated_devtools_api_js +=
|
|
[ "$target_gen_dir/public/devtools_js/" + domain + ".js" ]
|
|
generated_devtools_api_js_externs +=
|
|
[ "$target_gen_dir/public/devtools_js/externs/externs_" + domain + ".js" ]
|
|
generated_devtools_api += [
|
|
"$target_gen_dir/public/devtools/domains/" + domain + ".cc",
|
|
"$target_gen_dir/public/devtools/domains/" + domain + ".h",
|
|
"$target_gen_dir/public/devtools/domains/types_" + domain + ".h",
|
|
"$target_gen_dir/public/devtools/domains/types_" + domain + ".cc",
|
|
"$target_gen_dir/public/devtools/internal/type_conversions_" + domain +
|
|
".h",
|
|
"$target_gen_dir/public/devtools/internal/" +
|
|
"types_forward_declarations_" + domain + ".h",
|
|
]
|
|
}
|
|
|
|
action("gen_devtools_client_api") {
|
|
script = "lib/browser/devtools_api/client_api_generator.py"
|
|
deps = [
|
|
"//third_party/WebKit/Source/core/inspector:protocol_version",
|
|
]
|
|
inputs = [
|
|
"$root_gen_dir/blink/core/inspector/protocol.json",
|
|
]
|
|
|
|
outputs = generated_devtools_api + generated_devtools_api_js +
|
|
generated_devtools_api_js_externs
|
|
|
|
sources = [
|
|
"lib/browser/devtools_api/domain_cc.template",
|
|
"lib/browser/devtools_api/domain_externs_js.template",
|
|
"lib/browser/devtools_api/domain_h.template",
|
|
"lib/browser/devtools_api/domain_js.template",
|
|
"lib/browser/devtools_api/domain_type_conversions_h.template",
|
|
"lib/browser/devtools_api/domain_types_cc.template",
|
|
"lib/browser/devtools_api/domain_types_forward_declarations_h.template",
|
|
"lib/browser/devtools_api/domain_types_h.template",
|
|
]
|
|
|
|
args = [
|
|
"--protocol",
|
|
rebase_path(inputs[0], root_build_dir),
|
|
"--output_dir",
|
|
rebase_path(target_gen_dir, root_build_dir) + "/public",
|
|
]
|
|
}
|
|
|
|
js_library("js_devtools_bindings_lib") {
|
|
sources = [ "lib/browser/devtools_api/devtools_connection.js" ] +
|
|
generated_devtools_api_js
|
|
deps = []
|
|
extra_deps = [ ":gen_devtools_client_api" ]
|
|
}
|
|
|
|
if (headless_fontconfig_utils && !is_fuchsia) {
|
|
static_library("headless_fontconfig_utils") {
|
|
sources = [
|
|
"public/util/fontconfig.cc",
|
|
"public/util/fontconfig.h",
|
|
]
|
|
|
|
deps = [
|
|
"//build/config/freetype",
|
|
"//third_party/fontconfig",
|
|
]
|
|
|
|
configs += [ ":headless_implementation" ]
|
|
}
|
|
}
|
|
|
|
component("headless") {
|
|
sources = [
|
|
"app/headless_shell_switches.cc",
|
|
"app/headless_shell_switches.h",
|
|
"lib/browser/headless_browser_context_impl.cc",
|
|
"lib/browser/headless_browser_context_impl.h",
|
|
"lib/browser/headless_browser_context_options.cc",
|
|
"lib/browser/headless_browser_context_options.h",
|
|
"lib/browser/headless_browser_impl.cc",
|
|
"lib/browser/headless_browser_impl.h",
|
|
"lib/browser/headless_browser_impl_mac.mm",
|
|
"lib/browser/headless_browser_main_parts.cc",
|
|
"lib/browser/headless_browser_main_parts.h",
|
|
"lib/browser/headless_browser_main_parts_mac.mm",
|
|
"lib/browser/headless_devtools.cc",
|
|
"lib/browser/headless_devtools.h",
|
|
"lib/browser/headless_devtools_client_impl.cc",
|
|
"lib/browser/headless_devtools_manager_delegate.cc",
|
|
"lib/browser/headless_devtools_manager_delegate.h",
|
|
"lib/browser/headless_net_log.cc",
|
|
"lib/browser/headless_net_log.h",
|
|
"lib/browser/headless_network_conditions.cc",
|
|
"lib/browser/headless_network_conditions.h",
|
|
"lib/browser/headless_network_delegate.cc",
|
|
"lib/browser/headless_network_delegate.h",
|
|
"lib/browser/headless_permission_manager.cc",
|
|
"lib/browser/headless_permission_manager.h",
|
|
"lib/browser/headless_platform_event_source.cc",
|
|
"lib/browser/headless_platform_event_source.h",
|
|
"lib/browser/headless_quota_permission_context.cc",
|
|
"lib/browser/headless_quota_permission_context.h",
|
|
"lib/browser/headless_resource_dispatcher_host_delegate.cc",
|
|
"lib/browser/headless_resource_dispatcher_host_delegate.h",
|
|
"lib/browser/headless_shell_application_mac.h",
|
|
"lib/browser/headless_shell_application_mac.mm",
|
|
"lib/browser/headless_tab_socket_impl.cc",
|
|
"lib/browser/headless_tab_socket_impl.h",
|
|
"lib/browser/headless_url_request_context_getter.cc",
|
|
"lib/browser/headless_url_request_context_getter.h",
|
|
"lib/browser/headless_window_tree_host.h",
|
|
"lib/headless_content_client.cc",
|
|
"lib/headless_content_client.h",
|
|
"public/headless_browser.cc",
|
|
"public/headless_browser.h",
|
|
"public/headless_browser_context.h",
|
|
"public/headless_devtools_client.h",
|
|
"public/headless_devtools_target.h",
|
|
"public/headless_export.h",
|
|
"public/headless_web_contents.h",
|
|
"public/internal/headless_devtools_client_impl.h",
|
|
"public/internal/message_dispatcher.h",
|
|
"public/internal/value_conversions.h",
|
|
"public/util/black_hole_protocol_handler.cc",
|
|
"public/util/black_hole_protocol_handler.h",
|
|
"public/util/compositor_controller.cc",
|
|
"public/util/compositor_controller.h",
|
|
"public/util/deterministic_dispatcher.cc",
|
|
"public/util/deterministic_dispatcher.h",
|
|
"public/util/deterministic_http_protocol_handler.cc",
|
|
"public/util/deterministic_http_protocol_handler.h",
|
|
"public/util/error_reporter.cc",
|
|
"public/util/error_reporter.h",
|
|
"public/util/expedited_dispatcher.cc",
|
|
"public/util/expedited_dispatcher.h",
|
|
"public/util/generic_url_request_job.cc",
|
|
"public/util/generic_url_request_job.h",
|
|
"public/util/http_url_fetcher.cc",
|
|
"public/util/http_url_fetcher.h",
|
|
"public/util/in_memory_protocol_handler.cc",
|
|
"public/util/in_memory_protocol_handler.h",
|
|
"public/util/in_memory_request_job.cc",
|
|
"public/util/in_memory_request_job.h",
|
|
"public/util/managed_dispatch_url_request_job.cc",
|
|
"public/util/managed_dispatch_url_request_job.h",
|
|
"public/util/navigation_request.h",
|
|
"public/util/throttled_dispatcher.cc",
|
|
"public/util/throttled_dispatcher.h",
|
|
"public/util/url_fetcher.cc",
|
|
"public/util/url_fetcher.h",
|
|
"public/util/url_request_dispatcher.h",
|
|
"public/util/user_agent.cc",
|
|
"public/util/user_agent.h",
|
|
"public/util/virtual_time_controller.cc",
|
|
"public/util/virtual_time_controller.h",
|
|
]
|
|
|
|
if (!is_fuchsia) {
|
|
sources += [
|
|
"lib/headless_crash_reporter_client.cc",
|
|
"lib/headless_crash_reporter_client.h",
|
|
]
|
|
}
|
|
|
|
sources += generated_devtools_api
|
|
|
|
if (use_aura) {
|
|
sources += [
|
|
"lib/browser/headless_browser_impl_aura.cc",
|
|
"lib/browser/headless_clipboard.cc",
|
|
"lib/browser/headless_clipboard.h",
|
|
"lib/browser/headless_focus_client.cc",
|
|
"lib/browser/headless_focus_client.h",
|
|
"lib/browser/headless_screen.cc",
|
|
"lib/browser/headless_screen.h",
|
|
"lib/browser/headless_window_parenting_client.cc",
|
|
"lib/browser/headless_window_parenting_client.h",
|
|
"lib/browser/headless_window_tree_host.cc",
|
|
]
|
|
}
|
|
|
|
if (enable_basic_printing) {
|
|
sources += [
|
|
"lib/browser/headless_print_manager.cc",
|
|
"lib/browser/headless_print_manager.h",
|
|
"lib/renderer/headless_print_render_frame_helper_delegate.cc",
|
|
"lib/renderer/headless_print_render_frame_helper_delegate.h",
|
|
]
|
|
}
|
|
|
|
public_deps = [
|
|
"//base",
|
|
"//net",
|
|
]
|
|
|
|
if (enable_basic_printing) {
|
|
public_deps += [ "//skia" ]
|
|
}
|
|
|
|
deps = [
|
|
":gen_devtools_client_api",
|
|
":headless_render_frame_controller",
|
|
":tab_socket",
|
|
":version_header",
|
|
"//components/cookie_config",
|
|
"//components/security_state/core",
|
|
"//content/public/common",
|
|
"//content/public/common:service_names",
|
|
"//services/service_manager/public/cpp",
|
|
"//ui/base",
|
|
"//ui/compositor",
|
|
"//ui/display",
|
|
"//ui/events/devices",
|
|
"//url",
|
|
]
|
|
|
|
if (is_linux && !is_chromeos) {
|
|
deps += [ "//components/os_crypt" ]
|
|
}
|
|
|
|
if (is_component_build) {
|
|
sources += [
|
|
"lib/browser/headless_content_browser_client.cc",
|
|
"lib/browser/headless_content_browser_client.h",
|
|
"lib/browser/headless_web_contents_impl.cc",
|
|
"lib/browser/headless_web_contents_impl.h",
|
|
"lib/headless_content_main_delegate.cc",
|
|
"lib/headless_content_main_delegate.h",
|
|
"lib/renderer/headless_content_renderer_client.cc",
|
|
"lib/renderer/headless_content_renderer_client.h",
|
|
"lib/renderer/headless_render_frame_controller_impl.cc",
|
|
"lib/renderer/headless_render_frame_controller_impl.h",
|
|
"lib/renderer/headless_tab_socket_bindings.cc",
|
|
"lib/renderer/headless_tab_socket_bindings.h",
|
|
"lib/utility/headless_content_utility_client.cc",
|
|
"lib/utility/headless_content_utility_client.h",
|
|
]
|
|
|
|
deps += [
|
|
"//components/crash/core/common:crash_key",
|
|
"//components/security_state/content",
|
|
"//gin",
|
|
"//third_party/WebKit/public:blink",
|
|
"//third_party/WebKit/public:blink_headers",
|
|
"//v8",
|
|
]
|
|
|
|
if (!is_fuchsia) {
|
|
deps += [ "//components/crash/content/browser" ]
|
|
}
|
|
if (is_win) {
|
|
deps += [ "//components/crash/content/app:crash_export_thunks" ]
|
|
}
|
|
|
|
if (enable_basic_printing) {
|
|
deps += [
|
|
"//components/printing/browser",
|
|
"//components/printing/renderer",
|
|
"//components/printing/service/public/cpp:factory",
|
|
"//components/printing/service/public/interfaces",
|
|
]
|
|
}
|
|
}
|
|
|
|
if (is_mac) {
|
|
deps += [ ":mac_helpers" ]
|
|
} else {
|
|
deps += [ "//ui/aura" ]
|
|
}
|
|
|
|
if (headless_use_embedded_resources) {
|
|
deps += [ ":embed_resources" ]
|
|
sources += [
|
|
"$root_gen_dir/headless/embedded_resource_pak.cc",
|
|
"$root_gen_dir/headless/embedded_resource_pak.h",
|
|
]
|
|
} else {
|
|
deps += [ ":pak" ]
|
|
}
|
|
|
|
if (use_ozone) {
|
|
deps += [ "//ui/ozone" ]
|
|
}
|
|
|
|
if (headless_fontconfig_utils && !is_fuchsia) {
|
|
deps += [ ":headless_fontconfig_utils" ]
|
|
}
|
|
|
|
configs += [ ":headless_implementation" ]
|
|
}
|
|
|
|
# Headless renderer is a convenience library for non component builds that
|
|
# includes headless classes that depend on the renderer.
|
|
if (!is_component_build) {
|
|
static_library("headless_renderer") {
|
|
sources = [
|
|
"lib/browser/headless_web_contents_impl.cc",
|
|
"lib/browser/headless_web_contents_impl.h",
|
|
"lib/headless_content_main_delegate.cc",
|
|
"lib/headless_content_main_delegate.h",
|
|
"lib/renderer/headless_content_renderer_client.cc",
|
|
"lib/renderer/headless_content_renderer_client.h",
|
|
"lib/renderer/headless_render_frame_controller_impl.cc",
|
|
"lib/renderer/headless_render_frame_controller_impl.h",
|
|
"lib/renderer/headless_tab_socket_bindings.cc",
|
|
"lib/renderer/headless_tab_socket_bindings.h",
|
|
]
|
|
|
|
deps = [
|
|
":headless",
|
|
"//components/crash/core/common:crash_key",
|
|
"//third_party/WebKit/public:blink_headers",
|
|
"//ui/base",
|
|
"//v8",
|
|
]
|
|
if (enable_basic_printing) {
|
|
deps += [ "//components/printing/renderer" ]
|
|
}
|
|
|
|
configs += [ ":headless_implementation" ]
|
|
}
|
|
} else {
|
|
# For component builds all dependencies are already included in the headless
|
|
# component.
|
|
group("headless_renderer") {
|
|
deps = [
|
|
":headless",
|
|
]
|
|
}
|
|
}
|
|
|
|
static_library("headless_test_support") {
|
|
testonly = true
|
|
|
|
sources = [
|
|
"public/util/testing/fake_managed_dispatch_url_request_job.cc",
|
|
"public/util/testing/fake_managed_dispatch_url_request_job.h",
|
|
"public/util/testing/generic_url_request_mocks.cc",
|
|
"public/util/testing/generic_url_request_mocks.h",
|
|
"public/util/testing/mock_devtools_agent_host.cc",
|
|
"public/util/testing/mock_devtools_agent_host.h",
|
|
]
|
|
|
|
public_deps = [
|
|
":headless_renderer",
|
|
"//base",
|
|
"//net",
|
|
]
|
|
|
|
deps = [
|
|
"//testing/gmock",
|
|
]
|
|
}
|
|
|
|
group("headless_tests") {
|
|
testonly = true
|
|
|
|
deps = [
|
|
":headless_browsertests",
|
|
":headless_example",
|
|
":headless_unittests",
|
|
]
|
|
}
|
|
|
|
test("headless_unittests") {
|
|
sources = [
|
|
"public/domains/types_unittest.cc",
|
|
"public/util/compositor_controller_unittest.cc",
|
|
"public/util/deterministic_dispatcher_test.cc",
|
|
"public/util/error_reporter_unittest.cc",
|
|
"public/util/expedited_dispatcher_test.cc",
|
|
"public/util/generic_url_request_job_test.cc",
|
|
"public/util/testing/generic_url_request_mocks.cc",
|
|
"public/util/testing/generic_url_request_mocks.h",
|
|
"public/util/testing/test_in_memory_protocol_handler.cc",
|
|
"public/util/testing/test_in_memory_protocol_handler.h",
|
|
"public/util/throttled_dispatcher_test.cc",
|
|
"public/util/virtual_time_controller_test.cc",
|
|
]
|
|
|
|
if (!is_component_build) {
|
|
sources += [
|
|
"lib/browser/headless_content_browser_client.cc",
|
|
"lib/browser/headless_content_browser_client.h",
|
|
"lib/utility/headless_content_utility_client.cc",
|
|
"lib/utility/headless_content_utility_client.h",
|
|
]
|
|
}
|
|
|
|
deps = [
|
|
":headless_test_support",
|
|
"//base/test:run_all_unittests",
|
|
"//base/test:test_support",
|
|
"//components/security_state/content",
|
|
"//content/public/app:both",
|
|
"//content/public/child:child",
|
|
"//content/public/common",
|
|
"//testing/gmock",
|
|
"//testing/gtest",
|
|
]
|
|
|
|
if (!is_fuchsia) {
|
|
deps += [ "//components/crash/content/browser" ]
|
|
}
|
|
|
|
if (is_win) {
|
|
deps += [ "//components/crash/content/app:crash_export_thunks" ]
|
|
}
|
|
|
|
if (enable_basic_printing) {
|
|
sources += [ "lib/browser/headless_printing_unittest.cc" ]
|
|
deps += [
|
|
"//components/printing/browser",
|
|
"//components/printing/service/public/cpp:factory",
|
|
"//third_party/WebKit/public:blink",
|
|
]
|
|
}
|
|
}
|
|
|
|
if (is_mac) {
|
|
copy("mac_helpers") {
|
|
sources = [
|
|
"$root_out_dir/crashpad_handler",
|
|
]
|
|
|
|
if (is_component_build) {
|
|
sources += [ "$root_out_dir/libbase.dylib" ]
|
|
}
|
|
|
|
deps = [
|
|
"//base",
|
|
"//third_party/crashpad/crashpad/handler:crashpad_handler",
|
|
]
|
|
|
|
outputs = [
|
|
"$root_out_dir/Helpers/{{source_file_part}}",
|
|
]
|
|
}
|
|
}
|
|
|
|
# The js_binary rule doesn't currently work on windows. Apparently there are
|
|
# problems on mac too where java isn't necessarily installed.
|
|
if (is_linux) {
|
|
js_binary("js_devtools_bindings_test") {
|
|
sources = [
|
|
"test/bindings_test.js",
|
|
]
|
|
deps = [
|
|
":js_devtools_bindings_lib",
|
|
]
|
|
externs_list = [ "lib/tab_socket_externs.js" ]
|
|
outputs = [
|
|
"$target_gen_dir/devtools_bindings_test.js",
|
|
]
|
|
config_files = []
|
|
closure_flags = [
|
|
"jscomp_error=checkTypes",
|
|
"dependency_mode=STRICT",
|
|
|
|
# Currently the bindings do not support property renaming so we can't use
|
|
# ADVANCED_OPTIMIZATIONS here. We could add support via either moving all
|
|
# the types to externs, or via applying the same renaming to the json
|
|
# dictionaries sent between C++ and JS. The closure compiler can produce
|
|
# files which contain those mappings with the appropriate flag.
|
|
"compilation_level=SIMPLE",
|
|
"language_out=ES5_STRICT",
|
|
"entry_point=chromium.BindingsTest",
|
|
]
|
|
}
|
|
|
|
grit("headless_browsertest_resources_grit") {
|
|
source = "headless_browsertest_resources.grd"
|
|
outputs = [
|
|
"grit/headless_browsertest_resources.h",
|
|
"$root_gen_dir/headless/headless_browsertest_resources.pak",
|
|
]
|
|
grit_flags = [
|
|
"-E",
|
|
"gen_root=" + rebase_path(root_gen_dir, root_build_dir),
|
|
]
|
|
deps = [
|
|
":js_devtools_bindings_test",
|
|
]
|
|
resource_ids = "lib/headless_browsertest_resource_ids"
|
|
}
|
|
|
|
repack("headless_browser_tests_pak") {
|
|
sources = [
|
|
"$root_gen_dir/headless/headless_browsertest_resources.pak",
|
|
]
|
|
output = "$root_out_dir/headless_browser_tests.pak"
|
|
deps = [
|
|
":headless_browsertest_resources_grit",
|
|
]
|
|
}
|
|
}
|
|
|
|
test("headless_browsertests") {
|
|
sources = [
|
|
"lib/frame_id_browsertest.cc",
|
|
"lib/headless_browser_browsertest.cc",
|
|
"lib/headless_browser_context_browsertest.cc",
|
|
"lib/headless_devtools_client_browsertest.cc",
|
|
"lib/headless_web_contents_browsertest.cc",
|
|
"lib/virtual_time_browsertest.cc",
|
|
"public/util/compositor_controller_browsertest.cc",
|
|
"public/util/testing/fake_managed_dispatch_url_request_job.cc",
|
|
"public/util/testing/fake_managed_dispatch_url_request_job.h",
|
|
"public/util/testing/generic_url_request_mocks.cc",
|
|
"public/util/testing/generic_url_request_mocks.h",
|
|
"public/util/testing/test_in_memory_protocol_handler.cc",
|
|
"public/util/testing/test_in_memory_protocol_handler.h",
|
|
"test/headless_browser_test.cc",
|
|
"test/headless_browser_test.h",
|
|
"test/headless_render_browsertest.cc",
|
|
"test/headless_render_test.cc",
|
|
"test/headless_render_test.h",
|
|
"test/headless_test_launcher.cc",
|
|
"test/tab_socket_test.cc",
|
|
"test/tab_socket_test.h",
|
|
"test/test_protocol_handler.cc",
|
|
"test/test_protocol_handler.h",
|
|
"test/test_url_request_job.cc",
|
|
"test/test_url_request_job.h",
|
|
]
|
|
|
|
data = [
|
|
"lib/dom_tree_extraction_expected_nodes.txt",
|
|
"lib/dom_tree_extraction_expected_styles.txt",
|
|
"$root_out_dir/headless_lib.pak",
|
|
"//net/tools/testserver/",
|
|
"//third_party/pyftpdlib/",
|
|
"//third_party/pywebsocket/",
|
|
"//third_party/tlslite/",
|
|
"test/data/",
|
|
]
|
|
|
|
if (is_mac) {
|
|
data_deps = [
|
|
":mac_helpers",
|
|
]
|
|
}
|
|
|
|
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
|
|
|
|
if (!is_component_build) {
|
|
sources += [
|
|
"lib/browser/headless_content_browser_client.cc",
|
|
"lib/browser/headless_content_browser_client.h",
|
|
"lib/utility/headless_content_utility_client.cc",
|
|
"lib/utility/headless_content_utility_client.h",
|
|
]
|
|
}
|
|
|
|
deps = [
|
|
":headless_renderer",
|
|
"//base",
|
|
"//components/security_state/content",
|
|
"//content/test:test_support",
|
|
"//testing/gmock",
|
|
"//testing/gtest",
|
|
]
|
|
|
|
if (!is_fuchsia) {
|
|
deps += [
|
|
"//components/crash/content/app:test_support",
|
|
"//components/crash/content/browser",
|
|
]
|
|
}
|
|
|
|
# Only include this if we built the js_binary
|
|
if (is_linux) {
|
|
data += [ "$root_out_dir/headless_browser_tests.pak" ]
|
|
sources += [ "test/headless_js_bindings_browsertest.cc" ]
|
|
deps += [ ":headless_browser_tests_pak" ]
|
|
}
|
|
|
|
if (enable_basic_printing) {
|
|
deps += [
|
|
"//components/printing/browser",
|
|
"//components/printing/service/public/cpp:factory",
|
|
"//pdf",
|
|
]
|
|
}
|
|
}
|
|
|
|
if (is_win) {
|
|
# Headless library with only browser dependencies. This is used when no child
|
|
# dependencies are needed in the target (e.g. chrome:main_dll).
|
|
static_library("headless_shell_browser_lib") {
|
|
sources = [
|
|
"app/headless_shell.cc",
|
|
"app/headless_shell.h",
|
|
"app/headless_shell_switches.cc",
|
|
"app/headless_shell_switches.h",
|
|
"app/headless_shell_win.cc",
|
|
"app/shell_navigation_request.cc",
|
|
"app/shell_navigation_request.h",
|
|
"lib/browser/headless_content_browser_client.cc",
|
|
"lib/browser/headless_content_browser_client.h",
|
|
"public/headless_shell.h",
|
|
]
|
|
deps = [
|
|
":headless",
|
|
"//content:sandbox_helper_win",
|
|
"//content/public/browser",
|
|
"//content/public/common",
|
|
"//net",
|
|
"//sandbox",
|
|
]
|
|
|
|
if (is_multi_dll_chrome) {
|
|
defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
|
|
sources += [
|
|
"lib/browser/headless_web_contents_impl.cc",
|
|
"lib/browser/headless_web_contents_impl.h",
|
|
"lib/headless_content_main_delegate.cc",
|
|
"lib/headless_content_main_delegate.h",
|
|
"lib/headless_content_main_delegate_win.cc",
|
|
]
|
|
deps += [
|
|
"//components/crash/core/common:crash_key",
|
|
"//third_party/WebKit/public:blink_headers",
|
|
]
|
|
}
|
|
|
|
configs += [ ":headless_implementation" ]
|
|
}
|
|
|
|
# Headless library with child specific dependencies (e.g., renderer). This
|
|
# is used when no browser depencendies are needed (e.g. chrome:child_dll).
|
|
static_library("headless_shell_child_lib") {
|
|
sources = [
|
|
"app/headless_shell.cc",
|
|
"app/headless_shell.h",
|
|
"app/headless_shell_switches.cc",
|
|
"app/headless_shell_switches.h",
|
|
"app/headless_shell_win.cc",
|
|
"app/shell_navigation_request.cc",
|
|
"app/shell_navigation_request.h",
|
|
"public/headless_shell.h",
|
|
]
|
|
deps = [
|
|
":headless_renderer",
|
|
"//content/public/child:child",
|
|
"//net",
|
|
"//ui/base",
|
|
]
|
|
|
|
if (is_multi_dll_chrome) {
|
|
defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
|
|
sources += [
|
|
"lib/browser/headless_web_contents_impl.cc",
|
|
"lib/browser/headless_web_contents_impl.h",
|
|
"lib/headless_content_main_delegate.cc",
|
|
"lib/headless_content_main_delegate.h",
|
|
"lib/headless_content_main_delegate_win.cc",
|
|
"lib/utility/headless_content_utility_client.cc",
|
|
"lib/utility/headless_content_utility_client.h",
|
|
]
|
|
deps += [
|
|
"//components/crash/core/common:crash_key",
|
|
"//third_party/WebKit/public:blink_headers",
|
|
]
|
|
}
|
|
|
|
configs += [ ":headless_implementation" ]
|
|
}
|
|
}
|
|
|
|
# Headless library with all included dependencies. Use this library unless you
|
|
# have browser/child dependencies restrictions.
|
|
static_library("headless_shell_lib") {
|
|
sources = [
|
|
"app/headless_shell.cc",
|
|
"app/headless_shell.h",
|
|
"app/headless_shell_switches.cc",
|
|
"app/headless_shell_switches.h",
|
|
"app/shell_navigation_request.cc",
|
|
"app/shell_navigation_request.h",
|
|
"lib/browser/headless_content_browser_client.cc",
|
|
"lib/browser/headless_content_browser_client.h",
|
|
"lib/utility/headless_content_utility_client.cc",
|
|
"lib/utility/headless_content_utility_client.h",
|
|
"public/headless_shell.h",
|
|
]
|
|
|
|
deps = [
|
|
":headless_renderer",
|
|
"//components/security_state/content",
|
|
"//content/public/app:both",
|
|
"//content/public/browser",
|
|
"//content/public/child:child",
|
|
"//content/public/common",
|
|
]
|
|
|
|
if (!is_fuchsia) {
|
|
deps += [ "//components/crash/content/browser" ]
|
|
}
|
|
|
|
if (enable_basic_printing) {
|
|
deps += [
|
|
"//components/printing/browser",
|
|
"//components/printing/renderer",
|
|
"//components/printing/service/public/cpp:factory",
|
|
]
|
|
}
|
|
|
|
if (is_win) {
|
|
defines = [ "HEADLESS_USE_CRASPHAD" ]
|
|
|
|
deps += [
|
|
"//components/crash/content/app:crash_export_thunks",
|
|
"//components/crash/content/app:run_as_crashpad_handler",
|
|
"//content:sandbox_helper_win",
|
|
"//sandbox",
|
|
]
|
|
}
|
|
}
|
|
|
|
if (is_fuchsia) {
|
|
fuchsia_executable_runner("headless_shell_fuchsia") {
|
|
exe_target = ":headless_shell"
|
|
}
|
|
}
|
|
|
|
executable("headless_shell") {
|
|
sources = [
|
|
"app/headless_shell_main.cc",
|
|
]
|
|
|
|
deps = [
|
|
":headless_shell_lib",
|
|
"//build/config:exe_and_shlib_deps",
|
|
]
|
|
|
|
if (!headless_use_embedded_resources) {
|
|
data = [
|
|
"$root_out_dir/headless_lib.pak",
|
|
]
|
|
}
|
|
|
|
if (is_win) {
|
|
deps += [ "//build/win:default_exe_manifest" ]
|
|
}
|
|
}
|
|
|
|
process_version("version_header") {
|
|
template_file = "public/version.h.in"
|
|
sources = [
|
|
"//build/util/LASTCHANGE",
|
|
"//chrome/VERSION",
|
|
]
|
|
output = "$target_gen_dir/public/version.h"
|
|
}
|
|
|
|
executable("headless_example") {
|
|
sources = [
|
|
"app/headless_example.cc",
|
|
]
|
|
|
|
deps = [
|
|
":headless_shell_lib",
|
|
"//build/config:exe_and_shlib_deps",
|
|
]
|
|
}
|