Fix lint new api error in SystemMessageHandler.
[chromium-blink-merge.git] / device / BUILD.gn
blob0fa1171fc0d2a4c0634fb3af404a6c6bac178c66
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_android) {
9   import("//build/config/android/rules.gni")  # For generate_jni().
12 if (is_mac) {
13   import("//build/config/mac/mac_sdk.gni")
16 is_linux_without_udev = is_linux && !use_udev
17 is_linux_without_dbus = is_linux && !use_dbus
19 test("device_unittests") {
20   sources = [
21     "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",
27     "bluetooth/bluetooth_advertisement_chromeos_unittest.cc",
28     "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",
32     "bluetooth/bluetooth_discovery_filter_unittest.cc",
33     "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",
39     "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",
43     "bluetooth/test/test_bluetooth_adapter_observer.cc",
44     "bluetooth/test/test_bluetooth_adapter_observer.h",
45     "nfc/nfc_chromeos_unittest.cc",
46     "nfc/nfc_ndef_record_unittest.cc",
47     "test/run_all_unittests.cc",
48   ]
50   deps = [
51     "//base/test:test_support",
52     "//device/battery",
53     "//device/battery:mojo_bindings",
54     "//device/bluetooth",
55     "//device/nfc",
56     "//mojo/environment:chromium",
57     "//net",
58     "//testing/gmock",
59     "//testing/gtest",
60     "//third_party/mojo/src/mojo/edk/system",
61     "//third_party/mojo/src/mojo/public/cpp/bindings",
62     "//url",
63   ]
65   if (!is_linux_without_dbus && !is_chromeos) {
66     sources += [ "battery/battery_status_manager_linux_unittest.cc" ]
67   }
69   # HID and Serial:
70   # Android doesn't compile.
71   # Linux, requires udev.
72   if (!is_linux_without_udev && !is_android) {
73     sources += [
74       "hid/hid_connection_unittest.cc",
75       "hid/hid_device_filter_unittest.cc",
76       "hid/hid_report_descriptor_unittest.cc",
77       "hid/input_service_linux_unittest.cc",
78       "hid/test_report_descriptors.cc",
79       "hid/test_report_descriptors.h",
80       "serial/data_sink_unittest.cc",
81       "serial/data_source_unittest.cc",
82       "serial/serial_connection_unittest.cc",
83       "serial/serial_service_unittest.cc",
84     ]
85     deps += [
86       "//device/hid",
87       "//device/serial",
88       "//device/serial:test_support",
89     ]
90   }
92   if (use_udev) {
93     sources += [ "udev_linux/udev_unittest.cc" ]
94     deps += [ "//device/udev_linux" ]
95   }
97   # USB does not compile on mobile platforms.
98   if (!is_android && !is_ios) {
99     sources += [
100       "devices_app/usb/device_impl_unittest.cc",
101       "devices_app/usb/device_manager_impl_unittest.cc",
102       "test/usb_test_gadget_impl.cc",
103       "usb/usb_context_unittest.cc",
104       "usb/usb_device_filter_unittest.cc",
105       "usb/usb_device_handle_unittest.cc",
106       "usb/usb_ids_unittest.cc",
107       "usb/usb_service_unittest.cc",
108     ]
109     deps += [
110       "//device/core",
111       "//device/devices_app:lib",
112       "//device/devices_app/usb/public/cpp",
113       "//device/devices_app/usb/public/interfaces",
114       "//device/usb",
115       "//device/usb:mocks",
116       "//third_party/libusb",
117     ]
118   }
120   if (is_android) {
121     deps += [ ":bluetooth_test_jni_headers" ]
122     apk_deps = [ ":bluetooth_test_java" ]
123   }
125   if (is_chromeos) {
126     configs += [ "//build/config/linux:dbus" ]
128     deps += [
129       "//chromeos",
130       "//chromeos:test_support",
131       "//chromeos:test_support_without_gmock",
132       "//dbus",
133     ]
134   }
136   if (is_posix && !is_android && !is_mac) {
137     libs = [ "rt" ]
138   }
140   if (is_mac) {
141     deps += [ "//third_party/ocmock" ]
142     ldflags = [ "-ObjC" ]
143     libs = [ "IOBluetooth.framework" ]
145     # In the OSX 10.10 SDK, CoreBluetooth became a top level framework.
146     # Previously, it was nested in IOBluetooth. In order for Chrome to run on
147     # OSes older than OSX 10.10, the top level CoreBluetooth framework must be
148     # weakly linked.
149     if (mac_sdk_version == "10.10") {
150       ldflags += [ "-weak_framework CoreBluetooth" ]
151     }
152   }
155 if (is_android) {
156   bluetooth_java_sources_needing_jni = [ "bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java" ]
158   generate_jni("bluetooth_test_jni_headers") {
159     sources = bluetooth_java_sources_needing_jni
160     jni_package = "bluetooth"
161   }
163   android_library("bluetooth_test_java") {
164     java_files = bluetooth_java_sources_needing_jni
165     deps = [
166       "//base:base_java",
167       "//device/bluetooth:java",
168     ]
169   }