[go: nahoru, domu]

blob: 4e7ef2caca7a83fbc0d973cc83f96ae4f5cccb35 [file] [log] [blame]
# Copyright 2015 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//device/vr/buildflags/buildflags.gni")
import("//testing/test.gni")
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni") # For generate_jni().
}
if (is_mac) {
import("//build/config/mac/mac_sdk.gni")
}
is_linux_without_udev = (is_linux || is_chromeos) && !use_udev
test("device_unittests") {
sources = [
"base/synchronization/one_writer_seqlock_unittest.cc",
"bluetooth/adapter_unittest.cc",
"bluetooth/advertisement_unittest.cc",
"bluetooth/bluetooth_adapter_unittest.cc",
"bluetooth/bluetooth_advertisement_unittest.cc",
"bluetooth/bluetooth_device_unittest.cc",
"bluetooth/bluetooth_discovery_filter_unittest.cc",
"bluetooth/bluetooth_local_gatt_characteristic_unittest.cc",
"bluetooth/bluetooth_local_gatt_descriptor_unittest.cc",
"bluetooth/bluetooth_local_gatt_service_unittest.cc",
"bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc",
"bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc",
"bluetooth/bluetooth_remote_gatt_service_unittest.cc",
"bluetooth/device_unittest.cc",
"bluetooth/public/cpp/bluetooth_uuid_unittest.cc",
"bluetooth/server_socket_unittest.cc",
"bluetooth/socket_unittest.cc",
"bluetooth/string_util_icu_unittest.cc",
"bluetooth/test/bluetooth_gatt_server_test.cc",
"bluetooth/test/bluetooth_gatt_server_test.h",
"bluetooth/test/bluetooth_test.cc",
"bluetooth/test/bluetooth_test.h",
"bluetooth/test/mock_pairing_delegate.cc",
"bluetooth/test/mock_pairing_delegate.h",
"bluetooth/test/test_bluetooth_adapter_observer.cc",
"bluetooth/test/test_bluetooth_adapter_observer.h",
"bluetooth/test/test_bluetooth_advertisement_observer.cc",
"bluetooth/test/test_bluetooth_advertisement_observer.h",
"bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc",
"bluetooth/test/test_bluetooth_local_gatt_service_delegate.h",
"gamepad/abstract_haptic_gamepad_unittest.cc",
"gamepad/dualshock4_controller_unittest.cc",
"gamepad/gamepad_blocklist_unittest.cc",
"gamepad/gamepad_id_list_unittest.cc",
"gamepad/gamepad_provider_unittest.cc",
"gamepad/gamepad_service_unittest.cc",
"gamepad/hid_haptic_gamepad_unittest.cc",
"gamepad/public/cpp/gamepad_mojom_traits_unittest.cc",
"gamepad/xbox_hid_controller_unittest.cc",
"test/run_all_unittests.cc",
]
if (is_mac) {
sources += [
"bluetooth/bluetooth_adapter_mac_unittest.mm",
"bluetooth/bluetooth_low_energy_advertisement_manager_mac_unittest.mm",
"bluetooth/test/bluetooth_test_mac.h",
"bluetooth/test/bluetooth_test_mac.mm",
"bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h",
"bluetooth/test/mock_bluetooth_cbcharacteristic_mac.mm",
"bluetooth/test/mock_bluetooth_cbdescriptor_mac.h",
"bluetooth/test/mock_bluetooth_cbdescriptor_mac.mm",
"bluetooth/test/mock_bluetooth_cbperipheral_mac.h",
"bluetooth/test/mock_bluetooth_cbperipheral_mac.mm",
"bluetooth/test/mock_bluetooth_cbservice_mac.h",
"bluetooth/test/mock_bluetooth_cbservice_mac.mm",
"bluetooth/test/mock_bluetooth_central_manager_mac.h",
"bluetooth/test/mock_bluetooth_central_manager_mac.mm",
]
}
if (is_android) {
sources += [
"bluetooth/bluetooth_adapter_android_unittest.cc",
"bluetooth/test/bluetooth_test_android.cc",
"bluetooth/test/bluetooth_test_android.h",
]
}
if (is_win) {
sources += [
"bluetooth/bluetooth_adapter_win_unittest.cc",
"bluetooth/bluetooth_device_win_unittest.cc",
"bluetooth/bluetooth_low_energy_win_unittest.cc",
"bluetooth/bluetooth_service_record_win_unittest.cc",
"bluetooth/bluetooth_task_manager_win_unittest.cc",
"bluetooth/test/bluetooth_test_win.cc",
"bluetooth/test/bluetooth_test_win.h",
"gamepad/wgi_data_fetcher_win_unittest.cc",
]
}
if (is_fuchsia) {
sources += [
"bluetooth/test/bluetooth_test_fuchsia.cc",
"bluetooth/test/bluetooth_test_fuchsia.h",
]
}
deps = [
"//base",
"//base/test:test_support",
"//base/third_party/dynamic_annotations:dynamic_annotations",
"//build:chromeos_buildflags",
"//components/apdu",
"//components/cbor",
"//components/device_event_log",
"//device/base",
"//device/base/synchronization",
"//device/bluetooth",
"//device/bluetooth:deprecated_experimental_mojo",
"//device/bluetooth:fake_bluetooth",
"//device/bluetooth:mocks",
"//device/fido",
"//device/fido:test_support",
"//device/gamepad",
"//device/gamepad:test_helpers",
"//device/gamepad/public/cpp:shared_with_blink",
"//device/gamepad/public/cpp:switches",
"//device/gamepad/public/mojom",
"//mojo/core/embedder",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/test_support:test_utils",
"//net",
"//testing/gmock",
"//testing/gtest",
"//third_party/blink/public:blink_headers",
"//ui/base",
"//url",
]
data_deps = [
"bluetooth/strings:bluetooth_test_strings",
"//testing/buildbot/filters:device_unittests_filters",
"//ui/resources:ui_test_pak_data",
]
# Most of the FIDO implementation is not compiled in for Android.
if (!is_android) {
sources += [
"fido/attestation_statement_formats_unittest.cc",
"fido/auth_token_requester_unittest.cc",
"fido/bio/enrollment_handler_unittest.cc",
"fido/ble_adapter_manager_unittest.cc",
"fido/cable/fido_ble_connection_unittest.cc",
"fido/cable/fido_ble_frames_unittest.cc",
"fido/cable/fido_ble_transaction_unittest.cc",
"fido/cable/fido_cable_device_unittest.cc",
"fido/cable/fido_cable_discovery_unittest.cc",
"fido/cable/fido_cable_handshake_handler_unittest.cc",
"fido/cable/v2_handshake_unittest.cc",
"fido/cbor_extract_unittest.cc",
"fido/credential_management_handler_unittest.cc",
"fido/ctap_request_unittest.cc",
"fido/ctap_response_unittest.cc",
"fido/fake_fido_discovery_unittest.cc",
"fido/fido_device_authenticator_unittest.cc",
"fido/fido_device_discovery_unittest.cc",
"fido/fido_parsing_utils_unittest.cc",
"fido/fido_request_handler_unittest.cc",
"fido/filter_unittest.cc",
"fido/get_assertion_handler_unittest.cc",
"fido/get_assertion_task_unittest.cc",
"fido/hid/fido_hid_message_unittest.cc",
"fido/large_blob_unittest.cc",
"fido/make_credential_handler_unittest.cc",
"fido/make_credential_task_unittest.cc",
"fido/pin_unittest.cc",
"fido/test_callback_receiver_unittest.cc",
"fido/u2f_command_constructor_unittest.cc",
"fido/u2f_register_operation_unittest.cc",
"fido/u2f_sign_operation_unittest.cc",
"fido/virtual_ctap2_device_unittest.cc",
"fido/virtual_fido_device_authenticator_unittest.cc",
"fido/virtual_u2f_device_unittest.cc",
]
deps += [
"//device/fido:mocks",
"//services/data_decoder/public/cpp:test_support",
]
if (is_mac) {
data_deps += [ "fido/strings:fido_test_strings" ]
}
}
if (is_mac) {
sources += [
"fido/mac/authenticator_unittest.mm",
"fido/mac/browsing_data_deletion_unittest.mm",
"fido/mac/credential_metadata_unittest.cc",
"fido/mac/credential_store_unittest.mm",
"fido/mac/get_assertion_operation_unittest_mac.mm",
"fido/mac/make_credential_operation_unittest_mac.mm",
"fido/mac/util_unittest.cc",
]
}
if (is_win) {
sources += [
"fido/win/authenticator_unittest.cc",
"fido/win/type_conversions_unittest.cc",
]
}
# FIDO HID:
# Android doesn't compile.
# Linux, requires udev.
if (!is_linux_without_udev && !is_android) {
sources += [
"fido/hid/fido_hid_device_unittest.cc",
"fido/hid/fido_hid_discovery_unittest.cc",
]
deps += [
"//device/fido:test_support",
"//services/device/public/cpp:test_support",
]
}
if (use_udev) {
sources += [
"udev_linux/udev_unittest.cc",
"udev_linux/udev_watcher_unittest.cc",
]
deps += [
"//device/udev_linux",
"//device/udev_linux:test_support",
]
}
if (is_android) {
deps += [
":bluetooth_test_java",
":bluetooth_test_jni_headers",
]
}
if (is_chromeos) {
sources += [
"bluetooth/bluetooth_low_energy_scan_filter_unittest.cc",
"bluetooth/chromeos/bluetooth_connection_logger_unittest.cc",
"bluetooth/chromeos/bluetooth_utils_unittest.cc",
]
deps += [ "//chromeos/constants" ]
if (is_chromeos_ash) {
deps += [ "//ash/constants" ]
}
if (is_chromeos_lacros) {
deps += [ "//chromeos/lacros:test_support" ]
}
}
if ((is_chromeos || is_linux) && use_dbus) {
configs += [ "//build/config/linux/dbus" ]
sources += [
"bluetooth/bluez/bluetooth_adapter_bluez_unittest.cc",
"bluetooth/bluez/bluetooth_adapter_profile_bluez_unittest.cc",
"bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc",
"bluetooth/bluez/bluetooth_bluez_unittest.cc",
"bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc",
"bluetooth/bluez/bluetooth_service_attribute_value_bluez_unittest.cc",
"bluetooth/bluez/bluetooth_service_record_bluez_unittest.cc",
"bluetooth/bluez/bluetooth_socket_bluez_unittest.cc",
"bluetooth/dbus/bluetooth_gatt_application_service_provider_unittest.cc",
"bluetooth/dbus/bluetooth_gatt_characteristic_service_provider_unittest.cc",
"bluetooth/floss/bluetooth_floss_unittest.cc",
"bluetooth/floss/bluetooth_gatt_floss_unittest.cc",
"bluetooth/floss/bluetooth_socket_floss_unittest.cc",
"bluetooth/floss/exported_callback_manager_unittest.cc",
"bluetooth/floss/floss_adapter_client_unittest.cc",
"bluetooth/floss/floss_admin_client_unittest.cc",
"bluetooth/floss/floss_advertiser_client_unittest.cc",
"bluetooth/floss/floss_battery_manager_client_unittest.cc",
"bluetooth/floss/floss_dbus_client_unittest.cc",
"bluetooth/floss/floss_gatt_manager_client_unittest.cc",
"bluetooth/floss/floss_lescan_client_unittest.cc",
"bluetooth/floss/floss_manager_client_unittest.cc",
"bluetooth/floss/floss_socket_manager_unittest.cc",
"bluetooth/test/bluetooth_test_bluez.cc",
"bluetooth/test/bluetooth_test_bluez.h",
]
deps += [
"//dbus",
"//dbus:test_support",
]
if (is_chromeos) {
sources += [
"bluetooth/dbus/bluetooth_advertisement_monitor_application_service_provider_unittest.cc",
"bluetooth/dbus/bluetooth_advertisement_monitor_service_provider_unittest.cc",
]
deps += [ "//services/data_decoder/public/mojom" ]
}
}
if (is_castos) {
# Cast does not support GATT server mode.
sources -= [
"bluetooth/bluetooth_local_gatt_characteristic_unittest.cc",
"bluetooth/bluetooth_local_gatt_descriptor_unittest.cc",
"bluetooth/bluetooth_local_gatt_service_unittest.cc",
]
sources += [
"bluetooth/cast/bluetooth_adapter_cast_unittest.cc",
"bluetooth/cast/bluetooth_utils_unittest.cc",
"bluetooth/test/bluetooth_test_cast.cc",
"bluetooth/test/bluetooth_test_cast.h",
]
deps += [
"//chromecast/device/bluetooth:util",
"//chromecast/device/bluetooth/le",
"//chromecast/device/bluetooth/le:test_support",
"//chromecast/device/bluetooth/shlib:mock_shlib",
]
}
if (is_mac) {
deps += [ "//third_party/ocmock" ]
ldflags = [ "-ObjC" ]
frameworks = [
"CoreBluetooth.framework",
"IOBluetooth.framework",
"IOKit.framework",
"Foundation.framework",
"Security.framework",
]
}
if (is_win) {
sources += [
"bluetooth/bluetooth_classic_win_fake.cc",
"bluetooth/bluetooth_classic_win_fake.h",
"bluetooth/bluetooth_low_energy_win_fake.cc",
"bluetooth/bluetooth_low_energy_win_fake.h",
"bluetooth/test/fake_bluetooth_adapter_winrt.cc",
"bluetooth/test/fake_bluetooth_adapter_winrt.h",
"bluetooth/test/fake_bluetooth_le_advertisement_data_section_winrt.cc",
"bluetooth/test/fake_bluetooth_le_advertisement_data_section_winrt.h",
"bluetooth/test/fake_bluetooth_le_advertisement_publisher_status_changed_event_args_winrt.cc",
"bluetooth/test/fake_bluetooth_le_advertisement_publisher_status_changed_event_args_winrt.h",
"bluetooth/test/fake_bluetooth_le_advertisement_publisher_winrt.cc",
"bluetooth/test/fake_bluetooth_le_advertisement_publisher_winrt.h",
"bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.cc",
"bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.h",
"bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.cc",
"bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.h",
"bluetooth/test/fake_bluetooth_le_advertisement_winrt.cc",
"bluetooth/test/fake_bluetooth_le_advertisement_winrt.h",
"bluetooth/test/fake_bluetooth_le_device_winrt.cc",
"bluetooth/test/fake_bluetooth_le_device_winrt.h",
"bluetooth/test/fake_bluetooth_le_manufacturer_data_winrt.cc",
"bluetooth/test/fake_bluetooth_le_manufacturer_data_winrt.h",
"bluetooth/test/fake_device_information_custom_pairing_winrt.cc",
"bluetooth/test/fake_device_information_custom_pairing_winrt.h",
"bluetooth/test/fake_device_information_pairing_winrt.cc",
"bluetooth/test/fake_device_information_pairing_winrt.h",
"bluetooth/test/fake_device_information_winrt.cc",
"bluetooth/test/fake_device_information_winrt.h",
"bluetooth/test/fake_device_pairing_requested_event_args_winrt.cc",
"bluetooth/test/fake_device_pairing_requested_event_args_winrt.h",
"bluetooth/test/fake_device_pairing_result_winrt.cc",
"bluetooth/test/fake_device_pairing_result_winrt.h",
"bluetooth/test/fake_device_watcher_winrt.cc",
"bluetooth/test/fake_device_watcher_winrt.h",
"bluetooth/test/fake_gatt_characteristic_winrt.cc",
"bluetooth/test/fake_gatt_characteristic_winrt.h",
"bluetooth/test/fake_gatt_characteristics_result_winrt.cc",
"bluetooth/test/fake_gatt_characteristics_result_winrt.h",
"bluetooth/test/fake_gatt_descriptor_winrt.cc",
"bluetooth/test/fake_gatt_descriptor_winrt.h",
"bluetooth/test/fake_gatt_descriptors_result_winrt.cc",
"bluetooth/test/fake_gatt_descriptors_result_winrt.h",
"bluetooth/test/fake_gatt_device_service_winrt.cc",
"bluetooth/test/fake_gatt_device_service_winrt.h",
"bluetooth/test/fake_gatt_device_services_result_winrt.cc",
"bluetooth/test/fake_gatt_device_services_result_winrt.h",
"bluetooth/test/fake_gatt_read_result_winrt.cc",
"bluetooth/test/fake_gatt_read_result_winrt.h",
"bluetooth/test/fake_gatt_session_winrt.cc",
"bluetooth/test/fake_gatt_session_winrt.h",
"bluetooth/test/fake_gatt_value_changed_event_args_winrt.cc",
"bluetooth/test/fake_gatt_value_changed_event_args_winrt.h",
"bluetooth/test/fake_gatt_write_result_winrt.cc",
"bluetooth/test/fake_gatt_write_result_winrt.h",
"bluetooth/test/fake_radio_winrt.cc",
"bluetooth/test/fake_radio_winrt.h",
]
}
if (enable_vr) {
sources += [
"vr/orientation/orientation_device_provider_unittest.cc",
"vr/orientation/orientation_device_unittest.cc",
"vr/util/fps_meter_unittest.cc",
"vr/util/sliding_average_unittest.cc",
"vr/util/stage_utils_unittest.cc",
"vr/vr_device_base_unittest.cc",
]
defines = [ "DEVICE_VR_IMPLEMENTATION" ]
deps += [
"//device/vr",
"//device/vr:vr_fakes",
"//device/vr:vr_util",
"//device/vr/orientation",
"//device/vr/public/mojom:isolated_xr_service",
"//services/device/public/cpp/generic_sensor",
"//ui/display",
"//ui/display:test_support",
]
}
# Some gamepad tests require the HID service. Only build these tests on
# platforms where the HID service is enabled.
if (!is_android && !is_fuchsia) {
sources += [ "gamepad/nintendo_data_fetcher_unittest.cc" ]
deps += [
"//services/device:test_support",
"//services/device/hid",
"//services/device/public/cpp:test_support",
]
}
if (is_chromeos) {
deps += [ "//chromeos/dbus/u2f" ]
}
}
if (is_android) {
bluetooth_java_sources_needing_jni = [
"bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java",
"bluetooth/test/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothScanFilter.java",
]
generate_jni("bluetooth_test_jni_headers") {
testonly = true
sources = bluetooth_java_sources_needing_jni
}
android_library("bluetooth_test_java") {
testonly = true
annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
sources = bluetooth_java_sources_needing_jni
deps = [
"//base:base_java",
"//base:jni_java",
"//components/location/android:location_java",
"//device/bluetooth:java",
"//third_party/android_sdk:android_test_mock_java",
"//third_party/androidx:androidx_annotation_annotation_java",
]
srcjar_deps = [ ":bluetooth_test_javagen" ]
}
robolectric_binary("device_junit_tests") {
sources = [
"gamepad/android/junit/src/org/chromium/device/gamepad/GamepadDeviceTest.java",
"gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java",
]
deps = [
"$google_play_services_package:google_play_services_base_java",
"$google_play_services_package:google_play_services_basement_java",
"$google_play_services_package:google_play_services_location_java",
"//base:base_java_test_support",
"//base:base_junit_test_support",
"//device/gamepad:java",
"//mojo/public/java:bindings_java",
"//third_party/androidx:androidx_annotation_annotation_java",
"//third_party/hamcrest:hamcrest_java",
]
srcjar_deps = [ "//device/gamepad:java_enums_srcjar" ]
}
java_cpp_enum("bluetooth_test_javagen") {
sources = [ "bluetooth/test/bluetooth_test.h" ]
}
}