blob: bfa92ed7904eb9629badad913837392db626d4fa [file] [log] [blame]
# Copyright 2014 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/features.gni")
import("//build/config/nacl/config.gni")
import("//build/config/nacl/rules.gni")
import("//components/nacl/features.gni")
import("//ppapi/buildflags/buildflags.gni")
import("//testing/test.gni")
if (is_mac) {
import("//build/config/mac/rules.gni")
}
assert(
!(is_android || is_fuchsia) || enable_plugins,
"ppapi should not be used on Android or Fuchsia, unless plugins are explicitly enabled")
# Test files shared between several targets below.
#
# TODO(brettw) it seems like it should be possible to factor this in a source
# set that is shared in such a way that these only need to be referenced once.
test_common_source_files = [
"lib/gl/gles2/gl2ext_ppapi.c",
"lib/gl/gles2/gl2ext_ppapi.h",
"lib/gl/gles2/gles2.c",
"tests/all_c_includes.h",
"tests/all_cpp_includes.h",
"tests/arch_dependent_sizes_32.h",
"tests/arch_dependent_sizes_64.h",
"tests/pp_thread.h",
"tests/test_audio.cc",
"tests/test_audio.h",
"tests/test_audio_config.cc",
"tests/test_audio_config.h",
"tests/test_case.cc",
"tests/test_case.h",
"tests/test_console.cc",
"tests/test_console.h",
"tests/test_core.cc",
"tests/test_core.h",
"tests/test_cursor_control.cc",
"tests/test_cursor_control.h",
"tests/test_empty.cc",
"tests/test_empty.h",
"tests/test_file_io.cc",
"tests/test_file_io.h",
"tests/test_file_ref.cc",
"tests/test_file_ref.h",
"tests/test_file_system.cc",
"tests/test_file_system.h",
"tests/test_fullscreen.cc",
"tests/test_fullscreen.h",
"tests/test_graphics_2d.cc",
"tests/test_graphics_2d.h",
"tests/test_graphics_3d.cc",
"tests/test_graphics_3d.h",
"tests/test_host_resolver.cc",
"tests/test_host_resolver.h",
"tests/test_host_resolver_crash.cc",
"tests/test_host_resolver_crash.h",
"tests/test_host_resolver_private.cc",
"tests/test_host_resolver_private.h",
"tests/test_host_resolver_private_disallowed.cc",
"tests/test_host_resolver_private_disallowed.h",
"tests/test_image_data.cc",
"tests/test_image_data.h",
"tests/test_ime_input_event.cc",
"tests/test_ime_input_event.h",
"tests/test_input_event.cc",
"tests/test_input_event.h",
"tests/test_media_stream_audio_track.cc",
"tests/test_media_stream_audio_track.h",
"tests/test_media_stream_video_track.cc",
"tests/test_media_stream_video_track.h",
"tests/test_memory.cc",
"tests/test_memory.h",
"tests/test_message_handler.cc",
"tests/test_message_handler.h",
"tests/test_message_loop.cc",
"tests/test_message_loop.h",
"tests/test_mouse_cursor.cc",
"tests/test_mouse_cursor.h",
"tests/test_mouse_lock.cc",
"tests/test_mouse_lock.h",
"tests/test_net_address.cc",
"tests/test_net_address.h",
"tests/test_net_address_private_untrusted.cc",
"tests/test_net_address_private_untrusted.h",
"tests/test_network_monitor.cc",
"tests/test_network_monitor.h",
"tests/test_network_proxy.cc",
"tests/test_network_proxy.h",
"tests/test_paint_aggregator.cc",
"tests/test_paint_aggregator.h",
"tests/test_post_message.cc",
"tests/test_post_message.h",
"tests/test_printing.cc",
"tests/test_printing.h",
"tests/test_tcp_server_socket_private.cc",
"tests/test_tcp_server_socket_private.h",
"tests/test_tcp_socket.cc",
"tests/test_tcp_socket.h",
"tests/test_tcp_socket_private.cc",
"tests/test_tcp_socket_private.h",
"tests/test_tcp_socket_private_crash.cc",
"tests/test_tcp_socket_private_crash.h",
"tests/test_test_internals.cc",
"tests/test_test_internals.h",
"tests/test_trace_event.cc",
"tests/test_trace_event.h",
"tests/test_udp_socket.cc",
"tests/test_udp_socket.h",
"tests/test_udp_socket_private.cc",
"tests/test_udp_socket_private.h",
"tests/test_uma.cc",
"tests/test_uma.h",
"tests/test_url_loader.cc",
"tests/test_url_loader.h",
"tests/test_url_request.cc",
"tests/test_url_request.h",
"tests/test_utils.h",
"tests/test_utils.cc",
"tests/test_var.cc",
"tests/test_var.h",
"tests/test_var_resource.cc",
"tests/test_var_resource.h",
"tests/test_video_decoder.cc",
"tests/test_video_decoder.h",
"tests/test_video_encoder.cc",
"tests/test_video_encoder.h",
"tests/test_view.cc",
"tests/test_view.h",
"tests/test_websocket.cc",
"tests/test_websocket.h",
"tests/testing_instance.cc",
"tests/testing_instance.h",
# Compile-time tests
"tests/test_c_includes.c",
"tests/test_cpp_includes.cc",
"tests/test_struct_sizes.c",
]
copy("copy_test_files") {
sources = [
# Keep "test_case.html.mock-http-headers" with "test_case.html"
# and "corb_eligible_resource.json.mock-http-headers" with
# "corb_eligible_resource.json".
"tests/corb_eligible_resource.json",
"tests/corb_eligible_resource.json.mock-http-headers",
"tests/test_case.html",
"tests/test_case.html.mock-http-headers",
"tests/test_page.css",
"tests/test_page.css.mock-http-headers",
]
outputs = [ "$root_out_dir/{{source_file_part}}" ]
}
copy("copy_test_files2") {
sources = [ "tests/test_url_loader_data/hello.txt" ]
outputs = [ "$root_out_dir/test_url_loader_data/{{source_file_part}}" ]
}
source_set("ppapi_tests_sources") {
sources = test_common_source_files
sources += [
"tests/test_browser_font.cc",
"tests/test_browser_font.h",
"tests/test_buffer.cc",
"tests/test_buffer.h",
"tests/test_char_set.cc",
"tests/test_char_set.h",
"tests/test_crypto.cc",
"tests/test_crypto.h",
"tests/test_file_chooser.cc",
"tests/test_file_chooser.h",
"tests/test_net_address_private.cc",
"tests/test_net_address_private.h",
"tests/test_tcp_socket_private_trusted.cc",
"tests/test_tcp_socket_private_trusted.h",
"tests/test_url_util.cc",
"tests/test_url_util.h",
"tests/test_utils.h",
"tests/test_video_decoder_dev.cc",
"tests/test_video_decoder_dev.h",
"tests/test_x509_certificate_private.cc",
"tests/test_x509_certificate_private.h",
# Deprecated test cases.
"tests/test_instance_deprecated.cc",
"tests/test_instance_deprecated.h",
"tests/test_var_deprecated.cc",
"tests/test_var_deprecated.h",
]
configs += [
"//build/config:precompiled_headers",
"//v8:external_startup_data",
]
defines = [ "GL_GLEXT_PROTOTYPES" ]
include_dirs = [ "lib/gl/include" ]
deps = [
":copy_test_files",
":copy_test_files2",
"//ppapi/cpp",
"//ppapi/shared_impl",
]
}
if (is_mac) {
ppapi_tests_target_type = "mac_plugin_bundle"
} else {
ppapi_tests_target_type = "shared_library"
}
target(ppapi_tests_target_type, "ppapi_tests") {
deps = [ ":ppapi_tests_sources" ]
}
source_set("blink_deprecated_test_plugin_sources") {
sources = [ "tests/blink_deprecated_test_plugin.cc" ]
deps = [
"//base",
"//ppapi/cpp",
"//ppapi/shared_impl",
]
}
if (!is_mac) {
loadable_module("blink_deprecated_test_plugin") {
deps = [ ":blink_deprecated_test_plugin_sources" ]
}
} else {
mac_plugin_bundle("blink_deprecated_test_plugin") {
deps = [ ":blink_deprecated_test_plugin_sources" ]
}
}
source_set("blink_test_plugin_sources") {
sources = [ "tests/blink_test_plugin.cc" ]
deps = [
"//base",
"//ppapi/cpp",
"//ppapi/shared_impl",
]
}
if (!is_mac) {
loadable_module("blink_test_plugin") {
deps = [ ":blink_test_plugin_sources" ]
}
} else {
mac_plugin_bundle("blink_test_plugin") {
deps = [ ":blink_test_plugin_sources" ]
}
}
test("ppapi_unittests") {
sources = [
"host/resource_message_filter_unittest.cc",
"proxy/device_enumeration_resource_helper_unittest.cc",
"proxy/file_chooser_resource_unittest.cc",
"proxy/file_system_resource_unittest.cc",
"proxy/interface_list_unittest.cc",
"proxy/mock_resource.cc",
"proxy/mock_resource.h",
"proxy/nacl_message_scanner_unittest.cc",
"proxy/plugin_dispatcher_unittest.cc",
"proxy/plugin_resource_tracker_unittest.cc",
"proxy/plugin_var_tracker_unittest.cc",
"proxy/ppapi_command_buffer_proxy_unittest.cc",
"proxy/ppb_var_unittest.cc",
"proxy/ppp_instance_private_proxy_unittest.cc",
"proxy/ppp_instance_proxy_unittest.cc",
"proxy/ppp_messaging_proxy_unittest.cc",
"proxy/printing_resource_unittest.cc",
"proxy/raw_var_data_unittest.cc",
"proxy/serialized_var_unittest.cc",
"proxy/tracked_callback_unittest.cc",
"proxy/video_decoder_resource_unittest.cc",
"proxy/video_encoder_resource_unittest.cc",
"proxy/websocket_resource_unittest.cc",
"shared_impl/media_stream_audio_track_shared_unittest.cc",
"shared_impl/media_stream_buffer_manager_unittest.cc",
"shared_impl/media_stream_video_track_shared_unittest.cc",
"shared_impl/proxy_lock_unittest.cc",
"shared_impl/resource_tracker_unittest.cc",
"shared_impl/thread_aware_callback_unittest.cc",
"shared_impl/time_conversion_unittest.cc",
"shared_impl/var_tracker_unittest.cc",
]
deps = [
"//base/test:test_support",
"//gpu/ipc/common:command_buffer_traits",
"//ipc",
"//ipc:run_all_unittests",
"//ipc:test_support",
"//media:shared_memory_support",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/proxy:test_support",
"//ppapi/shared_impl",
"//ppapi/shared_impl:test_support",
"//skia",
"//testing/gmock",
"//testing/gtest",
"//ui/surface",
]
}
test("ppapi_perftests") {
sources = [
"proxy/ppapi_perftests.cc",
"proxy/ppp_messaging_proxy_perftest.cc",
]
deps = [
"//base/test:test_support",
"//mojo/core/embedder",
"//ppapi/proxy",
"//ppapi/proxy:test_support",
"//ppapi/shared_impl",
"//ppapi/shared_impl:test_support",
"//testing/gtest",
]
}
executable("pepper_hash_for_uma") {
sources = [ "tools/pepper_hash_for_uma.cc" ]
deps = [
"//base",
"//build/win:default_exe_manifest",
]
}
source_set("ppapi_gles2_lib") {
include_dirs = [ "lib/gl/include" ]
sources = [
"lib/gl/gles2/gl2ext_ppapi.c",
"lib/gl/gles2/gl2ext_ppapi.h",
"lib/gl/gles2/gles2.c",
]
deps = [ "//ppapi/cpp" ]
}
if (enable_nacl) {
import("//ppapi/native_client/nacl_test_data.gni")
if (is_nacl) {
nacl_test_data("ppapi_nacl_tests") {
include_dirs = [ "lib/gl/include" ]
sources = test_common_source_files
sources += [
"tests/test_nacl_irt_stack_alignment.cc",
"tests/test_nacl_irt_stack_alignment.h",
"tests/test_tcp_server_socket_private_disallowed.cc",
"tests/test_tcp_server_socket_private_disallowed.h",
"tests/test_tcp_socket_private_disallowed.cc",
"tests/test_tcp_socket_private_disallowed.h",
"tests/test_udp_socket_private_disallowed.cc",
"tests/test_udp_socket_private_disallowed.h",
]
defines = [
"GL_GLEXT_PROTOTYPES",
"PPAPI_TEST_IMPLEMENTATION",
]
deps = [
"//ppapi/cpp",
"//ppapi/native_client/src/untrusted/irt_stub:ppapi_stub_lib",
]
if (current_cpu == "pnacl") {
pretranslate_pexe = true
}
}
}
group("ppapi_nacl_tests_all") {
data_deps = [
":copy_test_files",
":ppapi_nacl_tests(//build/toolchain/nacl:clang_newlib_${target_cpu})",
":ppapi_nacl_tests(//build/toolchain/nacl:newlib_pnacl)",
]
if (target_cpu != "mipsel" && !is_mac && !is_win) {
data_deps +=
[ ":ppapi_nacl_tests(//build/toolchain/nacl:glibc_${target_cpu})" ]
}
}
}