blob: 1df91d79d98dcbb434148e33b1f1857eb6ea7d2b [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 "battery/battery_status_manager_win_unittest.cc",
24 "battery/battery_status_service_unittest.cc",
25 "bluetooth/bluetooth_adapter_mac_unittest.mm",
tfarinacdc7e5d2015-02-23 09:52:2426 "bluetooth/bluetooth_adapter_unittest.cc",
27 "bluetooth/bluetooth_adapter_win_unittest.cc",
ortuno945c90d2015-09-01 01:47:0828 "bluetooth/bluetooth_advertisement_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2429 "bluetooth/bluetooth_device_unittest.cc",
30 "bluetooth/bluetooth_device_win_unittest.cc",
jpawlowskif54d01542015-04-13 22:24:4331 "bluetooth/bluetooth_discovery_filter_unittest.cc",
rkc3fb9aa6d2016-05-03 20:39:4432 "bluetooth/bluetooth_local_gatt_characteristic_unittest.cc",
33 "bluetooth/bluetooth_local_gatt_descriptor_unittest.cc",
rkc907af5d2016-05-10 00:20:0234 "bluetooth/bluetooth_local_gatt_service_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2435 "bluetooth/bluetooth_low_energy_win_unittest.cc",
rkc122239752016-04-20 23:59:0836 "bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc",
37 "bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc",
38 "bluetooth/bluetooth_remote_gatt_service_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2439 "bluetooth/bluetooth_service_record_win_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2440 "bluetooth/bluetooth_task_manager_win_unittest.cc",
41 "bluetooth/bluetooth_uuid_unittest.cc",
mbrunson32391c12016-11-18 23:42:1542 "bluetooth/device_unittest.cc",
ortunob755ff32016-08-25 21:29:3043 "bluetooth/string_util_icu_unittest.cc",
rkc3fb9aa6d2016-05-03 20:39:4444 "bluetooth/test/bluetooth_gatt_server_test.cc",
45 "bluetooth/test/bluetooth_gatt_server_test.h",
scheib545d7fd2015-06-30 22:26:5846 "bluetooth/test/bluetooth_test.cc",
47 "bluetooth/test/bluetooth_test.h",
48 "bluetooth/test/bluetooth_test_android.cc",
49 "bluetooth/test/bluetooth_test_android.h",
krstnmnlsn56d371032015-07-21 20:18:0750 "bluetooth/test/bluetooth_test_mac.h",
51 "bluetooth/test/bluetooth_test_mac.mm",
gogerald512935cc2016-01-27 01:11:1852 "bluetooth/test/bluetooth_test_win.cc",
53 "bluetooth/test/bluetooth_test_win.h",
jlebel620327d2016-06-20 13:01:0054 "bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h",
55 "bluetooth/test/mock_bluetooth_cbcharacteristic_mac.mm",
jlebel9bb8cf242017-01-10 01:29:0256 "bluetooth/test/mock_bluetooth_cbdescriptor_mac.h",
57 "bluetooth/test/mock_bluetooth_cbdescriptor_mac.mm",
jlebela58fd752016-03-14 10:33:2858 "bluetooth/test/mock_bluetooth_cbperipheral_mac.h",
59 "bluetooth/test/mock_bluetooth_cbperipheral_mac.mm",
jlebelc4b09782016-05-10 00:31:5860 "bluetooth/test/mock_bluetooth_cbservice_mac.h",
61 "bluetooth/test/mock_bluetooth_cbservice_mac.mm",
jlebela58fd752016-03-14 10:33:2862 "bluetooth/test/mock_bluetooth_central_manager_mac.h",
63 "bluetooth/test/mock_bluetooth_central_manager_mac.mm",
scheib42e6b49d2015-04-29 21:46:5764 "bluetooth/test/test_bluetooth_adapter_observer.cc",
65 "bluetooth/test/test_bluetooth_adapter_observer.h",
rkc3fb9aa6d2016-05-03 20:39:4466 "bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc",
67 "bluetooth/test/test_bluetooth_local_gatt_service_delegate.h",
reillygaaee8912017-03-23 22:16:0668 "bluetooth/uribeacon/uri_encoder_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",
ke.he303e0f92016-11-22 04:38:1371 "gamepad/public/interfaces/gamepad_struct_traits_unittest.cc",
alexander.shalamovd08cd092016-11-03 07:46:3072 "generic_sensor/platform_sensor_and_provider_unittest_win.cc",
maksim.sisovd14d9caa2016-09-28 11:10:2473 "generic_sensor/platform_sensor_provider_unittest.cc",
ke.he48ce2ae2017-02-02 15:31:3274 "sensors/data_fetcher_shared_memory_base_unittest.cc",
75 "sensors/sensor_manager_android_unittest.cc",
76 "sensors/sensor_manager_chromeos_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2477 "test/run_all_unittests.cc",
tfarinacdc7e5d2015-02-23 09:52:2478 ]
79
80 deps = [
81 "//base/test:test_support",
alexis.menardb39a30822016-09-30 15:14:3982 "//base/third_party/dynamic_annotations:dynamic_annotations",
83 "//device/base/synchronization",
tfarinacdc7e5d2015-02-23 09:52:2484 "//device/battery",
85 "//device/battery:mojo_bindings",
86 "//device/bluetooth",
brettw011138d2015-10-21 03:05:3887 "//device/bluetooth:mocks",
mbrunson32391c12016-11-18 23:42:1588 "//device/bluetooth:mojo",
reillygaaee8912017-03-23 22:16:0689 "//device/bluetooth/uribeacon",
bajonesb9bb4c42016-07-07 00:10:5190 "//device/gamepad",
91 "//device/gamepad:test_helpers",
juncai2f298a82017-04-18 03:51:3992 "//device/gamepad/public/cpp:shared_with_blink",
ke.he303e0f92016-11-22 04:38:1393 "//device/gamepad/public/interfaces",
94 "//device/gamepad/public/interfaces:gamepad_struct_traits_test",
maksim.sisovd14d9caa2016-09-28 11:10:2495 "//device/generic_sensor",
96 "//device/generic_sensor:testing",
mcasas4e216e72016-07-28 21:28:3897 "//device/geolocation:unittests",
scottmgc40e8822016-06-17 17:57:4898 "//device/power_save_blocker",
ke.he48ce2ae2017-02-02 15:31:3299 "//device/sensors",
blundell241fad6f2017-03-21 11:14:38100 "//device/sensors/public/cpp:full",
ke.he48ce2ae2017-02-02 15:31:32101 "//device/sensors/public/interfaces",
blundelld46e8832016-10-07 10:34:27102 "//device/wake_lock",
brettwbda835b2015-12-04 22:12:30103 "//mojo/common",
rockotc637caf9b2016-02-10 09:57:08104 "//mojo/edk/system",
rockot85dce0862015-11-13 01:33:59105 "//mojo/public/cpp/bindings",
tfarinacdc7e5d2015-02-23 09:52:24106 "//net",
107 "//testing/gmock",
108 "//testing/gtest",
ke.he303e0f92016-11-22 04:38:13109 "//third_party/WebKit/public:blink_headers",
reillyg872fd9fc2016-02-04 21:50:04110 "//tools/usb_gadget",
tfarinacdc7e5d2015-02-23 09:52:24111 "//url",
112 ]
113
markuso472a0202016-08-23 15:49:11114 if (is_linux && !is_chromeos && use_dbus) {
scheib7a4cf042015-03-31 04:33:44115 sources += [ "battery/battery_status_manager_linux_unittest.cc" ]
markuso472a0202016-08-23 15:49:11116 deps += [ "//dbus:test_support" ]
scheib7a4cf042015-03-31 04:33:44117 }
tfarinacdc7e5d2015-02-23 09:52:24118
maksim.sisov061d1132016-12-09 16:04:21119 if (!is_linux_without_udev) {
120 sources +=
121 [ "generic_sensor/platform_sensor_and_provider_unittest_linux.cc" ]
maksim.sisovc0876ac2016-11-04 22:54:12122 }
123
scheib7a4cf042015-03-31 04:33:44124 # HID and Serial:
scheibcfdca0e2015-04-01 05:27:58125 # Android doesn't compile.
scheib7a4cf042015-03-31 04:33:44126 # Linux, requires udev.
scheibcfdca0e2015-04-01 05:27:58127 if (!is_linux_without_udev && !is_android) {
scheib7a4cf042015-03-31 04:33:44128 sources += [
129 "hid/hid_connection_unittest.cc",
130 "hid/hid_device_filter_unittest.cc",
131 "hid/hid_report_descriptor_unittest.cc",
132 "hid/input_service_linux_unittest.cc",
133 "hid/test_report_descriptors.cc",
134 "hid/test_report_descriptors.h",
juncai923ede72015-07-30 22:58:30135 "serial/serial_io_handler_posix_unittest.cc",
piperc4263ec42017-04-25 02:30:44136 "u2f/u2f_apdu_unittest.cc",
piperc3a4044702017-03-20 21:36:01137 "u2f/u2f_hid_device_unittest.cc",
piperc4263ec42017-04-25 02:30:44138 "u2f/u2f_message_unittest.cc",
139 "u2f/u2f_register_unittest.cc",
140 "u2f/u2f_request_unittest.cc",
141 "u2f/u2f_sign_unittest.cc",
scheib7a4cf042015-03-31 04:33:44142 ]
143 deps += [
144 "//device/hid",
piperc3a4044702017-03-20 21:36:01145 "//device/hid:mocks",
scheib7a4cf042015-03-31 04:33:44146 "//device/serial",
147 "//device/serial:test_support",
piperc4263ec42017-04-25 02:30:44148 "//device/u2f",
149 "//device/u2f:mocks",
scheib7a4cf042015-03-31 04:33:44150 ]
151 }
152
153 if (use_udev) {
154 sources += [ "udev_linux/udev_unittest.cc" ]
155 deps += [ "//device/udev_linux" ]
156 }
157
reillygcf1af632015-11-18 16:42:58158 # USB does not compile on iOS.
159 if (!is_ios) {
scheibcfdca0e2015-04-01 05:27:58160 sources += [
reillygbadbc5412015-08-28 23:08:10161 "test/test_device_client.cc",
162 "test/test_device_client.h",
reillygaaee8912017-03-23 22:16:06163 "test/usb_test_gadget.h",
scheibcfdca0e2015-04-01 05:27:58164 "test/usb_test_gadget_impl.cc",
reillyg64c8f4f2016-02-10 23:29:20165 "usb/mojo/device_impl_unittest.cc",
166 "usb/mojo/device_manager_impl_unittest.cc",
reillyg1f45f772016-04-02 02:46:55167 "usb/mojo/mock_permission_provider.cc",
168 "usb/mojo/mock_permission_provider.h",
reillyg86549e52015-08-15 03:00:43169 "usb/usb_descriptors_unittest.cc",
scheibcfdca0e2015-04-01 05:27:58170 "usb/usb_device_filter_unittest.cc",
171 "usb/usb_device_handle_unittest.cc",
172 "usb/usb_ids_unittest.cc",
173 "usb/usb_service_unittest.cc",
reillyg86549e52015-08-15 03:00:43174 "usb/webusb_descriptors_unittest.cc",
scheibcfdca0e2015-04-01 05:27:58175 ]
176 deps += [
alexis.menard2fe63eaa2016-10-13 21:42:43177 "//device/base",
178 "//device/base:mocks",
scheibcfdca0e2015-04-01 05:27:58179 "//device/usb",
reillygcff166d2016-05-20 20:15:42180 "//device/usb:test_support",
reillyg64c8f4f2016-02-10 23:29:20181 "//device/usb/mojo",
182 "//device/usb/public/interfaces",
rhalavatid75e16c32017-03-03 15:08:24183 "//net:test_support",
scheibcfdca0e2015-04-01 05:27:58184 ]
185 }
186
reillygcf1af632015-11-18 16:42:58187 # UsbContext is a libusb-specific object.
reillygdee7c4ac2016-05-27 21:15:02188 if (is_mac || is_win) {
reillygcf1af632015-11-18 16:42:58189 sources += [ "usb/usb_context_unittest.cc" ]
brettwbda835b2015-12-04 22:12:30190 deps += [ "//third_party/libusb" ]
reillygcf1af632015-11-18 16:42:58191 }
192
scheib56010cc2015-06-25 01:29:47193 if (is_android) {
leon.han4e5d8102015-09-02 07:12:00194 sources -= [ "battery/battery_status_service_unittest.cc" ]
agrieve97176362015-12-01 16:36:19195 deps += [
196 ":bluetooth_test_java",
197 ":bluetooth_test_jni_headers",
mcasas4e216e72016-07-28 21:28:38198 "//device/geolocation:geolocation_java",
199 "//device/geolocation:geolocation_java_test_support",
ke.he48ce2ae2017-02-02 15:31:32200 "//device/sensors:java",
reillyg16001d92016-06-01 00:44:30201 "//device/usb:java",
agrieve97176362015-12-01 16:36:19202 ]
leon.han4e5d8102015-09-02 07:12:00203 deps -= [ "//device/battery" ]
scheib56010cc2015-06-25 01:29:47204 }
205
scheib7a4cf042015-03-31 04:33:44206 if (is_chromeos) {
tfarinacdc7e5d2015-02-23 09:52:24207 deps += [
208 "//chromeos",
209 "//chromeos:test_support",
210 "//chromeos:test_support_without_gmock",
tfarinacdc7e5d2015-02-23 09:52:24211 ]
212 }
213
dnicoara59acb3022015-12-17 18:13:16214 if ((is_chromeos || is_linux) && use_dbus) {
agrieve95ba4442016-04-25 15:47:13215 configs += [ "//build/config/linux/dbus" ]
rkc41077042015-11-06 07:20:58216
217 sources += [
rkc122239752016-04-20 23:59:08218 "bluetooth/bluez/bluetooth_adapter_profile_bluez_unittest.cc",
219 "bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc",
rkc122239752016-04-20 23:59:08220 "bluetooth/bluez/bluetooth_bluez_unittest.cc",
221 "bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc",
rkc2ffd5612016-06-24 02:00:22222 "bluetooth/bluez/bluetooth_service_attribute_value_bluez_unittest.cc",
223 "bluetooth/bluez/bluetooth_service_record_bluez_unittest.cc",
rkc122239752016-04-20 23:59:08224 "bluetooth/bluez/bluetooth_socket_bluez_unittest.cc",
rkca7a149d2016-04-29 08:15:37225 "bluetooth/dbus/bluetooth_gatt_application_service_provider_unittest.cc",
rkc519a20c62016-04-16 23:18:07226 "bluetooth/test/bluetooth_test_bluez.cc",
227 "bluetooth/test/bluetooth_test_bluez.h",
rkc41077042015-11-06 07:20:58228 ]
229
230 deps += [ "//dbus" ]
231 }
232
tfarinacdc7e5d2015-02-23 09:52:24233 if (is_mac) {
krstnmnlsn332a71cf2015-07-17 18:59:58234 deps += [ "//third_party/ocmock" ]
235 ldflags = [ "-ObjC" ]
rsesekdbb69c72016-05-11 17:26:35236 libs = [
237 "IOBluetooth.framework",
238 "IOKit.framework",
239 ]
erikchenceb2fff2015-04-27 17:50:54240
241 # In the OSX 10.10 SDK, CoreBluetooth became a top level framework.
242 # Previously, it was nested in IOBluetooth. In order for Chrome to run on
243 # OSes older than OSX 10.10, the top level CoreBluetooth framework must be
244 # weakly linked.
245 if (mac_sdk_version == "10.10") {
scheibdd941ba42015-10-27 05:40:12246 ldflags += [
247 "-weak_framework",
248 "CoreBluetooth",
249 ]
erikchenceb2fff2015-04-27 17:50:54250 }
tfarinacdc7e5d2015-02-23 09:52:24251 }
gogeraldcab31232016-02-03 21:20:33252
253 if (is_win) {
254 sources += [
gogeraldb8c706a2016-02-05 01:07:37255 "bluetooth/bluetooth_classic_win_fake.cc",
256 "bluetooth/bluetooth_classic_win_fake.h",
gogeraldcab31232016-02-03 21:20:33257 "bluetooth/bluetooth_low_energy_win_fake.cc",
258 "bluetooth/bluetooth_low_energy_win_fake.h",
259 ]
alexander.shalamovd08cd092016-11-03 07:46:30260
261 # Needed for "generic_sensor/platform_sensor_and_provider_unittest_win.cc"
alexander.shalamovededdbf2017-03-23 15:08:32262 libs = [
263 "propsys.lib",
264 "sensorsapi.lib",
265 ]
gogeraldcab31232016-02-03 21:20:33266 }
bajones7ab52ec32016-08-19 19:54:25267
cjgrant373c0682017-03-21 20:50:48268 if (enable_vr) {
bajones7ab52ec32016-08-19 19:54:25269 sources += [
270 "vr/vr_device_manager_unittest.cc",
shaobo.yan522153b2016-11-25 08:34:30271 "vr/vr_display_impl_unittest.cc",
bajones7ab52ec32016-08-19 19:54:25272 "vr/vr_service_impl_unittest.cc",
273 ]
274
275 deps += [
276 "//device/vr",
277 "//device/vr:fakes",
278 "//device/vr:mojo_bindings",
279 ]
280 }
tfarinacdc7e5d2015-02-23 09:52:24281}
scheib56010cc2015-06-25 01:29:47282
283if (is_android) {
scheib545d7fd2015-06-30 22:26:58284 bluetooth_java_sources_needing_jni = [ "bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java" ]
scheib56010cc2015-06-25 01:29:47285
286 generate_jni("bluetooth_test_jni_headers") {
287 sources = bluetooth_java_sources_needing_jni
288 jni_package = "bluetooth"
289 }
290
291 android_library("bluetooth_test_java") {
292 java_files = bluetooth_java_sources_needing_jni
293 deps = [
294 "//base:base_java",
ortuno5966ddb2016-07-01 02:07:25295 "//components/location/android:location_java",
scheib56010cc2015-06-25 01:29:47296 "//device/bluetooth:java",
ortunocc9b46d12016-08-25 16:47:23297 "//third_party/android_tools:android_support_annotations_java",
scheib56010cc2015-06-25 01:29:47298 ]
ortunocc9b46d12016-08-25 16:47:23299
300 srcjar_deps = [ ":bluetooth_test_javagen" ]
scheib56010cc2015-06-25 01:29:47301 }
bajonesb9bb4c42016-07-07 00:10:51302
303 junit_binary("device_junit_tests") {
alexander.shalamova0d87412016-09-16 06:59:14304 java_files = [
305 "gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java",
306 "generic_sensor/android/junit/src/org/chromium/device/sensors/PlatformSensorAndProviderTest.java",
mcasas649deb52017-04-28 01:55:52307 "geolocation/android/junit/src/org/chromium/device/geolocation/LocationProviderTest.java",
alexander.shalamov55ac6a4c2016-11-30 09:04:17308 "nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java",
alexander.shalamova0d87412016-09-16 06:59:14309 ]
bajonesb9bb4c42016-07-07 00:10:51310 deps = [
mcasas649deb52017-04-28 01:55:52311 "$google_play_services_package:google_play_services_base_java",
312 "$google_play_services_package:google_play_services_basement_java",
313 "$google_play_services_package:google_play_services_location_java",
bajonesb9bb4c42016-07-07 00:10:51314 "//base:base_java",
315 "//base:base_java_test_support",
316 "//device/gamepad:java",
alexander.shalamova0d87412016-09-16 06:59:14317 "//device/generic_sensor:java",
318 "//device/generic_sensor/public/interfaces:interfaces_java",
mcasas649deb52017-04-28 01:55:52319 "//device/geolocation:geolocation_java",
320 "//device/geolocation:geolocation_java_test_support",
alexander.shalamov55ac6a4c2016-11-30 09:04:17321 "//device/nfc:mojo_bindings_java",
322 "//device/nfc/android:java",
323 "//mojo/public/java:bindings_java",
peconn2e675b52016-08-01 15:56:19324 "//third_party/android_tools:android_support_annotations_java",
bajonesb9bb4c42016-07-07 00:10:51325 ]
326 srcjar_deps = [ "//device/gamepad:java_enums_srcjar" ]
327 }
ortunocc9b46d12016-08-25 16:47:23328
329 java_cpp_enum("bluetooth_test_javagen") {
330 sources = [
331 "bluetooth/test/bluetooth_test.h",
332 ]
333 }
scheib56010cc2015-06-25 01:29:47334}