blob: 3d4ac0941c4285a21a4b4aec570bf881a37a0c50 [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
tfarinacdc7e5d2015-02-23 09:52:2419test("device_unittests") {
20 sources = [
tfarinacdc7e5d2015-02-23 09:52:2421 "battery/battery_status_manager_win_unittest.cc",
22 "battery/battery_status_service_unittest.cc",
23 "bluetooth/bluetooth_adapter_mac_unittest.mm",
24 "bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc",
25 "bluetooth/bluetooth_adapter_unittest.cc",
26 "bluetooth/bluetooth_adapter_win_unittest.cc",
rkc02b1b8c2015-04-28 17:28:5227 "bluetooth/bluetooth_advertisement_chromeos_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2428 "bluetooth/bluetooth_audio_sink_chromeos_unittest.cc",
29 "bluetooth/bluetooth_chromeos_unittest.cc",
30 "bluetooth/bluetooth_device_unittest.cc",
31 "bluetooth/bluetooth_device_win_unittest.cc",
jpawlowskif54d01542015-04-13 22:24:4332 "bluetooth/bluetooth_discovery_filter_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2433 "bluetooth/bluetooth_gatt_chromeos_unittest.cc",
34 "bluetooth/bluetooth_low_energy_win_unittest.cc",
35 "bluetooth/bluetooth_service_record_win_unittest.cc",
36 "bluetooth/bluetooth_socket_chromeos_unittest.cc",
37 "bluetooth/bluetooth_task_manager_win_unittest.cc",
38 "bluetooth/bluetooth_uuid_unittest.cc",
scheib545d7fd2015-06-30 22:26:5839 "bluetooth/test/bluetooth_test.cc",
40 "bluetooth/test/bluetooth_test.h",
41 "bluetooth/test/bluetooth_test_android.cc",
42 "bluetooth/test/bluetooth_test_android.h",
krstnmnlsn56d371032015-07-21 20:18:0743 "bluetooth/test/bluetooth_test_mac.h",
44 "bluetooth/test/bluetooth_test_mac.mm",
scheib42e6b49d2015-04-29 21:46:5745 "bluetooth/test/test_bluetooth_adapter_observer.cc",
46 "bluetooth/test/test_bluetooth_adapter_observer.h",
tfarinacdc7e5d2015-02-23 09:52:2447 "nfc/nfc_chromeos_unittest.cc",
48 "nfc/nfc_ndef_record_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2449 "test/run_all_unittests.cc",
tfarinacdc7e5d2015-02-23 09:52:2450 ]
51
52 deps = [
53 "//base/test:test_support",
54 "//device/battery",
55 "//device/battery:mojo_bindings",
56 "//device/bluetooth",
tfarinacdc7e5d2015-02-23 09:52:2457 "//device/nfc",
tfarinacdc7e5d2015-02-23 09:52:2458 "//mojo/environment:chromium",
59 "//net",
60 "//testing/gmock",
61 "//testing/gtest",
tfarinacdc7e5d2015-02-23 09:52:2462 "//third_party/mojo/src/mojo/edk/system",
63 "//third_party/mojo/src/mojo/public/cpp/bindings",
64 "//url",
65 ]
66
scheib7a4cf042015-03-31 04:33:4467 if (!is_linux_without_dbus && !is_chromeos) {
68 sources += [ "battery/battery_status_manager_linux_unittest.cc" ]
69 }
tfarinacdc7e5d2015-02-23 09:52:2470
scheib7a4cf042015-03-31 04:33:4471 # HID and Serial:
scheibcfdca0e2015-04-01 05:27:5872 # Android doesn't compile.
scheib7a4cf042015-03-31 04:33:4473 # Linux, requires udev.
scheibcfdca0e2015-04-01 05:27:5874 if (!is_linux_without_udev && !is_android) {
scheib7a4cf042015-03-31 04:33:4475 sources += [
76 "hid/hid_connection_unittest.cc",
77 "hid/hid_device_filter_unittest.cc",
78 "hid/hid_report_descriptor_unittest.cc",
79 "hid/input_service_linux_unittest.cc",
80 "hid/test_report_descriptors.cc",
81 "hid/test_report_descriptors.h",
82 "serial/data_sink_unittest.cc",
83 "serial/data_source_unittest.cc",
84 "serial/serial_connection_unittest.cc",
85 "serial/serial_service_unittest.cc",
86 ]
87 deps += [
88 "//device/hid",
89 "//device/serial",
90 "//device/serial:test_support",
91 ]
92 }
93
94 if (use_udev) {
95 sources += [ "udev_linux/udev_unittest.cc" ]
96 deps += [ "//device/udev_linux" ]
97 }
98
scheibcfdca0e2015-04-01 05:27:5899 # USB does not compile on mobile platforms.
100 if (!is_android && !is_ios) {
101 sources += [
rockot0fa66a82015-06-11 17:25:45102 "devices_app/usb/device_impl_unittest.cc",
103 "devices_app/usb/device_manager_impl_unittest.cc",
scheibcfdca0e2015-04-01 05:27:58104 "test/usb_test_gadget_impl.cc",
105 "usb/usb_context_unittest.cc",
106 "usb/usb_device_filter_unittest.cc",
107 "usb/usb_device_handle_unittest.cc",
108 "usb/usb_ids_unittest.cc",
109 "usb/usb_service_unittest.cc",
110 ]
111 deps += [
rockot8fcc2752015-05-28 02:07:55112 "//device/core",
rockot0fa66a82015-06-11 17:25:45113 "//device/devices_app:lib",
114 "//device/devices_app/usb/public/cpp",
115 "//device/devices_app/usb/public/interfaces",
scheibcfdca0e2015-04-01 05:27:58116 "//device/usb",
reillygcf9be262015-05-14 16:06:06117 "//device/usb:mocks",
scheibcfdca0e2015-04-01 05:27:58118 "//third_party/libusb",
119 ]
120 }
121
scheib56010cc2015-06-25 01:29:47122 if (is_android) {
123 deps += [ ":bluetooth_test_jni_headers" ]
124 apk_deps = [ ":bluetooth_test_java" ]
125 }
126
scheib7a4cf042015-03-31 04:33:44127 if (is_chromeos) {
tfarinacdc7e5d2015-02-23 09:52:24128 configs += [ "//build/config/linux:dbus" ]
129
130 deps += [
131 "//chromeos",
132 "//chromeos:test_support",
133 "//chromeos:test_support_without_gmock",
134 "//dbus",
135 ]
136 }
137
scheibcfdca0e2015-04-01 05:27:58138 if (is_posix && !is_android && !is_mac) {
tfarinacdc7e5d2015-02-23 09:52:24139 libs = [ "rt" ]
140 }
141
142 if (is_mac) {
krstnmnlsn332a71cf2015-07-17 18:59:58143 deps += [ "//third_party/ocmock" ]
144 ldflags = [ "-ObjC" ]
tfarinacdc7e5d2015-02-23 09:52:24145 libs = [ "IOBluetooth.framework" ]
erikchenceb2fff2015-04-27 17:50:54146
147 # In the OSX 10.10 SDK, CoreBluetooth became a top level framework.
148 # Previously, it was nested in IOBluetooth. In order for Chrome to run on
149 # OSes older than OSX 10.10, the top level CoreBluetooth framework must be
150 # weakly linked.
151 if (mac_sdk_version == "10.10") {
krstnmnlsn332a71cf2015-07-17 18:59:58152 ldflags += [ "-weak_framework CoreBluetooth" ]
erikchenceb2fff2015-04-27 17:50:54153 }
tfarinacdc7e5d2015-02-23 09:52:24154 }
tfarinacdc7e5d2015-02-23 09:52:24155}
scheib56010cc2015-06-25 01:29:47156
157if (is_android) {
scheib545d7fd2015-06-30 22:26:58158 bluetooth_java_sources_needing_jni = [ "bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java" ]
scheib56010cc2015-06-25 01:29:47159
160 generate_jni("bluetooth_test_jni_headers") {
161 sources = bluetooth_java_sources_needing_jni
162 jni_package = "bluetooth"
163 }
164
165 android_library("bluetooth_test_java") {
166 java_files = bluetooth_java_sources_needing_jni
167 deps = [
168 "//base:base_java",
169 "//device/bluetooth:java",
170 ]
171 }
172}