blob: 2f959b71e4f7656c48c3ca53ee682e694676b6c2 [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
5import("//build/config/features.gni")
6import("//testing/test.gni")
7
scheib56010cc2015-06-25 01:29:478if (is_android) {
9 import("//build/config/android/rules.gni") # For generate_jni().
10}
11
erikchenceb2fff2015-04-27 17:50:5412if (is_mac) {
13 import("//build/config/mac/mac_sdk.gni")
14}
15
scheib7a4cf042015-03-31 04:33:4416is_linux_without_udev = is_linux && !use_udev
17is_linux_without_dbus = is_linux && !use_dbus
18
dpranke1643d222015-07-27 22:22:0819# TODO(GYP): Delete this after we've converted everything to GN.
20# The _run targets exist only for compatibility w/ GYP.
21group("device_unittests_run") {
22 testonly = true
23 deps = [
24 ":device_unittests",
25 ]
26}
27
tfarinacdc7e5d2015-02-23 09:52:2428test("device_unittests") {
29 sources = [
tfarinacdc7e5d2015-02-23 09:52:2430 "battery/battery_status_manager_win_unittest.cc",
31 "battery/battery_status_service_unittest.cc",
32 "bluetooth/bluetooth_adapter_mac_unittest.mm",
tfarinacdc7e5d2015-02-23 09:52:2433 "bluetooth/bluetooth_adapter_unittest.cc",
34 "bluetooth/bluetooth_adapter_win_unittest.cc",
ortuno945c90d2015-09-01 01:47:0835 "bluetooth/bluetooth_advertisement_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2436 "bluetooth/bluetooth_device_unittest.cc",
37 "bluetooth/bluetooth_device_win_unittest.cc",
jpawlowskif54d01542015-04-13 22:24:4338 "bluetooth/bluetooth_discovery_filter_unittest.cc",
scheibdd941ba42015-10-27 05:40:1239 "bluetooth/bluetooth_gatt_characteristic_unittest.cc",
scheib81a0ff262016-01-13 00:58:3040 "bluetooth/bluetooth_gatt_descriptor_unittest.cc",
scheib33aa3f42015-10-16 01:23:1541 "bluetooth/bluetooth_gatt_service_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2442 "bluetooth/bluetooth_low_energy_win_unittest.cc",
43 "bluetooth/bluetooth_service_record_win_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2444 "bluetooth/bluetooth_task_manager_win_unittest.cc",
45 "bluetooth/bluetooth_uuid_unittest.cc",
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",
scheib42e6b49d2015-04-29 21:46:5754 "bluetooth/test/test_bluetooth_adapter_observer.cc",
55 "bluetooth/test/test_bluetooth_adapter_observer.h",
tfarinacdc7e5d2015-02-23 09:52:2456 "nfc/nfc_chromeos_unittest.cc",
57 "nfc/nfc_ndef_record_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2458 "test/run_all_unittests.cc",
tfarinacdc7e5d2015-02-23 09:52:2459 ]
60
61 deps = [
62 "//base/test:test_support",
63 "//device/battery",
64 "//device/battery:mojo_bindings",
65 "//device/bluetooth",
brettw011138d2015-10-21 03:05:3866 "//device/bluetooth:mocks",
tfarinacdc7e5d2015-02-23 09:52:2467 "//device/nfc",
brettwbda835b2015-12-04 22:12:3068 "//mojo/common",
tfarinacdc7e5d2015-02-23 09:52:2469 "//mojo/environment:chromium",
rockot85dce0862015-11-13 01:33:5970 "//mojo/public/cpp/bindings",
tfarinacdc7e5d2015-02-23 09:52:2471 "//net",
72 "//testing/gmock",
73 "//testing/gtest",
tfarinacdc7e5d2015-02-23 09:52:2474 "//third_party/mojo/src/mojo/edk/system",
tfarinacdc7e5d2015-02-23 09:52:2475 "//url",
76 ]
77
scheib7a4cf042015-03-31 04:33:4478 if (!is_linux_without_dbus && !is_chromeos) {
79 sources += [ "battery/battery_status_manager_linux_unittest.cc" ]
80 }
tfarinacdc7e5d2015-02-23 09:52:2481
scheib7a4cf042015-03-31 04:33:4482 # HID and Serial:
scheibcfdca0e2015-04-01 05:27:5883 # Android doesn't compile.
scheib7a4cf042015-03-31 04:33:4484 # Linux, requires udev.
scheibcfdca0e2015-04-01 05:27:5885 if (!is_linux_without_udev && !is_android) {
scheib7a4cf042015-03-31 04:33:4486 sources += [
87 "hid/hid_connection_unittest.cc",
88 "hid/hid_device_filter_unittest.cc",
89 "hid/hid_report_descriptor_unittest.cc",
90 "hid/input_service_linux_unittest.cc",
91 "hid/test_report_descriptors.cc",
92 "hid/test_report_descriptors.h",
93 "serial/data_sink_unittest.cc",
94 "serial/data_source_unittest.cc",
95 "serial/serial_connection_unittest.cc",
juncai923ede72015-07-30 22:58:3096 "serial/serial_io_handler_posix_unittest.cc",
scheib7a4cf042015-03-31 04:33:4497 "serial/serial_service_unittest.cc",
98 ]
99 deps += [
100 "//device/hid",
101 "//device/serial",
102 "//device/serial:test_support",
103 ]
104 }
105
106 if (use_udev) {
107 sources += [ "udev_linux/udev_unittest.cc" ]
108 deps += [ "//device/udev_linux" ]
109 }
110
reillygcf1af632015-11-18 16:42:58111 # USB does not compile on iOS.
112 if (!is_ios) {
scheibcfdca0e2015-04-01 05:27:58113 sources += [
rockot0fa66a82015-06-11 17:25:45114 "devices_app/usb/device_impl_unittest.cc",
115 "devices_app/usb/device_manager_impl_unittest.cc",
reillyg83746f462015-09-29 21:30:00116 "devices_app/usb/fake_permission_provider.cc",
117 "devices_app/usb/fake_permission_provider.h",
reillygbadbc5412015-08-28 23:08:10118 "test/test_device_client.cc",
119 "test/test_device_client.h",
scheibcfdca0e2015-04-01 05:27:58120 "test/usb_test_gadget_impl.cc",
reillyg86549e52015-08-15 03:00:43121 "usb/usb_descriptors_unittest.cc",
scheibcfdca0e2015-04-01 05:27:58122 "usb/usb_device_filter_unittest.cc",
123 "usb/usb_device_handle_unittest.cc",
124 "usb/usb_ids_unittest.cc",
125 "usb/usb_service_unittest.cc",
reillyg86549e52015-08-15 03:00:43126 "usb/webusb_descriptors_unittest.cc",
scheibcfdca0e2015-04-01 05:27:58127 ]
128 deps += [
rockot8fcc2752015-05-28 02:07:55129 "//device/core",
reillygbcc08e212015-11-24 19:57:01130 "//device/core:mocks",
rockot0fa66a82015-06-11 17:25:45131 "//device/devices_app:lib",
rockot0fa66a82015-06-11 17:25:45132 "//device/devices_app/usb/public/interfaces",
scheibcfdca0e2015-04-01 05:27:58133 "//device/usb",
reillygcf9be262015-05-14 16:06:06134 "//device/usb:mocks",
scheibcfdca0e2015-04-01 05:27:58135 ]
136 }
137
reillygcf1af632015-11-18 16:42:58138 # UsbContext is a libusb-specific object.
139 if (!is_android && !is_ios) {
140 sources += [ "usb/usb_context_unittest.cc" ]
brettwbda835b2015-12-04 22:12:30141 deps += [ "//third_party/libusb" ]
reillygcf1af632015-11-18 16:42:58142 }
143
scheib56010cc2015-06-25 01:29:47144 if (is_android) {
leon.han4e5d8102015-09-02 07:12:00145 sources -= [ "battery/battery_status_service_unittest.cc" ]
agrieve97176362015-12-01 16:36:19146 deps += [
147 ":bluetooth_test_java",
148 ":bluetooth_test_jni_headers",
149 ]
leon.han4e5d8102015-09-02 07:12:00150 deps -= [ "//device/battery" ]
scheib56010cc2015-06-25 01:29:47151 }
152
scheib7a4cf042015-03-31 04:33:44153 if (is_chromeos) {
tfarinacdc7e5d2015-02-23 09:52:24154 deps += [
155 "//chromeos",
156 "//chromeos:test_support",
157 "//chromeos:test_support_without_gmock",
tfarinacdc7e5d2015-02-23 09:52:24158 ]
159 }
160
dnicoara59acb3022015-12-17 18:13:16161 if ((is_chromeos || is_linux) && use_dbus) {
rkc41077042015-11-06 07:20:58162 configs += [ "//build/config/linux:dbus" ]
163
164 sources += [
165 "bluetooth/bluetooth_adapter_profile_bluez_unittest.cc",
166 "bluetooth/bluetooth_advertisement_bluez_unittest.cc",
167 "bluetooth/bluetooth_audio_sink_bluez_unittest.cc",
168 "bluetooth/bluetooth_bluez_unittest.cc",
169 "bluetooth/bluetooth_gatt_bluez_unittest.cc",
170 "bluetooth/bluetooth_socket_bluez_unittest.cc",
171 ]
172
173 deps += [ "//dbus" ]
174 }
175
tfarinacdc7e5d2015-02-23 09:52:24176 if (is_mac) {
krstnmnlsn332a71cf2015-07-17 18:59:58177 deps += [ "//third_party/ocmock" ]
178 ldflags = [ "-ObjC" ]
tfarinacdc7e5d2015-02-23 09:52:24179 libs = [ "IOBluetooth.framework" ]
erikchenceb2fff2015-04-27 17:50:54180
181 # In the OSX 10.10 SDK, CoreBluetooth became a top level framework.
182 # Previously, it was nested in IOBluetooth. In order for Chrome to run on
183 # OSes older than OSX 10.10, the top level CoreBluetooth framework must be
184 # weakly linked.
185 if (mac_sdk_version == "10.10") {
scheibdd941ba42015-10-27 05:40:12186 ldflags += [
187 "-weak_framework",
188 "CoreBluetooth",
189 ]
erikchenceb2fff2015-04-27 17:50:54190 }
tfarinacdc7e5d2015-02-23 09:52:24191 }
tfarinacdc7e5d2015-02-23 09:52:24192}
scheib56010cc2015-06-25 01:29:47193
194if (is_android) {
scheib545d7fd2015-06-30 22:26:58195 bluetooth_java_sources_needing_jni = [ "bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java" ]
scheib56010cc2015-06-25 01:29:47196
197 generate_jni("bluetooth_test_jni_headers") {
198 sources = bluetooth_java_sources_needing_jni
199 jni_package = "bluetooth"
200 }
201
202 android_library("bluetooth_test_java") {
203 java_files = bluetooth_java_sources_needing_jni
204 deps = [
205 "//base:base_java",
206 "//device/bluetooth:java",
207 ]
208 }
209}