blob: d80e50d59e5557293792984fad72b7db33560fa6 [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
erikchenceb2fff2015-04-27 17:50:548if (is_mac) {
9 import("//build/config/mac/mac_sdk.gni")
10}
11
scheib7a4cf042015-03-31 04:33:4412is_linux_without_udev = is_linux && !use_udev
13is_linux_without_dbus = is_linux && !use_dbus
14
tfarinacdc7e5d2015-02-23 09:52:2415test("device_unittests") {
16 sources = [
tfarinacdc7e5d2015-02-23 09:52:2417 "battery/battery_status_manager_win_unittest.cc",
18 "battery/battery_status_service_unittest.cc",
scheib35fbdd40272015-04-29 21:31:5419 "bluetooth/bluetooth_adapter_android_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2420 "bluetooth/bluetooth_adapter_mac_unittest.mm",
21 "bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc",
22 "bluetooth/bluetooth_adapter_unittest.cc",
23 "bluetooth/bluetooth_adapter_win_unittest.cc",
rkc02b1b8c2015-04-28 17:28:5224 "bluetooth/bluetooth_advertisement_chromeos_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2425 "bluetooth/bluetooth_audio_sink_chromeos_unittest.cc",
26 "bluetooth/bluetooth_chromeos_unittest.cc",
27 "bluetooth/bluetooth_device_unittest.cc",
28 "bluetooth/bluetooth_device_win_unittest.cc",
jpawlowskif54d01542015-04-13 22:24:4329 "bluetooth/bluetooth_discovery_filter_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2430 "bluetooth/bluetooth_gatt_chromeos_unittest.cc",
31 "bluetooth/bluetooth_low_energy_win_unittest.cc",
32 "bluetooth/bluetooth_service_record_win_unittest.cc",
33 "bluetooth/bluetooth_socket_chromeos_unittest.cc",
34 "bluetooth/bluetooth_task_manager_win_unittest.cc",
35 "bluetooth/bluetooth_uuid_unittest.cc",
scheib42e6b49d2015-04-29 21:46:5736 "bluetooth/test/test_bluetooth_adapter_observer.cc",
37 "bluetooth/test/test_bluetooth_adapter_observer.h",
tfarinacdc7e5d2015-02-23 09:52:2438 "nfc/nfc_chromeos_unittest.cc",
39 "nfc/nfc_ndef_record_unittest.cc",
tfarinacdc7e5d2015-02-23 09:52:2440 "test/run_all_unittests.cc",
tfarinacdc7e5d2015-02-23 09:52:2441 ]
42
43 deps = [
44 "//base/test:test_support",
45 "//device/battery",
46 "//device/battery:mojo_bindings",
47 "//device/bluetooth",
tfarinacdc7e5d2015-02-23 09:52:2448 "//device/nfc",
tfarinacdc7e5d2015-02-23 09:52:2449 "//mojo/environment:chromium",
50 "//net",
51 "//testing/gmock",
52 "//testing/gtest",
tfarinacdc7e5d2015-02-23 09:52:2453 "//third_party/mojo/src/mojo/edk/system",
54 "//third_party/mojo/src/mojo/public/cpp/bindings",
55 "//url",
56 ]
57
scheib7a4cf042015-03-31 04:33:4458 if (!is_linux_without_dbus && !is_chromeos) {
59 sources += [ "battery/battery_status_manager_linux_unittest.cc" ]
60 }
tfarinacdc7e5d2015-02-23 09:52:2461
scheib7a4cf042015-03-31 04:33:4462 # HID and Serial:
scheibcfdca0e2015-04-01 05:27:5863 # Android doesn't compile.
scheib7a4cf042015-03-31 04:33:4464 # Linux, requires udev.
scheibcfdca0e2015-04-01 05:27:5865 if (!is_linux_without_udev && !is_android) {
scheib7a4cf042015-03-31 04:33:4466 sources += [
67 "hid/hid_connection_unittest.cc",
68 "hid/hid_device_filter_unittest.cc",
69 "hid/hid_report_descriptor_unittest.cc",
70 "hid/input_service_linux_unittest.cc",
71 "hid/test_report_descriptors.cc",
72 "hid/test_report_descriptors.h",
73 "serial/data_sink_unittest.cc",
74 "serial/data_source_unittest.cc",
75 "serial/serial_connection_unittest.cc",
76 "serial/serial_service_unittest.cc",
77 ]
78 deps += [
79 "//device/hid",
80 "//device/serial",
81 "//device/serial:test_support",
82 ]
83 }
84
85 if (use_udev) {
86 sources += [ "udev_linux/udev_unittest.cc" ]
87 deps += [ "//device/udev_linux" ]
88 }
89
scheibcfdca0e2015-04-01 05:27:5890 # USB does not compile on mobile platforms.
91 if (!is_android && !is_ios) {
92 sources += [
93 "test/usb_test_gadget_impl.cc",
94 "usb/usb_context_unittest.cc",
95 "usb/usb_device_filter_unittest.cc",
96 "usb/usb_device_handle_unittest.cc",
97 "usb/usb_ids_unittest.cc",
98 "usb/usb_service_unittest.cc",
99 ]
100 deps += [
101 "//device/usb",
reillygcf9be262015-05-14 16:06:06102 "//device/usb:mocks",
scheibcfdca0e2015-04-01 05:27:58103 "//third_party/libusb",
104 ]
105 }
106
scheib7a4cf042015-03-31 04:33:44107 if (is_chromeos) {
tfarinacdc7e5d2015-02-23 09:52:24108 configs += [ "//build/config/linux:dbus" ]
109
110 deps += [
111 "//chromeos",
112 "//chromeos:test_support",
113 "//chromeos:test_support_without_gmock",
114 "//dbus",
115 ]
116 }
117
scheibcfdca0e2015-04-01 05:27:58118 if (is_posix && !is_android && !is_mac) {
tfarinacdc7e5d2015-02-23 09:52:24119 libs = [ "rt" ]
120 }
121
122 if (is_mac) {
123 libs = [ "IOBluetooth.framework" ]
erikchenceb2fff2015-04-27 17:50:54124
125 # In the OSX 10.10 SDK, CoreBluetooth became a top level framework.
126 # Previously, it was nested in IOBluetooth. In order for Chrome to run on
127 # OSes older than OSX 10.10, the top level CoreBluetooth framework must be
128 # weakly linked.
129 if (mac_sdk_version == "10.10") {
130 ldflags = [ "-weak_framework CoreBluetooth" ]
131 }
tfarinacdc7e5d2015-02-23 09:52:24132 }
tfarinacdc7e5d2015-02-23 09:52:24133}