blob: c12370ac33a2b0edbb567d72132ebbe5ff0f7834 [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",
33 "bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc",
34 "bluetooth/bluetooth_adapter_unittest.cc",
35 "bluetooth/bluetooth_adapter_win_unittest.cc",
rkc02b1b8c2015-04-28 17:28:5236 "bluetooth/bluetooth_advertisement_chromeos_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2437 "bluetooth/bluetooth_audio_sink_chromeos_unittest.cc",
38 "bluetooth/bluetooth_chromeos_unittest.cc",
39 "bluetooth/bluetooth_device_unittest.cc",
40 "bluetooth/bluetooth_device_win_unittest.cc",
jpawlowskif54d01542015-04-13 22:24:4341 "bluetooth/bluetooth_discovery_filter_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2442 "bluetooth/bluetooth_gatt_chromeos_unittest.cc",
43 "bluetooth/bluetooth_low_energy_win_unittest.cc",
44 "bluetooth/bluetooth_service_record_win_unittest.cc",
45 "bluetooth/bluetooth_socket_chromeos_unittest.cc",
46 "bluetooth/bluetooth_task_manager_win_unittest.cc",
47 "bluetooth/bluetooth_uuid_unittest.cc",
scheib545d7fd2015-06-30 22:26:5848 "bluetooth/test/bluetooth_test.cc",
49 "bluetooth/test/bluetooth_test.h",
50 "bluetooth/test/bluetooth_test_android.cc",
51 "bluetooth/test/bluetooth_test_android.h",
krstnmnlsn56d371032015-07-21 20:18:0752 "bluetooth/test/bluetooth_test_mac.h",
53 "bluetooth/test/bluetooth_test_mac.mm",
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",
tfarinacdc7e5d2015-02-23 09:52:2466 "//device/nfc",
tfarinacdc7e5d2015-02-23 09:52:2467 "//mojo/environment:chromium",
68 "//net",
69 "//testing/gmock",
70 "//testing/gtest",
tfarinacdc7e5d2015-02-23 09:52:2471 "//third_party/mojo/src/mojo/edk/system",
72 "//third_party/mojo/src/mojo/public/cpp/bindings",
73 "//url",
74 ]
75
scheib7a4cf042015-03-31 04:33:4476 if (!is_linux_without_dbus && !is_chromeos) {
77 sources += [ "battery/battery_status_manager_linux_unittest.cc" ]
78 }
tfarinacdc7e5d2015-02-23 09:52:2479
scheib7a4cf042015-03-31 04:33:4480 # HID and Serial:
scheibcfdca0e2015-04-01 05:27:5881 # Android doesn't compile.
scheib7a4cf042015-03-31 04:33:4482 # Linux, requires udev.
scheibcfdca0e2015-04-01 05:27:5883 if (!is_linux_without_udev && !is_android) {
scheib7a4cf042015-03-31 04:33:4484 sources += [
85 "hid/hid_connection_unittest.cc",
86 "hid/hid_device_filter_unittest.cc",
87 "hid/hid_report_descriptor_unittest.cc",
88 "hid/input_service_linux_unittest.cc",
89 "hid/test_report_descriptors.cc",
90 "hid/test_report_descriptors.h",
91 "serial/data_sink_unittest.cc",
92 "serial/data_source_unittest.cc",
93 "serial/serial_connection_unittest.cc",
94 "serial/serial_service_unittest.cc",
95 ]
96 deps += [
97 "//device/hid",
98 "//device/serial",
99 "//device/serial:test_support",
100 ]
101 }
102
103 if (use_udev) {
104 sources += [ "udev_linux/udev_unittest.cc" ]
105 deps += [ "//device/udev_linux" ]
106 }
107
scheibcfdca0e2015-04-01 05:27:58108 # USB does not compile on mobile platforms.
109 if (!is_android && !is_ios) {
110 sources += [
rockot0fa66a82015-06-11 17:25:45111 "devices_app/usb/device_impl_unittest.cc",
112 "devices_app/usb/device_manager_impl_unittest.cc",
scheibcfdca0e2015-04-01 05:27:58113 "test/usb_test_gadget_impl.cc",
114 "usb/usb_context_unittest.cc",
115 "usb/usb_device_filter_unittest.cc",
116 "usb/usb_device_handle_unittest.cc",
117 "usb/usb_ids_unittest.cc",
118 "usb/usb_service_unittest.cc",
119 ]
120 deps += [
rockot8fcc2752015-05-28 02:07:55121 "//device/core",
rockot0fa66a82015-06-11 17:25:45122 "//device/devices_app:lib",
123 "//device/devices_app/usb/public/cpp",
124 "//device/devices_app/usb/public/interfaces",
scheibcfdca0e2015-04-01 05:27:58125 "//device/usb",
reillygcf9be262015-05-14 16:06:06126 "//device/usb:mocks",
scheibcfdca0e2015-04-01 05:27:58127 "//third_party/libusb",
128 ]
129 }
130
scheib56010cc2015-06-25 01:29:47131 if (is_android) {
132 deps += [ ":bluetooth_test_jni_headers" ]
133 apk_deps = [ ":bluetooth_test_java" ]
134 }
135
scheib7a4cf042015-03-31 04:33:44136 if (is_chromeos) {
tfarinacdc7e5d2015-02-23 09:52:24137 configs += [ "//build/config/linux:dbus" ]
138
139 deps += [
140 "//chromeos",
141 "//chromeos:test_support",
142 "//chromeos:test_support_without_gmock",
143 "//dbus",
144 ]
145 }
146
scheibcfdca0e2015-04-01 05:27:58147 if (is_posix && !is_android && !is_mac) {
tfarinacdc7e5d2015-02-23 09:52:24148 libs = [ "rt" ]
149 }
150
151 if (is_mac) {
krstnmnlsn332a71cf2015-07-17 18:59:58152 deps += [ "//third_party/ocmock" ]
153 ldflags = [ "-ObjC" ]
tfarinacdc7e5d2015-02-23 09:52:24154 libs = [ "IOBluetooth.framework" ]
erikchenceb2fff2015-04-27 17:50:54155
156 # In the OSX 10.10 SDK, CoreBluetooth became a top level framework.
157 # Previously, it was nested in IOBluetooth. In order for Chrome to run on
158 # OSes older than OSX 10.10, the top level CoreBluetooth framework must be
159 # weakly linked.
160 if (mac_sdk_version == "10.10") {
krstnmnlsn332a71cf2015-07-17 18:59:58161 ldflags += [ "-weak_framework CoreBluetooth" ]
erikchenceb2fff2015-04-27 17:50:54162 }
tfarinacdc7e5d2015-02-23 09:52:24163 }
tfarinacdc7e5d2015-02-23 09:52:24164}
scheib56010cc2015-06-25 01:29:47165
166if (is_android) {
scheib545d7fd2015-06-30 22:26:58167 bluetooth_java_sources_needing_jni = [ "bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java" ]
scheib56010cc2015-06-25 01:29:47168
169 generate_jni("bluetooth_test_jni_headers") {
170 sources = bluetooth_java_sources_needing_jni
171 jni_package = "bluetooth"
172 }
173
174 android_library("bluetooth_test_java") {
175 java_files = bluetooth_java_sources_needing_jni
176 deps = [
177 "//base:base_java",
178 "//device/bluetooth:java",
179 ]
180 }
181}