blob: a7d91edb5bed1b0759a0e3d929be67225e19cdb1 [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",
yoichio500c6db2015-09-29 07:39:2233 "bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2434 "bluetooth/bluetooth_adapter_unittest.cc",
35 "bluetooth/bluetooth_adapter_win_unittest.cc",
yoichio500c6db2015-09-29 07:39:2236 "bluetooth/bluetooth_advertisement_chromeos_unittest.cc",
ortuno945c90d2015-09-01 01:47:0837 "bluetooth/bluetooth_advertisement_unittest.cc",
yoichio500c6db2015-09-29 07:39:2238 "bluetooth/bluetooth_audio_sink_chromeos_unittest.cc",
39 "bluetooth/bluetooth_chromeos_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2440 "bluetooth/bluetooth_device_unittest.cc",
41 "bluetooth/bluetooth_device_win_unittest.cc",
jpawlowskif54d01542015-04-13 22:24:4342 "bluetooth/bluetooth_discovery_filter_unittest.cc",
yoichio500c6db2015-09-29 07:39:2243 "bluetooth/bluetooth_gatt_chromeos_unittest.cc",
scheib33aa3f42015-10-16 01:23:1544 "bluetooth/bluetooth_gatt_service_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2445 "bluetooth/bluetooth_low_energy_win_unittest.cc",
46 "bluetooth/bluetooth_service_record_win_unittest.cc",
yoichio500c6db2015-09-29 07:39:2247 "bluetooth/bluetooth_socket_chromeos_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2448 "bluetooth/bluetooth_task_manager_win_unittest.cc",
49 "bluetooth/bluetooth_uuid_unittest.cc",
scheib545d7fd2015-06-30 22:26:5850 "bluetooth/test/bluetooth_test.cc",
51 "bluetooth/test/bluetooth_test.h",
52 "bluetooth/test/bluetooth_test_android.cc",
53 "bluetooth/test/bluetooth_test_android.h",
krstnmnlsn56d371032015-07-21 20:18:0754 "bluetooth/test/bluetooth_test_mac.h",
55 "bluetooth/test/bluetooth_test_mac.mm",
scheib42e6b49d2015-04-29 21:46:5756 "bluetooth/test/test_bluetooth_adapter_observer.cc",
57 "bluetooth/test/test_bluetooth_adapter_observer.h",
tfarinacdc7e5d2015-02-23 09:52:2458 "nfc/nfc_chromeos_unittest.cc",
59 "nfc/nfc_ndef_record_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2460 "test/run_all_unittests.cc",
tfarinacdc7e5d2015-02-23 09:52:2461 ]
62
63 deps = [
64 "//base/test:test_support",
65 "//device/battery",
66 "//device/battery:mojo_bindings",
67 "//device/bluetooth",
brettw011138d2015-10-21 03:05:3868 "//device/bluetooth:mocks",
tfarinacdc7e5d2015-02-23 09:52:2469 "//device/nfc",
tfarinacdc7e5d2015-02-23 09:52:2470 "//mojo/environment:chromium",
71 "//net",
72 "//testing/gmock",
73 "//testing/gtest",
tfarinacdc7e5d2015-02-23 09:52:2474 "//third_party/mojo/src/mojo/edk/system",
75 "//third_party/mojo/src/mojo/public/cpp/bindings",
76 "//url",
77 ]
78
scheib7a4cf042015-03-31 04:33:4479 if (!is_linux_without_dbus && !is_chromeos) {
80 sources += [ "battery/battery_status_manager_linux_unittest.cc" ]
81 }
tfarinacdc7e5d2015-02-23 09:52:2482
scheib7a4cf042015-03-31 04:33:4483 # HID and Serial:
scheibcfdca0e2015-04-01 05:27:5884 # Android doesn't compile.
scheib7a4cf042015-03-31 04:33:4485 # Linux, requires udev.
scheibcfdca0e2015-04-01 05:27:5886 if (!is_linux_without_udev && !is_android) {
scheib7a4cf042015-03-31 04:33:4487 sources += [
88 "hid/hid_connection_unittest.cc",
89 "hid/hid_device_filter_unittest.cc",
90 "hid/hid_report_descriptor_unittest.cc",
91 "hid/input_service_linux_unittest.cc",
92 "hid/test_report_descriptors.cc",
93 "hid/test_report_descriptors.h",
94 "serial/data_sink_unittest.cc",
95 "serial/data_source_unittest.cc",
96 "serial/serial_connection_unittest.cc",
juncai923ede72015-07-30 22:58:3097 "serial/serial_io_handler_posix_unittest.cc",
scheib7a4cf042015-03-31 04:33:4498 "serial/serial_service_unittest.cc",
99 ]
100 deps += [
101 "//device/hid",
102 "//device/serial",
103 "//device/serial:test_support",
104 ]
105 }
106
107 if (use_udev) {
108 sources += [ "udev_linux/udev_unittest.cc" ]
109 deps += [ "//device/udev_linux" ]
110 }
111
scheibcfdca0e2015-04-01 05:27:58112 # USB does not compile on mobile platforms.
113 if (!is_android && !is_ios) {
114 sources += [
rockot0fa66a82015-06-11 17:25:45115 "devices_app/usb/device_impl_unittest.cc",
116 "devices_app/usb/device_manager_impl_unittest.cc",
reillyg83746f462015-09-29 21:30:00117 "devices_app/usb/fake_permission_provider.cc",
118 "devices_app/usb/fake_permission_provider.h",
reillygbadbc5412015-08-28 23:08:10119 "test/test_device_client.cc",
120 "test/test_device_client.h",
scheibcfdca0e2015-04-01 05:27:58121 "test/usb_test_gadget_impl.cc",
122 "usb/usb_context_unittest.cc",
reillyg86549e52015-08-15 03:00:43123 "usb/usb_descriptors_unittest.cc",
scheibcfdca0e2015-04-01 05:27:58124 "usb/usb_device_filter_unittest.cc",
125 "usb/usb_device_handle_unittest.cc",
126 "usb/usb_ids_unittest.cc",
127 "usb/usb_service_unittest.cc",
reillyg86549e52015-08-15 03:00:43128 "usb/webusb_descriptors_unittest.cc",
scheibcfdca0e2015-04-01 05:27:58129 ]
130 deps += [
rockot8fcc2752015-05-28 02:07:55131 "//device/core",
rockot0fa66a82015-06-11 17:25:45132 "//device/devices_app:lib",
rockot0fa66a82015-06-11 17:25:45133 "//device/devices_app/usb/public/interfaces",
scheibcfdca0e2015-04-01 05:27:58134 "//device/usb",
reillygcf9be262015-05-14 16:06:06135 "//device/usb:mocks",
scheibcfdca0e2015-04-01 05:27:58136 "//third_party/libusb",
137 ]
138 }
139
scheib56010cc2015-06-25 01:29:47140 if (is_android) {
leon.han4e5d8102015-09-02 07:12:00141 sources -= [ "battery/battery_status_service_unittest.cc" ]
142 deps -= [ "//device/battery" ]
scheib56010cc2015-06-25 01:29:47143 deps += [ ":bluetooth_test_jni_headers" ]
144 apk_deps = [ ":bluetooth_test_java" ]
145 }
146
scheib7a4cf042015-03-31 04:33:44147 if (is_chromeos) {
yoichio500c6db2015-09-29 07:39:22148 configs += [ "//build/config/linux:dbus" ]
149
tfarinacdc7e5d2015-02-23 09:52:24150 deps += [
151 "//chromeos",
152 "//chromeos:test_support",
153 "//chromeos:test_support_without_gmock",
yoichio500c6db2015-09-29 07:39:22154 "//dbus",
tfarinacdc7e5d2015-02-23 09:52:24155 ]
156 }
157
scheibcfdca0e2015-04-01 05:27:58158 if (is_posix && !is_android && !is_mac) {
tfarinacdc7e5d2015-02-23 09:52:24159 libs = [ "rt" ]
160 }
161
162 if (is_mac) {
krstnmnlsn332a71cf2015-07-17 18:59:58163 deps += [ "//third_party/ocmock" ]
164 ldflags = [ "-ObjC" ]
tfarinacdc7e5d2015-02-23 09:52:24165 libs = [ "IOBluetooth.framework" ]
erikchenceb2fff2015-04-27 17:50:54166
167 # In the OSX 10.10 SDK, CoreBluetooth became a top level framework.
168 # Previously, it was nested in IOBluetooth. In order for Chrome to run on
169 # OSes older than OSX 10.10, the top level CoreBluetooth framework must be
170 # weakly linked.
171 if (mac_sdk_version == "10.10") {
brettw011138d2015-10-21 03:05:38172 ldflags += [ "-weak_framework", "CoreBluetooth" ]
erikchenceb2fff2015-04-27 17:50:54173 }
tfarinacdc7e5d2015-02-23 09:52:24174 }
tfarinacdc7e5d2015-02-23 09:52:24175}
scheib56010cc2015-06-25 01:29:47176
177if (is_android) {
scheib545d7fd2015-06-30 22:26:58178 bluetooth_java_sources_needing_jni = [ "bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java" ]
scheib56010cc2015-06-25 01:29:47179
180 generate_jni("bluetooth_test_jni_headers") {
181 sources = bluetooth_java_sources_needing_jni
182 jni_package = "bluetooth"
183 }
184
185 android_library("bluetooth_test_java") {
186 java_files = bluetooth_java_sources_needing_jni
187 deps = [
188 "//base:base_java",
189 "//device/bluetooth:java",
190 ]
191 }
192}