[M120 Migration][Gamepad]Add gamepad event latency Test code
[platform/framework/web/chromium-efl.git] / device / BUILD.gn
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.
4
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")
9
10 if (is_android) {
11   import("//build/config/android/config.gni")
12   import("//build/config/android/rules.gni")
13   import("//third_party/jni_zero/jni_zero.gni")
14 }
15
16 if (is_mac) {
17   import("//build/config/mac/mac_sdk.gni")
18 }
19
20 is_linux_without_udev = (is_linux || is_chromeos) && !use_udev
21
22 test("device_unittests") {
23   sources = [
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",
64   ]
65
66   if (is_apple) {
67     sources += [
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",
82     ]
83   }
84
85   if (is_mac) {
86     sources += [ "bluetooth/bluetooth_adapter_mac_unittest.mm" ]
87   }
88
89   if (is_android) {
90     sources += [
91       "bluetooth/bluetooth_adapter_android_unittest.cc",
92       "bluetooth/test/bluetooth_test_android.cc",
93       "bluetooth/test/bluetooth_test_android.h",
94     ]
95   }
96
97   if (is_win) {
98     sources += [
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",
106     ]
107   }
108
109   if (is_fuchsia) {
110     sources += [
111       "bluetooth/test/bluetooth_test_fuchsia.cc",
112       "bluetooth/test/bluetooth_test_fuchsia.h",
113     ]
114   }
115
116   deps = [
117     "//base",
118     "//base/test:test_support",
119     "//base/third_party/dynamic_annotations:dynamic_annotations",
120     "//build:chromeos_buildflags",
121     "//components/apdu",
122     "//components/cbor",
123     "//components/device_event_log",
124     "//device/base",
125     "//device/base/synchronization",
126     "//device/bluetooth",
127     "//device/bluetooth:deprecated_experimental_mojo",
128     "//device/bluetooth:fake_bluetooth",
129     "//device/bluetooth:mocks",
130     "//device/gamepad",
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",
138     "//net",
139     "//testing/gmock",
140     "//testing/gtest",
141     "//third_party/blink/public:blink_headers",
142     "//ui/base",
143     "//url",
144   ]
145
146   data_deps = [
147     "bluetooth/strings:bluetooth_test_strings",
148     "//testing/buildbot/filters:device_unittests_filters",
149     "//ui/resources:ui_test_pak_data",
150   ]
151
152   if (!is_ios) {
153     deps += [
154       "//device/fido",
155       "//device/fido:test_support",
156     ]
157   }
158
159   # Most of the FIDO implementation is not compiled in for Android.
160   if (!is_android && !is_ios) {
161     sources += [
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",
198     ]
199
200     deps += [
201       "//device/fido:mocks",
202       "//services/data_decoder/public/cpp:test_support",
203     ]
204
205     if (is_chromeos_lacros) {
206       deps += [ "//chromeos/startup" ]
207     }
208
209     if (is_mac) {
210       data_deps += [ "fido/strings:fido_test_strings" ]
211     }
212   }
213
214   if (is_mac) {
215     sources += [
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",
224     ]
225     deps += [ "//device/fido:icloud_keychain_test_support" ]
226   }
227
228   if (is_win) {
229     sources += [
230       "fido/win/authenticator_unittest.cc",
231       "fido/win/type_conversions_unittest.cc",
232     ]
233   }
234
235   # FIDO HID:
236   # Android doesn't compile.
237   # Linux, requires udev.
238   if (!is_linux_without_udev && !is_android && !is_ios) {
239     sources += [
240       "fido/hid/fido_hid_device_unittest.cc",
241       "fido/hid/fido_hid_discovery_unittest.cc",
242     ]
243     deps += [
244       "//device/fido:test_support",
245       "//services/device/public/cpp:test_support",
246     ]
247   }
248
249   if (use_udev) {
250     sources += [
251       "udev_linux/udev_unittest.cc",
252       "udev_linux/udev_watcher_unittest.cc",
253     ]
254     deps += [
255       "//device/udev_linux",
256       "//device/udev_linux:test_support",
257     ]
258   }
259
260   if (is_android) {
261     deps += [
262       ":bluetooth_test_java",
263       ":bluetooth_test_jni_headers",
264     ]
265   }
266
267   if (is_chromeos) {
268     sources += [
269       "bluetooth/bluetooth_low_energy_scan_filter_unittest.cc",
270       "bluetooth/chromeos/bluetooth_connection_logger_unittest.cc",
271       "bluetooth/chromeos/bluetooth_utils_unittest.cc",
272     ]
273     deps += [ "//chromeos/constants" ]
274     if (is_chromeos_ash) {
275       deps += [
276         "//ash/constants",
277         "//chromeos/ash/services/nearby/public/cpp/",
278         "//chromeos/ash/services/secure_channel/public/cpp/shared",
279       ]
280     }
281     if (is_chromeos_lacros) {
282       deps += [ "//chromeos/lacros:test_support" ]
283     }
284   }
285
286   if ((is_chromeos || is_linux) && use_dbus) {
287     configs += [ "//build/config/linux/dbus" ]
288
289     sources += [
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",
318     ]
319
320     deps += [
321       "//dbus",
322       "//dbus:test_support",
323     ]
324
325     if (is_chromeos) {
326       sources += [
327         "bluetooth/dbus/bluetooth_advertisement_monitor_application_service_provider_unittest.cc",
328         "bluetooth/dbus/bluetooth_advertisement_monitor_service_provider_unittest.cc",
329       ]
330       deps += [ "//services/data_decoder/public/mojom" ]
331     }
332   }
333
334   if (is_castos) {
335     # Cast does not support GATT server mode.
336     sources -= [
337       "bluetooth/bluetooth_local_gatt_characteristic_unittest.cc",
338       "bluetooth/bluetooth_local_gatt_descriptor_unittest.cc",
339       "bluetooth/bluetooth_local_gatt_service_unittest.cc",
340     ]
341
342     sources += [
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",
347     ]
348
349     deps += [
350       "//chromecast/device/bluetooth:util",
351       "//chromecast/device/bluetooth/le",
352       "//chromecast/device/bluetooth/le:test_support",
353       "//chromecast/device/bluetooth/shlib:mock_shlib",
354     ]
355   }
356
357   if (is_apple) {
358     deps += [ "//third_party/ocmock" ]
359     ldflags = [ "-ObjC" ]
360     frameworks = [
361       "CoreBluetooth.framework",
362       "IOKit.framework",
363       "Foundation.framework",
364     ]
365   }
366
367   if (is_mac) {
368     frameworks += [
369       "IOBluetooth.framework",
370       "Security.framework",
371       "AuthenticationServices.framework",
372     ]
373   }
374
375   if (is_win) {
376     sources += [
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",
431     ]
432   }
433
434   if (enable_vr) {
435     sources += [
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",
442     ]
443
444     defines = [ "DEVICE_VR_IMPLEMENTATION" ]
445
446     deps += [
447       "//device/vr",
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",
453       "//ui/display",
454       "//ui/display:test_support",
455     ]
456   }
457
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" ]
462
463     deps += [
464       "//services/device:test_support",
465       "//services/device/hid",
466       "//services/device/public/cpp:test_support",
467     ]
468   }
469
470   if (is_chromeos) {
471     deps += [ "//chromeos/dbus/u2f" ]
472   }
473 }
474
475 if (is_android) {
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",
479   ]
480
481   generate_jni("bluetooth_test_jni_headers") {
482     testonly = true
483     sources = bluetooth_java_sources_needing_jni
484   }
485
486   android_library("bluetooth_test_java") {
487     testonly = true
488
489     sources = bluetooth_java_sources_needing_jni
490     deps = [
491       "//base:base_java",
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",
497     ]
498
499     srcjar_deps = [
500       ":bluetooth_test_javagen",
501       ":bluetooth_test_jni_headers",
502     ]
503   }
504
505   robolectric_binary("device_junit_tests") {
506     sources = [
507       "gamepad/android/junit/src/org/chromium/device/gamepad/GamepadDeviceTest.java",
508       "gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java",
509     ]
510     deps = [
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",
520     ]
521     srcjar_deps = [ "//device/gamepad:java_enums_srcjar" ]
522   }
523
524   java_cpp_enum("bluetooth_test_javagen") {
525     sources = [ "bluetooth/test/bluetooth_test.h" ]
526   }
527 }
528
529 if (is_win || is_linux || is_mac) {
530   test("passkey_enclave") {
531     testonly = true
532     sources = [ "fido/enclave/test/passkey_enclave.cc" ]
533
534     deps = [
535       "//base",
536       "//build/win:default_exe_manifest",
537       "//device/fido:enclave_service",
538       "//device/fido:fido",
539     ]
540   }
541
542   test("passkey_enclave_client") {
543     testonly = true
544     sources = [ "fido/enclave/test/passkey_enclave_client.cc" ]
545
546     deps = [
547       "//base",
548       "//build/win:default_exe_manifest",
549       "//components/sync/protocol:protocol",
550       "//device/fido",
551       "//mojo/public/cpp/bindings",
552       "//services/cert_verifier:lib",
553       "//services/network:network_service",
554       "//services/network/public/cpp",
555     ]
556   }
557 }