[BackgroundSync] Clean up some tests
[chromium-blink-merge.git] / device / BUILD.gn
blobee539328edd2ef84a6e40ba183b90555b9d89c60
1 # 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.
5 import("//build/config/features.gni")
6 import("//testing/test.gni")
8 if (is_mac) {
9   import("//build/config/mac/mac_sdk.gni")
12 is_linux_without_udev = is_linux && !use_udev
13 is_linux_without_dbus = is_linux && !use_dbus
15 test("device_unittests") {
16   sources = [
17     "battery/battery_status_manager_win_unittest.cc",
18     "battery/battery_status_service_unittest.cc",
19     "bluetooth/bluetooth_adapter_android_unittest.cc",
20     "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",
24     "bluetooth/bluetooth_advertisement_chromeos_unittest.cc",
25     "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",
29     "bluetooth/bluetooth_discovery_filter_unittest.cc",
30     "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",
36     "bluetooth/test/test_bluetooth_adapter_observer.cc",
37     "bluetooth/test/test_bluetooth_adapter_observer.h",
38     "nfc/nfc_chromeos_unittest.cc",
39     "nfc/nfc_ndef_record_unittest.cc",
40     "test/run_all_unittests.cc",
41   ]
43   deps = [
44     "//base/test:test_support",
45     "//device/battery",
46     "//device/battery:mojo_bindings",
47     "//device/bluetooth",
48     "//device/nfc",
49     "//mojo/environment:chromium",
50     "//net",
51     "//testing/gmock",
52     "//testing/gtest",
53     "//third_party/mojo/src/mojo/edk/system",
54     "//third_party/mojo/src/mojo/public/cpp/bindings",
55     "//url",
56   ]
58   if (!is_linux_without_dbus && !is_chromeos) {
59     sources += [ "battery/battery_status_manager_linux_unittest.cc" ]
60   }
62   # HID and Serial:
63   # Android doesn't compile.
64   # Linux, requires udev.
65   if (!is_linux_without_udev && !is_android) {
66     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   }
85   if (use_udev) {
86     sources += [ "udev_linux/udev_unittest.cc" ]
87     deps += [ "//device/udev_linux" ]
88   }
90   # USB does not compile on mobile platforms.
91   if (!is_android && !is_ios) {
92     sources += [
93       "test/usb_test_gadget_impl.cc",
94       "usb/device_impl_unittest.cc",
95       "usb/device_manager_impl_unittest.cc",
96       "usb/usb_context_unittest.cc",
97       "usb/usb_device_filter_unittest.cc",
98       "usb/usb_device_handle_unittest.cc",
99       "usb/usb_ids_unittest.cc",
100       "usb/usb_service_unittest.cc",
101     ]
102     deps += [
103       "//device/core",
104       "//device/usb/public/cpp",
105       "//device/usb/public/interfaces",
106       "//device/usb",
107       "//device/usb:mocks",
108       "//third_party/libusb",
109     ]
110   }
112   if (is_chromeos) {
113     configs += [ "//build/config/linux:dbus" ]
115     deps += [
116       "//chromeos",
117       "//chromeos:test_support",
118       "//chromeos:test_support_without_gmock",
119       "//dbus",
120     ]
121   }
123   if (is_posix && !is_android && !is_mac) {
124     libs = [ "rt" ]
125   }
127   if (is_mac) {
128     libs = [ "IOBluetooth.framework" ]
130     # In the OSX 10.10 SDK, CoreBluetooth became a top level framework.
131     # Previously, it was nested in IOBluetooth. In order for Chrome to run on
132     # OSes older than OSX 10.10, the top level CoreBluetooth framework must be
133     # weakly linked.
134     if (mac_sdk_version == "10.10") {
135       ldflags = [ "-weak_framework CoreBluetooth" ]
136     }
137   }