1 # Copyright 2015 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/chromeos/ui_mode.gni")
6 import("//build/config/features.gni")
7 import("//device/vr/buildflags/buildflags.gni")
8 import("//testing/test.gni")
11 import("//build/config/android/config.gni")
12 import("//build/config/android/rules.gni")
13 import("//third_party/jni_zero/jni_zero.gni")
17 import("//build/config/mac/mac_sdk.gni")
20 is_linux_without_udev = (is_linux || is_chromeos) && !use_udev
22 test("device_unittests") {
24 "base/synchronization/one_writer_seqlock_unittest.cc",
25 "bluetooth/adapter_unittest.cc",
26 "bluetooth/advertisement_unittest.cc",
27 "bluetooth/bluetooth_adapter_unittest.cc",
28 "bluetooth/bluetooth_advertisement_unittest.cc",
29 "bluetooth/bluetooth_device_unittest.cc",
30 "bluetooth/bluetooth_discovery_filter_unittest.cc",
31 "bluetooth/bluetooth_local_gatt_characteristic_unittest.cc",
32 "bluetooth/bluetooth_local_gatt_descriptor_unittest.cc",
33 "bluetooth/bluetooth_local_gatt_service_unittest.cc",
34 "bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc",
35 "bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc",
36 "bluetooth/bluetooth_remote_gatt_service_unittest.cc",
37 "bluetooth/device_unittest.cc",
38 "bluetooth/public/cpp/bluetooth_uuid_unittest.cc",
39 "bluetooth/server_socket_unittest.cc",
40 "bluetooth/socket_unittest.cc",
41 "bluetooth/string_util_icu_unittest.cc",
42 "bluetooth/test/bluetooth_gatt_server_test.cc",
43 "bluetooth/test/bluetooth_gatt_server_test.h",
44 "bluetooth/test/bluetooth_test.cc",
45 "bluetooth/test/bluetooth_test.h",
46 "bluetooth/test/mock_pairing_delegate.cc",
47 "bluetooth/test/mock_pairing_delegate.h",
48 "bluetooth/test/test_bluetooth_adapter_observer.cc",
49 "bluetooth/test/test_bluetooth_adapter_observer.h",
50 "bluetooth/test/test_bluetooth_advertisement_observer.cc",
51 "bluetooth/test/test_bluetooth_advertisement_observer.h",
52 "bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc",
53 "bluetooth/test/test_bluetooth_local_gatt_service_delegate.h",
54 "gamepad/abstract_haptic_gamepad_unittest.cc",
55 "gamepad/dualshock4_controller_unittest.cc",
56 "gamepad/gamepad_blocklist_unittest.cc",
57 "gamepad/gamepad_id_list_unittest.cc",
58 "gamepad/gamepad_provider_unittest.cc",
59 "gamepad/gamepad_service_unittest.cc",
60 "gamepad/hid_haptic_gamepad_unittest.cc",
61 "gamepad/public/cpp/gamepad_mojom_traits_unittest.cc",
62 "gamepad/xbox_hid_controller_unittest.cc",
63 "test/run_all_unittests.cc",
68 "bluetooth/bluetooth_low_energy_adapter_apple_unittest.mm",
69 "bluetooth/bluetooth_low_energy_advertisement_manager_mac_unittest.mm",
70 "bluetooth/test/bluetooth_test_mac.h",
71 "bluetooth/test/bluetooth_test_mac.mm",
72 "bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h",
73 "bluetooth/test/mock_bluetooth_cbcharacteristic_mac.mm",
74 "bluetooth/test/mock_bluetooth_cbdescriptor_mac.h",
75 "bluetooth/test/mock_bluetooth_cbdescriptor_mac.mm",
76 "bluetooth/test/mock_bluetooth_cbperipheral_mac.h",
77 "bluetooth/test/mock_bluetooth_cbperipheral_mac.mm",
78 "bluetooth/test/mock_bluetooth_cbservice_mac.h",
79 "bluetooth/test/mock_bluetooth_cbservice_mac.mm",
80 "bluetooth/test/mock_bluetooth_central_manager_mac.h",
81 "bluetooth/test/mock_bluetooth_central_manager_mac.mm",
86 sources += [ "bluetooth/bluetooth_adapter_mac_unittest.mm" ]
91 "bluetooth/bluetooth_adapter_android_unittest.cc",
92 "bluetooth/test/bluetooth_test_android.cc",
93 "bluetooth/test/bluetooth_test_android.h",
99 "bluetooth/bluetooth_adapter_win_unittest.cc",
100 "bluetooth/bluetooth_device_win_unittest.cc",
101 "bluetooth/bluetooth_service_record_win_unittest.cc",
102 "bluetooth/bluetooth_task_manager_win_unittest.cc",
103 "bluetooth/test/bluetooth_test_win.cc",
104 "bluetooth/test/bluetooth_test_win.h",
105 "gamepad/wgi_data_fetcher_win_unittest.cc",
111 "bluetooth/test/bluetooth_test_fuchsia.cc",
112 "bluetooth/test/bluetooth_test_fuchsia.h",
118 "//base/test:test_support",
119 "//base/third_party/dynamic_annotations:dynamic_annotations",
120 "//build:chromeos_buildflags",
123 "//components/device_event_log",
125 "//device/base/synchronization",
126 "//device/bluetooth",
127 "//device/bluetooth:deprecated_experimental_mojo",
128 "//device/bluetooth:fake_bluetooth",
129 "//device/bluetooth:mocks",
131 "//device/gamepad:test_helpers",
132 "//device/gamepad/public/cpp:shared_with_blink",
133 "//device/gamepad/public/cpp:switches",
134 "//device/gamepad/public/mojom",
135 "//mojo/core/embedder",
136 "//mojo/public/cpp/bindings",
137 "//mojo/public/cpp/test_support:test_utils",
141 "//third_party/blink/public:blink_headers",
147 "bluetooth/strings:bluetooth_test_strings",
148 "//testing/buildbot/filters:device_unittests_filters",
149 "//ui/resources:ui_test_pak_data",
155 "//device/fido:test_support",
159 # Most of the FIDO implementation is not compiled in for Android.
160 if (!is_android && !is_ios) {
162 "fido/attestation_statement_formats_unittest.cc",
163 "fido/auth_token_requester_unittest.cc",
164 "fido/bio/enrollment_handler_unittest.cc",
165 "fido/ble_adapter_manager_unittest.cc",
166 "fido/cable/fido_ble_connection_unittest.cc",
167 "fido/cable/fido_ble_frames_unittest.cc",
168 "fido/cable/fido_ble_transaction_unittest.cc",
169 "fido/cable/fido_cable_device_unittest.cc",
170 "fido/cable/fido_cable_discovery_unittest.cc",
171 "fido/cable/fido_cable_handshake_handler_unittest.cc",
172 "fido/cable/v2_handshake_unittest.cc",
173 "fido/cbor_extract_unittest.cc",
174 "fido/credential_management_handler_unittest.cc",
175 "fido/ctap_request_unittest.cc",
176 "fido/ctap_response_unittest.cc",
177 "fido/fake_fido_discovery_unittest.cc",
178 "fido/fido_device_authenticator_unittest.cc",
179 "fido/fido_device_discovery_unittest.cc",
180 "fido/fido_parsing_utils_unittest.cc",
181 "fido/fido_request_handler_unittest.cc",
182 "fido/filter_unittest.cc",
183 "fido/get_assertion_handler_unittest.cc",
184 "fido/get_assertion_task_unittest.cc",
185 "fido/hid/fido_hid_message_unittest.cc",
186 "fido/large_blob_unittest.cc",
187 "fido/make_credential_handler_unittest.cc",
188 "fido/make_credential_task_unittest.cc",
189 "fido/pin_unittest.cc",
190 "fido/test_callback_receiver_unittest.cc",
191 "fido/u2f_command_constructor_unittest.cc",
192 "fido/u2f_register_operation_unittest.cc",
193 "fido/u2f_sign_operation_unittest.cc",
194 "fido/value_response_conversions_unittest.cc",
195 "fido/virtual_ctap2_device_unittest.cc",
196 "fido/virtual_fido_device_authenticator_unittest.cc",
197 "fido/virtual_u2f_device_unittest.cc",
201 "//device/fido:mocks",
202 "//services/data_decoder/public/cpp:test_support",
205 if (is_chromeos_lacros) {
206 deps += [ "//chromeos/startup" ]
210 data_deps += [ "fido/strings:fido_test_strings" ]
216 "fido/mac/authenticator_unittest.mm",
217 "fido/mac/browsing_data_deletion_unittest.mm",
218 "fido/mac/credential_metadata_unittest.cc",
219 "fido/mac/credential_store_unittest.mm",
220 "fido/mac/get_assertion_operation_unittest_mac.mm",
221 "fido/mac/icloud_keychain_unittest.mm",
222 "fido/mac/make_credential_operation_unittest_mac.mm",
223 "fido/mac/util_unittest.cc",
225 deps += [ "//device/fido:icloud_keychain_test_support" ]
230 "fido/win/authenticator_unittest.cc",
231 "fido/win/type_conversions_unittest.cc",
236 # Android doesn't compile.
237 # Linux, requires udev.
238 if (!is_linux_without_udev && !is_android && !is_ios) {
240 "fido/hid/fido_hid_device_unittest.cc",
241 "fido/hid/fido_hid_discovery_unittest.cc",
244 "//device/fido:test_support",
245 "//services/device/public/cpp:test_support",
251 "udev_linux/udev_unittest.cc",
252 "udev_linux/udev_watcher_unittest.cc",
255 "//device/udev_linux",
256 "//device/udev_linux:test_support",
262 ":bluetooth_test_java",
263 ":bluetooth_test_jni_headers",
269 "bluetooth/bluetooth_low_energy_scan_filter_unittest.cc",
270 "bluetooth/chromeos/bluetooth_connection_logger_unittest.cc",
271 "bluetooth/chromeos/bluetooth_utils_unittest.cc",
273 deps += [ "//chromeos/constants" ]
274 if (is_chromeos_ash) {
277 "//chromeos/ash/services/nearby/public/cpp/",
278 "//chromeos/ash/services/secure_channel/public/cpp/shared",
281 if (is_chromeos_lacros) {
282 deps += [ "//chromeos/lacros:test_support" ]
286 if ((is_chromeos || is_linux) && use_dbus) {
287 configs += [ "//build/config/linux/dbus" ]
290 "bluetooth/bluez/bluetooth_adapter_bluez_unittest.cc",
291 "bluetooth/bluez/bluetooth_adapter_profile_bluez_unittest.cc",
292 "bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc",
293 "bluetooth/bluez/bluetooth_bluez_unittest.cc",
294 "bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc",
295 "bluetooth/bluez/bluetooth_service_attribute_value_bluez_unittest.cc",
296 "bluetooth/bluez/bluetooth_service_record_bluez_unittest.cc",
297 "bluetooth/bluez/bluetooth_socket_bluez_unittest.cc",
298 "bluetooth/dbus/bluetooth_gatt_application_service_provider_unittest.cc",
299 "bluetooth/dbus/bluetooth_gatt_characteristic_service_provider_unittest.cc",
300 "bluetooth/floss/bluetooth_floss_unittest.cc",
301 "bluetooth/floss/bluetooth_gatt_floss_unittest.cc",
302 "bluetooth/floss/bluetooth_socket_floss_unittest.cc",
303 "bluetooth/floss/exported_callback_manager_unittest.cc",
304 "bluetooth/floss/floss_adapter_client_unittest.cc",
305 "bluetooth/floss/floss_admin_client_unittest.cc",
306 "bluetooth/floss/floss_advertiser_client_unittest.cc",
307 "bluetooth/floss/floss_battery_manager_client_unittest.cc",
308 "bluetooth/floss/floss_bluetooth_telephony_client_unittest.cc",
309 "bluetooth/floss/floss_dbus_client_unittest.cc",
310 "bluetooth/floss/floss_dbus_manager_unittest.cc",
311 "bluetooth/floss/floss_gatt_manager_client_unittest.cc",
312 "bluetooth/floss/floss_lescan_client_unittest.cc",
313 "bluetooth/floss/floss_manager_client_unittest.cc",
314 "bluetooth/floss/floss_socket_manager_unittest.cc",
315 "bluetooth/floss/floss_version_unittest.cc",
316 "bluetooth/test/bluetooth_test_bluez.cc",
317 "bluetooth/test/bluetooth_test_bluez.h",
322 "//dbus:test_support",
327 "bluetooth/dbus/bluetooth_advertisement_monitor_application_service_provider_unittest.cc",
328 "bluetooth/dbus/bluetooth_advertisement_monitor_service_provider_unittest.cc",
330 deps += [ "//services/data_decoder/public/mojom" ]
335 # Cast does not support GATT server mode.
337 "bluetooth/bluetooth_local_gatt_characteristic_unittest.cc",
338 "bluetooth/bluetooth_local_gatt_descriptor_unittest.cc",
339 "bluetooth/bluetooth_local_gatt_service_unittest.cc",
343 "bluetooth/cast/bluetooth_adapter_cast_unittest.cc",
344 "bluetooth/cast/bluetooth_utils_unittest.cc",
345 "bluetooth/test/bluetooth_test_cast.cc",
346 "bluetooth/test/bluetooth_test_cast.h",
350 "//chromecast/device/bluetooth:util",
351 "//chromecast/device/bluetooth/le",
352 "//chromecast/device/bluetooth/le:test_support",
353 "//chromecast/device/bluetooth/shlib:mock_shlib",
358 deps += [ "//third_party/ocmock" ]
359 ldflags = [ "-ObjC" ]
361 "CoreBluetooth.framework",
363 "Foundation.framework",
369 "IOBluetooth.framework",
370 "Security.framework",
371 "AuthenticationServices.framework",
377 "bluetooth/bluetooth_classic_win_fake.cc",
378 "bluetooth/bluetooth_classic_win_fake.h",
379 "bluetooth/test/fake_bluetooth_adapter_winrt.cc",
380 "bluetooth/test/fake_bluetooth_adapter_winrt.h",
381 "bluetooth/test/fake_bluetooth_le_advertisement_data_section_winrt.cc",
382 "bluetooth/test/fake_bluetooth_le_advertisement_data_section_winrt.h",
383 "bluetooth/test/fake_bluetooth_le_advertisement_publisher_status_changed_event_args_winrt.cc",
384 "bluetooth/test/fake_bluetooth_le_advertisement_publisher_status_changed_event_args_winrt.h",
385 "bluetooth/test/fake_bluetooth_le_advertisement_publisher_winrt.cc",
386 "bluetooth/test/fake_bluetooth_le_advertisement_publisher_winrt.h",
387 "bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.cc",
388 "bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.h",
389 "bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.cc",
390 "bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.h",
391 "bluetooth/test/fake_bluetooth_le_advertisement_winrt.cc",
392 "bluetooth/test/fake_bluetooth_le_advertisement_winrt.h",
393 "bluetooth/test/fake_bluetooth_le_device_winrt.cc",
394 "bluetooth/test/fake_bluetooth_le_device_winrt.h",
395 "bluetooth/test/fake_bluetooth_le_manufacturer_data_winrt.cc",
396 "bluetooth/test/fake_bluetooth_le_manufacturer_data_winrt.h",
397 "bluetooth/test/fake_device_information_custom_pairing_winrt.cc",
398 "bluetooth/test/fake_device_information_custom_pairing_winrt.h",
399 "bluetooth/test/fake_device_information_pairing_winrt.cc",
400 "bluetooth/test/fake_device_information_pairing_winrt.h",
401 "bluetooth/test/fake_device_information_winrt.cc",
402 "bluetooth/test/fake_device_information_winrt.h",
403 "bluetooth/test/fake_device_pairing_requested_event_args_winrt.cc",
404 "bluetooth/test/fake_device_pairing_requested_event_args_winrt.h",
405 "bluetooth/test/fake_device_pairing_result_winrt.cc",
406 "bluetooth/test/fake_device_pairing_result_winrt.h",
407 "bluetooth/test/fake_device_watcher_winrt.cc",
408 "bluetooth/test/fake_device_watcher_winrt.h",
409 "bluetooth/test/fake_gatt_characteristic_winrt.cc",
410 "bluetooth/test/fake_gatt_characteristic_winrt.h",
411 "bluetooth/test/fake_gatt_characteristics_result_winrt.cc",
412 "bluetooth/test/fake_gatt_characteristics_result_winrt.h",
413 "bluetooth/test/fake_gatt_descriptor_winrt.cc",
414 "bluetooth/test/fake_gatt_descriptor_winrt.h",
415 "bluetooth/test/fake_gatt_descriptors_result_winrt.cc",
416 "bluetooth/test/fake_gatt_descriptors_result_winrt.h",
417 "bluetooth/test/fake_gatt_device_service_winrt.cc",
418 "bluetooth/test/fake_gatt_device_service_winrt.h",
419 "bluetooth/test/fake_gatt_device_services_result_winrt.cc",
420 "bluetooth/test/fake_gatt_device_services_result_winrt.h",
421 "bluetooth/test/fake_gatt_read_result_winrt.cc",
422 "bluetooth/test/fake_gatt_read_result_winrt.h",
423 "bluetooth/test/fake_gatt_session_winrt.cc",
424 "bluetooth/test/fake_gatt_session_winrt.h",
425 "bluetooth/test/fake_gatt_value_changed_event_args_winrt.cc",
426 "bluetooth/test/fake_gatt_value_changed_event_args_winrt.h",
427 "bluetooth/test/fake_gatt_write_result_winrt.cc",
428 "bluetooth/test/fake_gatt_write_result_winrt.h",
429 "bluetooth/test/fake_radio_winrt.cc",
430 "bluetooth/test/fake_radio_winrt.h",
436 "vr/orientation/orientation_device_provider_unittest.cc",
437 "vr/orientation/orientation_device_unittest.cc",
438 "vr/util/fps_meter_unittest.cc",
439 "vr/util/sliding_average_unittest.cc",
440 "vr/util/stage_utils_unittest.cc",
441 "vr/vr_device_base_unittest.cc",
444 defines = [ "DEVICE_VR_IMPLEMENTATION" ]
448 "//device/vr:vr_fakes",
449 "//device/vr:vr_util",
450 "//device/vr/orientation",
451 "//device/vr/public/mojom:isolated_xr_service",
452 "//services/device/public/cpp/generic_sensor",
454 "//ui/display:test_support",
458 # Some gamepad tests require the HID service. Only build these tests on
459 # platforms where the HID service is enabled.
460 if (!is_android && !is_fuchsia && !is_ios) {
461 sources += [ "gamepad/nintendo_data_fetcher_unittest.cc" ]
464 "//services/device:test_support",
465 "//services/device/hid",
466 "//services/device/public/cpp:test_support",
471 deps += [ "//chromeos/dbus/u2f" ]
476 bluetooth_java_sources_needing_jni = [
477 "bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java",
478 "bluetooth/test/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothScanFilter.java",
481 generate_jni("bluetooth_test_jni_headers") {
483 sources = bluetooth_java_sources_needing_jni
486 android_library("bluetooth_test_java") {
489 sources = bluetooth_java_sources_needing_jni
492 "//components/location/android:location_java",
493 "//device/bluetooth:java",
494 "//third_party/android_sdk:android_test_mock_java",
495 "//third_party/androidx:androidx_annotation_annotation_java",
496 "//third_party/jni_zero:jni_zero_java",
500 ":bluetooth_test_javagen",
501 ":bluetooth_test_jni_headers",
505 robolectric_binary("device_junit_tests") {
507 "gamepad/android/junit/src/org/chromium/device/gamepad/GamepadDeviceTest.java",
508 "gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java",
511 "$google_play_services_package:google_play_services_base_java",
512 "$google_play_services_package:google_play_services_basement_java",
513 "$google_play_services_package:google_play_services_location_java",
514 "//base:base_java_test_support",
515 "//base:base_junit_test_support",
516 "//device/gamepad:java",
517 "//mojo/public/java:bindings_java",
518 "//third_party/androidx:androidx_annotation_annotation_java",
519 "//third_party/hamcrest:hamcrest_java",
521 srcjar_deps = [ "//device/gamepad:java_enums_srcjar" ]
524 java_cpp_enum("bluetooth_test_javagen") {
525 sources = [ "bluetooth/test/bluetooth_test.h" ]
529 if (is_win || is_linux || is_mac) {
530 test("passkey_enclave") {
532 sources = [ "fido/enclave/test/passkey_enclave.cc" ]
536 "//build/win:default_exe_manifest",
537 "//device/fido:enclave_service",
538 "//device/fido:fido",
542 test("passkey_enclave_client") {
544 sources = [ "fido/enclave/test/passkey_enclave_client.cc" ]
548 "//build/win:default_exe_manifest",
549 "//components/sync/protocol:protocol",
551 "//mojo/public/cpp/bindings",
552 "//services/cert_verifier:lib",
553 "//services/network:network_service",
554 "//services/network/public/cpp",