blob: 717b7f2f3de8af5c82c3981651051ca0ea7e37a7 [file] [log] [blame]
tfarinacdc7e5d2015-02-23 09:52:241# Copyright 2015 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
mthiesse4cb289142017-04-25 23:57:335import("vr/features/features.gni")
tfarinacdc7e5d2015-02-23 09:52:246import("//build/config/features.gni")
7import("//testing/test.gni")
8
scheib56010cc2015-06-25 01:29:479if (is_android) {
mcasas649deb52017-04-28 01:55:5210 import("//build/config/android/config.gni")
scheib56010cc2015-06-25 01:29:4711 import("//build/config/android/rules.gni") # For generate_jni().
12}
13
erikchenceb2fff2015-04-27 17:50:5414if (is_mac) {
15 import("//build/config/mac/mac_sdk.gni")
16}
17
scheib7a4cf042015-03-31 04:33:4418is_linux_without_udev = is_linux && !use_udev
scheib7a4cf042015-03-31 04:33:4419
tfarinacdc7e5d2015-02-23 09:52:2420test("device_unittests") {
21 sources = [
alexis.menardb39a30822016-09-30 15:14:3922 "base/synchronization/one_writer_seqlock_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2423 "bluetooth/bluetooth_adapter_mac_unittest.mm",
tfarinacdc7e5d2015-02-23 09:52:2424 "bluetooth/bluetooth_adapter_unittest.cc",
25 "bluetooth/bluetooth_adapter_win_unittest.cc",
ortuno945c90d2015-09-01 01:47:0826 "bluetooth/bluetooth_advertisement_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2427 "bluetooth/bluetooth_device_unittest.cc",
28 "bluetooth/bluetooth_device_win_unittest.cc",
jpawlowskif54d01542015-04-13 22:24:4329 "bluetooth/bluetooth_discovery_filter_unittest.cc",
rkc3fb9aa6d2016-05-03 20:39:4430 "bluetooth/bluetooth_local_gatt_characteristic_unittest.cc",
31 "bluetooth/bluetooth_local_gatt_descriptor_unittest.cc",
rkc907af5d2016-05-10 00:20:0232 "bluetooth/bluetooth_local_gatt_service_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2433 "bluetooth/bluetooth_low_energy_win_unittest.cc",
rkc122239752016-04-20 23:59:0834 "bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc",
35 "bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc",
36 "bluetooth/bluetooth_remote_gatt_service_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2437 "bluetooth/bluetooth_service_record_win_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2438 "bluetooth/bluetooth_task_manager_win_unittest.cc",
39 "bluetooth/bluetooth_uuid_unittest.cc",
mbrunson32391c12016-11-18 23:42:1540 "bluetooth/device_unittest.cc",
ortunob755ff32016-08-25 21:29:3041 "bluetooth/string_util_icu_unittest.cc",
rkc3fb9aa6d2016-05-03 20:39:4442 "bluetooth/test/bluetooth_gatt_server_test.cc",
43 "bluetooth/test/bluetooth_gatt_server_test.h",
scheib545d7fd2015-06-30 22:26:5844 "bluetooth/test/bluetooth_test.cc",
45 "bluetooth/test/bluetooth_test.h",
46 "bluetooth/test/bluetooth_test_android.cc",
47 "bluetooth/test/bluetooth_test_android.h",
krstnmnlsn56d371032015-07-21 20:18:0748 "bluetooth/test/bluetooth_test_mac.h",
49 "bluetooth/test/bluetooth_test_mac.mm",
gogerald512935cc2016-01-27 01:11:1850 "bluetooth/test/bluetooth_test_win.cc",
51 "bluetooth/test/bluetooth_test_win.h",
jlebel620327d2016-06-20 13:01:0052 "bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h",
53 "bluetooth/test/mock_bluetooth_cbcharacteristic_mac.mm",
jlebel9bb8cf242017-01-10 01:29:0254 "bluetooth/test/mock_bluetooth_cbdescriptor_mac.h",
55 "bluetooth/test/mock_bluetooth_cbdescriptor_mac.mm",
jlebela58fd752016-03-14 10:33:2856 "bluetooth/test/mock_bluetooth_cbperipheral_mac.h",
57 "bluetooth/test/mock_bluetooth_cbperipheral_mac.mm",
jlebelc4b09782016-05-10 00:31:5858 "bluetooth/test/mock_bluetooth_cbservice_mac.h",
59 "bluetooth/test/mock_bluetooth_cbservice_mac.mm",
jlebela58fd752016-03-14 10:33:2860 "bluetooth/test/mock_bluetooth_central_manager_mac.h",
61 "bluetooth/test/mock_bluetooth_central_manager_mac.mm",
scheib42e6b49d2015-04-29 21:46:5762 "bluetooth/test/test_bluetooth_adapter_observer.cc",
63 "bluetooth/test/test_bluetooth_adapter_observer.h",
rkc3fb9aa6d2016-05-03 20:39:4464 "bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc",
65 "bluetooth/test/test_bluetooth_local_gatt_service_delegate.h",
reillygaaee8912017-03-23 22:16:0666 "bluetooth/uribeacon/uri_encoder_unittest.cc",
Jun Choid159e2e2018-01-05 20:50:5967 "ctap/ctap_request_unittest.cc",
Matt Reynolds7c498e52017-12-06 22:06:2468 "gamepad/abstract_haptic_gamepad_unittest.cc",
bajonesb9bb4c42016-07-07 00:10:5169 "gamepad/gamepad_provider_unittest.cc",
ke.hebee6a642016-12-10 01:56:1970 "gamepad/gamepad_service_unittest.cc",
Reilly Grantfa93b142018-02-01 02:13:4871 "gamepad/public/mojom/gamepad_mojom_traits_unittest.cc",
ke.he48ce2ae2017-02-02 15:31:3272 "sensors/data_fetcher_shared_memory_base_unittest.cc",
73 "sensors/sensor_manager_android_unittest.cc",
74 "sensors/sensor_manager_chromeos_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2475 "test/run_all_unittests.cc",
Reilly Grant5ac479c2017-10-03 16:57:3776 "u2f/u2f_apdu_unittest.cc",
jdoerriec9396bf12017-12-11 13:42:4177 "u2f/u2f_ble_connection_unittest.cc",
jdoerrieab9780a2017-12-22 16:33:0378 "u2f/u2f_ble_device_unittest.cc",
Pavel Kalinnikov21b4a032017-09-29 14:30:3979 "u2f/u2f_ble_frames_unittest.cc",
jdoerriec625ef802017-10-13 09:52:2780 "u2f/u2f_discovery_unittest.cc",
Reilly Grant5ac479c2017-10-03 16:57:3781 "u2f/u2f_message_unittest.cc",
jdoerriec625ef802017-10-13 09:52:2782 "u2f/u2f_register_unittest.cc",
83 "u2f/u2f_request_unittest.cc",
84 "u2f/u2f_sign_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2485 ]
86
87 deps = [
88 "//base/test:test_support",
alexis.menardb39a30822016-09-30 15:14:3989 "//base/third_party/dynamic_annotations:dynamic_annotations",
Kim Paulhamus35995bb62018-01-05 11:47:0490 "//components/cbor",
alexis.menardb39a30822016-09-30 15:14:3991 "//device/base/synchronization",
tfarinacdc7e5d2015-02-23 09:52:2492 "//device/bluetooth",
Vincent Scheibdbe693bee2017-12-06 00:54:1893 "//device/bluetooth:deprecated_experimental_mojo",
brettw011138d2015-10-21 03:05:3894 "//device/bluetooth:mocks",
reillygaaee8912017-03-23 22:16:0695 "//device/bluetooth/uribeacon",
Jun Choid159e2e2018-01-05 20:50:5996 "//device/ctap",
bajonesb9bb4c42016-07-07 00:10:5197 "//device/gamepad",
98 "//device/gamepad:test_helpers",
juncai2f298a82017-04-18 03:51:3999 "//device/gamepad/public/cpp:shared_with_blink",
Reilly Grantfa93b142018-02-01 02:13:48100 "//device/gamepad/public/mojom",
101 "//device/gamepad/public/mojom:gamepad_mojom_traits_test",
mcasas4e216e72016-07-28 21:28:38102 "//device/geolocation:unittests",
ke.he48ce2ae2017-02-02 15:31:32103 "//device/sensors",
blundell241fad6f2017-03-21 11:14:38104 "//device/sensors/public/cpp:full",
Reilly Grantfa93b142018-02-01 02:13:48105 "//device/sensors/public/mojom",
Pavel Kalinnikov21b4a032017-09-29 14:30:39106 "//device/u2f",
Reilly Grant5ac479c2017-10-03 16:57:37107 "//device/u2f:mocks",
brettwbda835b2015-12-04 22:12:30108 "//mojo/common",
rockotc637caf9b2016-02-10 09:57:08109 "//mojo/edk/system",
rockot85dce0862015-11-13 01:33:59110 "//mojo/public/cpp/bindings",
tfarinacdc7e5d2015-02-23 09:52:24111 "//net",
112 "//testing/gmock",
113 "//testing/gtest",
ke.he303e0f92016-11-22 04:38:13114 "//third_party/WebKit/public:blink_headers",
reillyg872fd9fc2016-02-04 21:50:04115 "//tools/usb_gadget",
tfarinacdc7e5d2015-02-23 09:52:24116 "//url",
117 ]
118
Ke He624b52d2017-11-09 13:45:09119 # U2F and Serial:
scheibcfdca0e2015-04-01 05:27:58120 # Android doesn't compile.
scheib7a4cf042015-03-31 04:33:44121 # Linux, requires udev.
scheibcfdca0e2015-04-01 05:27:58122 if (!is_linux_without_udev && !is_android) {
scheib7a4cf042015-03-31 04:33:44123 sources += [
piperc3a4044702017-03-20 21:36:01124 "u2f/u2f_hid_device_unittest.cc",
jdoerriec625ef802017-10-13 09:52:27125 "u2f/u2f_hid_discovery_unittest.cc",
scheib7a4cf042015-03-31 04:33:44126 ]
127 deps += [
Kim Paulhamus40de29e42017-12-07 04:14:08128 "//device/u2f:test_support",
Ke He624b52d2017-11-09 13:45:09129 "//services/device/public/cpp/hid",
130 "//services/device/public/interfaces",
Ke He5c1e93a32017-10-05 04:27:35131 "//services/service_manager/public/cpp",
132 "//services/service_manager/public/interfaces",
scheib7a4cf042015-03-31 04:33:44133 ]
Ke He624b52d2017-11-09 13:45:09134
135 # Serial is supported in below platforms. See //device/servial/BUILD.gn
136 if (is_win || is_linux || is_mac) {
Vincent Scheibdbe693bee2017-12-06 00:54:18137 sources += [ "serial/serial_io_handler_posix_unittest.cc" ]
138 deps += [ "//device/serial" ]
Ke He624b52d2017-11-09 13:45:09139 }
scheib7a4cf042015-03-31 04:33:44140 }
141
142 if (use_udev) {
143 sources += [ "udev_linux/udev_unittest.cc" ]
144 deps += [ "//device/udev_linux" ]
145 }
146
reillygcf1af632015-11-18 16:42:58147 # USB does not compile on iOS.
148 if (!is_ios) {
scheibcfdca0e2015-04-01 05:27:58149 sources += [
reillygbadbc5412015-08-28 23:08:10150 "test/test_device_client.cc",
151 "test/test_device_client.h",
reillyg64c8f4f2016-02-10 23:29:20152 "usb/mojo/device_impl_unittest.cc",
153 "usb/mojo/device_manager_impl_unittest.cc",
reillyg1f45f772016-04-02 02:46:55154 "usb/mojo/mock_permission_provider.cc",
155 "usb/mojo/mock_permission_provider.h",
Reilly Grant7f162c92017-06-10 00:23:47156 "usb/public/cpp/filter_utils_unittest.cc",
reillyg86549e52015-08-15 03:00:43157 "usb/usb_descriptors_unittest.cc",
scheibcfdca0e2015-04-01 05:27:58158 "usb/usb_device_handle_unittest.cc",
scheibcfdca0e2015-04-01 05:27:58159 "usb/usb_service_unittest.cc",
reillyg86549e52015-08-15 03:00:43160 "usb/webusb_descriptors_unittest.cc",
scheibcfdca0e2015-04-01 05:27:58161 ]
162 deps += [
Ke He624b52d2017-11-09 13:45:09163 ":usb_test_gadget",
alexis.menard2fe63eaa2016-10-13 21:42:43164 "//device/base",
165 "//device/base:mocks",
scheibcfdca0e2015-04-01 05:27:58166 "//device/usb",
reillygcff166d2016-05-20 20:15:42167 "//device/usb:test_support",
reillyg64c8f4f2016-02-10 23:29:20168 "//device/usb/mojo",
Reilly Grant7f162c92017-06-10 00:23:47169 "//device/usb/public/cpp",
Reilly Grantfa93b142018-02-01 02:13:48170 "//device/usb/public/mojom",
rhalavatid75e16c32017-03-03 15:08:24171 "//net:test_support",
scheibcfdca0e2015-04-01 05:27:58172 ]
Reilly Grant5ac479c2017-10-03 16:57:37173
174 if (!is_android) {
Samuel Huang2cb0922d2017-10-30 18:37:00175 sources += [ "usb/usb_ids_unittest.cc" ]
Reilly Grant5ac479c2017-10-03 16:57:37176 }
scheibcfdca0e2015-04-01 05:27:58177 }
178
reillygcf1af632015-11-18 16:42:58179 # UsbContext is a libusb-specific object.
reillygdee7c4ac2016-05-27 21:15:02180 if (is_mac || is_win) {
reillygcf1af632015-11-18 16:42:58181 sources += [ "usb/usb_context_unittest.cc" ]
brettwbda835b2015-12-04 22:12:30182 deps += [ "//third_party/libusb" ]
reillygcf1af632015-11-18 16:42:58183 }
184
scheib56010cc2015-06-25 01:29:47185 if (is_android) {
agrieve97176362015-12-01 16:36:19186 deps += [
187 ":bluetooth_test_java",
188 ":bluetooth_test_jni_headers",
mcasas4e216e72016-07-28 21:28:38189 "//device/geolocation:geolocation_java",
190 "//device/geolocation:geolocation_java_test_support",
ke.he48ce2ae2017-02-02 15:31:32191 "//device/sensors:java",
reillyg16001d92016-06-01 00:44:30192 "//device/usb:java",
agrieve97176362015-12-01 16:36:19193 ]
scheib56010cc2015-06-25 01:29:47194 }
195
scheib7a4cf042015-03-31 04:33:44196 if (is_chromeos) {
tfarinacdc7e5d2015-02-23 09:52:24197 deps += [
198 "//chromeos",
199 "//chromeos:test_support",
200 "//chromeos:test_support_without_gmock",
tfarinacdc7e5d2015-02-23 09:52:24201 ]
202 }
203
dnicoara59acb3022015-12-17 18:13:16204 if ((is_chromeos || is_linux) && use_dbus) {
agrieve95ba4442016-04-25 15:47:13205 configs += [ "//build/config/linux/dbus" ]
rkc41077042015-11-06 07:20:58206
207 sources += [
rkc122239752016-04-20 23:59:08208 "bluetooth/bluez/bluetooth_adapter_profile_bluez_unittest.cc",
209 "bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc",
rkc122239752016-04-20 23:59:08210 "bluetooth/bluez/bluetooth_bluez_unittest.cc",
211 "bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc",
rkc2ffd5612016-06-24 02:00:22212 "bluetooth/bluez/bluetooth_service_attribute_value_bluez_unittest.cc",
213 "bluetooth/bluez/bluetooth_service_record_bluez_unittest.cc",
rkc122239752016-04-20 23:59:08214 "bluetooth/bluez/bluetooth_socket_bluez_unittest.cc",
rkca7a149d2016-04-29 08:15:37215 "bluetooth/dbus/bluetooth_gatt_application_service_provider_unittest.cc",
rkc519a20c62016-04-16 23:18:07216 "bluetooth/test/bluetooth_test_bluez.cc",
217 "bluetooth/test/bluetooth_test_bluez.h",
rkc41077042015-11-06 07:20:58218 ]
219
220 deps += [ "//dbus" ]
221 }
222
Pavel Kalinnikov9f6591002017-11-01 22:09:18223 # BLE discovery: works on Linux.
224 if (is_linux) {
225 sources += [ "u2f/u2f_ble_discovery_unittest.cc" ]
226 }
227
tfarinacdc7e5d2015-02-23 09:52:24228 if (is_mac) {
krstnmnlsn332a71cf2015-07-17 18:59:58229 deps += [ "//third_party/ocmock" ]
230 ldflags = [ "-ObjC" ]
rsesekdbb69c72016-05-11 17:26:35231 libs = [
232 "IOBluetooth.framework",
233 "IOKit.framework",
234 ]
erikchenceb2fff2015-04-27 17:50:54235
236 # In the OSX 10.10 SDK, CoreBluetooth became a top level framework.
237 # Previously, it was nested in IOBluetooth. In order for Chrome to run on
238 # OSes older than OSX 10.10, the top level CoreBluetooth framework must be
239 # weakly linked.
240 if (mac_sdk_version == "10.10") {
scheibdd941ba42015-10-27 05:40:12241 ldflags += [
242 "-weak_framework",
243 "CoreBluetooth",
244 ]
erikchenceb2fff2015-04-27 17:50:54245 }
tfarinacdc7e5d2015-02-23 09:52:24246 }
gogeraldcab31232016-02-03 21:20:33247
248 if (is_win) {
249 sources += [
gogeraldb8c706a2016-02-05 01:07:37250 "bluetooth/bluetooth_classic_win_fake.cc",
251 "bluetooth/bluetooth_classic_win_fake.h",
gogeraldcab31232016-02-03 21:20:33252 "bluetooth/bluetooth_low_energy_win_fake.cc",
253 "bluetooth/bluetooth_low_energy_win_fake.h",
254 ]
255 }
bajones7ab52ec32016-08-19 19:54:25256
Ian Vollick3ecad9bc2017-09-07 02:44:48257 if (enable_vr && is_android) {
Michael Thiessen21e56152017-10-16 18:55:17258 sources += [
Anna Maria114d35052017-12-08 23:13:29259 "vr/orientation/orientation_device_provider_unittest.cc",
260 "vr/orientation/orientation_device_unittest.cc",
Michael Thiessen21e56152017-10-16 18:55:17261 "vr/vr_device_base_unittest.cc",
262 "vr/vr_display_impl_unittest.cc",
263 ]
bajones7ab52ec32016-08-19 19:54:25264
265 deps += [
266 "//device/vr",
267 "//device/vr:fakes",
Michael Thiessen12607752017-09-05 19:12:07268 "//device/vr:java",
Reilly Grantfa93b142018-02-01 02:13:48269 "//device/vr/public/mojom",
Anna Maria114d35052017-12-08 23:13:29270 "//services/device/public/cpp/generic_sensor",
271 "//ui/display",
bajones7ab52ec32016-08-19 19:54:25272 ]
273 }
tfarinacdc7e5d2015-02-23 09:52:24274}
scheib56010cc2015-06-25 01:29:47275
Ke He624b52d2017-11-09 13:45:09276source_set("usb_test_gadget") {
277 testonly = true
278
279 sources = [
280 "test/usb_test_gadget.h",
281 "test/usb_test_gadget_impl.cc",
282 ]
283
284 deps = [
285 "//device/base",
286 "//device/usb",
287 "//net:test_support",
288 ]
289}
290
scheib56010cc2015-06-25 01:29:47291if (is_android) {
Matt Reynolds7c498e52017-12-06 22:06:24292 bluetooth_java_sources_needing_jni = [
293 "bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java",
294 ]
scheib56010cc2015-06-25 01:29:47295
296 generate_jni("bluetooth_test_jni_headers") {
297 sources = bluetooth_java_sources_needing_jni
298 jni_package = "bluetooth"
299 }
300
301 android_library("bluetooth_test_java") {
302 java_files = bluetooth_java_sources_needing_jni
303 deps = [
304 "//base:base_java",
ortuno5966ddb2016-07-01 02:07:25305 "//components/location/android:location_java",
scheib56010cc2015-06-25 01:29:47306 "//device/bluetooth:java",
ortunocc9b46d12016-08-25 16:47:23307 "//third_party/android_tools:android_support_annotations_java",
scheib56010cc2015-06-25 01:29:47308 ]
ortunocc9b46d12016-08-25 16:47:23309
310 srcjar_deps = [ ":bluetooth_test_javagen" ]
scheib56010cc2015-06-25 01:29:47311 }
bajonesb9bb4c42016-07-07 00:10:51312
313 junit_binary("device_junit_tests") {
alexander.shalamova0d87412016-09-16 06:59:14314 java_files = [
315 "gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java",
mcasas649deb52017-04-28 01:55:52316 "geolocation/android/junit/src/org/chromium/device/geolocation/LocationProviderTest.java",
alexander.shalamova0d87412016-09-16 06:59:14317 ]
bajonesb9bb4c42016-07-07 00:10:51318 deps = [
mcasas649deb52017-04-28 01:55:52319 "$google_play_services_package:google_play_services_base_java",
320 "$google_play_services_package:google_play_services_basement_java",
321 "$google_play_services_package:google_play_services_location_java",
bajonesb9bb4c42016-07-07 00:10:51322 "//base:base_java",
323 "//base:base_java_test_support",
324 "//device/gamepad:java",
mcasas649deb52017-04-28 01:55:52325 "//device/geolocation:geolocation_java",
326 "//device/geolocation:geolocation_java_test_support",
alexander.shalamov55ac6a4c2016-11-30 09:04:17327 "//mojo/public/java:bindings_java",
peconn2e675b52016-08-01 15:56:19328 "//third_party/android_tools:android_support_annotations_java",
bajonesb9bb4c42016-07-07 00:10:51329 ]
330 srcjar_deps = [ "//device/gamepad:java_enums_srcjar" ]
331 }
ortunocc9b46d12016-08-25 16:47:23332
333 java_cpp_enum("bluetooth_test_javagen") {
334 sources = [
335 "bluetooth/test/bluetooth_test.h",
336 ]
337 }
scheib56010cc2015-06-25 01:29:47338}