| # 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/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 && !use_udev |
| |
| test("device_unittests") { |
| sources = [ |
| "base/synchronization/one_writer_seqlock_unittest.cc", |
| "bluetooth/bluetooth_adapter_android_unittest.cc", |
| "bluetooth/bluetooth_adapter_mac_metrics_unittest.mm", |
| "bluetooth/bluetooth_adapter_mac_unittest.mm", |
| "bluetooth/bluetooth_adapter_unittest.cc", |
| "bluetooth/bluetooth_adapter_win_unittest.cc", |
| "bluetooth/bluetooth_advertisement_unittest.cc", |
| "bluetooth/bluetooth_device_unittest.cc", |
| "bluetooth/bluetooth_device_win_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_low_energy_advertisement_manager_mac_unittest.mm", |
| "bluetooth/bluetooth_low_energy_win_unittest.cc", |
| "bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc", |
| "bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc", |
| "bluetooth/bluetooth_remote_gatt_service_unittest.cc", |
| "bluetooth/bluetooth_service_record_win_unittest.cc", |
| "bluetooth/bluetooth_task_manager_win_unittest.cc", |
| "bluetooth/device_unittest.cc", |
| "bluetooth/public/cpp/bluetooth_uuid_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/bluetooth_test_android.cc", |
| "bluetooth/test/bluetooth_test_android.h", |
| "bluetooth/test/bluetooth_test_mac.h", |
| "bluetooth/test/bluetooth_test_mac.mm", |
| "bluetooth/test/bluetooth_test_win.cc", |
| "bluetooth/test/bluetooth_test_win.h", |
| "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", |
| "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", |
| "bluetooth/test/test_pairing_delegate.cc", |
| "bluetooth/test/test_pairing_delegate.h", |
| "bluetooth/uribeacon/uri_encoder_unittest.cc", |
| "fido/attestation_statement_formats_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_discovery_unittest.cc", |
| "fido/fido_parsing_utils_unittest.cc", |
| "fido/fido_request_handler_unittest.cc", |
| "fido/get_assertion_handler_unittest.cc", |
| "fido/get_assertion_task_unittest.cc", |
| "fido/hid/fido_hid_message_unittest.cc", |
| "fido/mac/browsing_data_deletion_unittest.mm", |
| "fido/mac/credential_metadata_unittest.cc", |
| "fido/mac/get_assertion_operation_unittest_mac.mm", |
| "fido/mac/make_credential_operation_unittest_mac.mm", |
| "fido/mac/util_unittest.cc", |
| "fido/make_credential_handler_unittest.cc", |
| "fido/make_credential_task_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_u2f_device_unittest.cc", |
| "fido/win/type_conversions_unittest.cc", |
| "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_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", |
| "//components/apdu", |
| "//components/cbor", |
| "//components/device_event_log", |
| "//device/base", |
| "//device/base/synchronization", |
| "//device/bluetooth", |
| "//device/bluetooth:deprecated_experimental_mojo", |
| "//device/bluetooth:mocks", |
| "//device/bluetooth/uribeacon", |
| "//device/fido", |
| "//device/fido:mocks", |
| "//device/fido:test_support", |
| "//device/gamepad", |
| "//device/gamepad:test_helpers", |
| "//device/gamepad/public/cpp:shared_with_blink", |
| "//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", |
| "//ui/resources:ui_test_pak_data", |
| ] |
| |
| # U2F: |
| # 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/hid", |
| "//services/device/public/mojom", |
| ] |
| } |
| |
| 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/chromeos/bluetooth_utils_unittest.cc" ] |
| deps += [ "//chromeos/constants" ] |
| } |
| |
| if ((is_chromeos || is_linux) && use_dbus) { |
| configs += [ "//build/config/linux/dbus" ] |
| |
| sources += [ |
| "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/test/bluetooth_test_bluez.cc", |
| "bluetooth/test/bluetooth_test_bluez.h", |
| ] |
| |
| deps += [ "//dbus" ] |
| |
| if (is_chromeos) { |
| deps += [ "//services/data_decoder/public/mojom" ] |
| } |
| } |
| |
| if (is_linux) { |
| if (is_chromecast) { |
| # 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" ] |
| libs = [ |
| "CoreBluetooth.framework", |
| "IOBluetooth.framework", |
| "IOKit.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_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", |
| ] |
| |
| if (is_android) { |
| deps += [ "//device/vr:java" ] |
| } |
| |
| defines = [ "DEVICE_VR_IMPLEMENTATION" ] |
| |
| deps += [ |
| "//device/vr", |
| "//device/vr:vr_fakes", |
| "//device/vr/orientation", |
| "//device/vr/public/mojom", |
| "//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/hid:mocks", |
| ] |
| } |
| } |
| |
| 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 |
| sources = bluetooth_java_sources_needing_jni |
| deps = [ |
| "//base:base_java", |
| "//components/location/android:location_java", |
| "//device/bluetooth:java", |
| "//third_party/android_deps:androidx_annotation_annotation_java", |
| "//third_party/android_sdk:android_test_mock_java", |
| ] |
| |
| srcjar_deps = [ ":bluetooth_test_javagen" ] |
| } |
| |
| junit_binary("device_junit_tests") { |
| sources = [ "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", |
| "//base:base_java_test_support", |
| "//base:base_junit_test_support", |
| "//device/gamepad:java", |
| "//mojo/public/java:bindings_java", |
| "//third_party/android_deps:androidx_annotation_annotation_java", |
| ] |
| srcjar_deps = [ "//device/gamepad:java_enums_srcjar" ] |
| } |
| |
| java_cpp_enum("bluetooth_test_javagen") { |
| sources = [ "bluetooth/test/bluetooth_test.h" ] |
| } |
| } |