[M71 Dev][Tizen] Fix compiler errors
[platform/framework/web/chromium-efl.git] / device / BUILD.gn
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.
4
5 import("//build/config/features.gni")
6 import("//device/vr/buildflags/buildflags.gni")
7 import("//testing/test.gni")
8
9 if (is_android) {
10   import("//build/config/android/config.gni")
11   import("//build/config/android/rules.gni")  # For generate_jni().
12 }
13
14 if (is_mac) {
15   import("//build/config/mac/mac_sdk.gni")
16 }
17
18 is_linux_without_udev = is_linux && !use_udev
19
20 test("device_unittests") {
21   sources = [
22     "base/synchronization/one_writer_seqlock_unittest.cc",
23     "bluetooth/bluetooth_adapter_mac_unittest.mm",
24     "bluetooth/bluetooth_adapter_unittest.cc",
25     "bluetooth/bluetooth_adapter_win_unittest.cc",
26     "bluetooth/bluetooth_advertisement_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_local_gatt_characteristic_unittest.cc",
31     "bluetooth/bluetooth_local_gatt_descriptor_unittest.cc",
32     "bluetooth/bluetooth_local_gatt_service_unittest.cc",
33     "bluetooth/bluetooth_low_energy_advertisement_manager_mac_unittest.mm",
34     "bluetooth/bluetooth_low_energy_win_unittest.cc",
35     "bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc",
36     "bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc",
37     "bluetooth/bluetooth_remote_gatt_service_unittest.cc",
38     "bluetooth/bluetooth_service_record_win_unittest.cc",
39     "bluetooth/bluetooth_task_manager_win_unittest.cc",
40     "bluetooth/bluetooth_uuid_unittest.cc",
41     "bluetooth/device_unittest.cc",
42     "bluetooth/string_util_icu_unittest.cc",
43     "bluetooth/test/bluetooth_gatt_server_test.cc",
44     "bluetooth/test/bluetooth_gatt_server_test.h",
45     "bluetooth/test/bluetooth_test.cc",
46     "bluetooth/test/bluetooth_test.h",
47     "bluetooth/test/bluetooth_test_android.cc",
48     "bluetooth/test/bluetooth_test_android.h",
49     "bluetooth/test/bluetooth_test_mac.h",
50     "bluetooth/test/bluetooth_test_mac.mm",
51     "bluetooth/test/bluetooth_test_win.cc",
52     "bluetooth/test/bluetooth_test_win.h",
53     "bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h",
54     "bluetooth/test/mock_bluetooth_cbcharacteristic_mac.mm",
55     "bluetooth/test/mock_bluetooth_cbdescriptor_mac.h",
56     "bluetooth/test/mock_bluetooth_cbdescriptor_mac.mm",
57     "bluetooth/test/mock_bluetooth_cbperipheral_mac.h",
58     "bluetooth/test/mock_bluetooth_cbperipheral_mac.mm",
59     "bluetooth/test/mock_bluetooth_cbservice_mac.h",
60     "bluetooth/test/mock_bluetooth_cbservice_mac.mm",
61     "bluetooth/test/mock_bluetooth_central_manager_mac.h",
62     "bluetooth/test/mock_bluetooth_central_manager_mac.mm",
63     "bluetooth/test/test_bluetooth_adapter_observer.cc",
64     "bluetooth/test/test_bluetooth_adapter_observer.h",
65     "bluetooth/test/test_bluetooth_advertisement_observer.cc",
66     "bluetooth/test/test_bluetooth_advertisement_observer.h",
67     "bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc",
68     "bluetooth/test/test_bluetooth_local_gatt_service_delegate.h",
69     "bluetooth/test/test_pairing_delegate.cc",
70     "bluetooth/test/test_pairing_delegate.h",
71     "bluetooth/uribeacon/uri_encoder_unittest.cc",
72     "fido/attestation_statement_formats_unittest.cc",
73     "fido/ble/fido_ble_connection_unittest.cc",
74     "fido/ble/fido_ble_device_unittest.cc",
75     "fido/ble/fido_ble_frames_unittest.cc",
76     "fido/ble/fido_ble_pairing_delegate_unittest.cc",
77     "fido/ble/fido_ble_transaction_unittest.cc",
78     "fido/ble_adapter_manager_unittest.cc",
79     "fido/cable/fido_cable_device_unittest.cc",
80     "fido/cable/fido_cable_discovery_unittest.cc",
81     "fido/cable/fido_cable_handshake_handler_unittest.cc",
82     "fido/ctap_request_unittest.cc",
83     "fido/ctap_response_unittest.cc",
84     "fido/fake_fido_discovery_unittest.cc",
85     "fido/fido_device_discovery_unittest.cc",
86     "fido/fido_parsing_utils_unittest.cc",
87     "fido/fido_request_handler_unittest.cc",
88     "fido/get_assertion_handler_unittest.cc",
89     "fido/get_assertion_task_unittest.cc",
90     "fido/hid/fido_hid_message_unittest.cc",
91     "fido/mac/browsing_data_deletion_unittest.mm",
92     "fido/mac/credential_metadata_unittest.cc",
93     "fido/mac/get_assertion_operation_unittest_mac.mm",
94     "fido/mac/make_credential_operation_unittest_mac.mm",
95     "fido/mac/util_unittest.cc",
96     "fido/make_credential_handler_unittest.cc",
97     "fido/make_credential_task_unittest.cc",
98     "fido/test_callback_receiver_unittest.cc",
99     "fido/u2f_command_constructor_unittest.cc",
100     "fido/u2f_register_operation_unittest.cc",
101     "fido/u2f_sign_operation_unittest.cc",
102     "gamepad/abstract_haptic_gamepad_unittest.cc",
103     "gamepad/gamepad_provider_unittest.cc",
104     "gamepad/gamepad_service_unittest.cc",
105     "gamepad/public/cpp/gamepad_mojom_traits_unittest.cc",
106     "test/run_all_unittests.cc",
107   ]
108
109   deps = [
110     "//base/test:test_support",
111     "//base/third_party/dynamic_annotations:dynamic_annotations",
112     "//components/apdu",
113     "//components/cbor",
114     "//device/base/synchronization",
115     "//device/bluetooth",
116     "//device/bluetooth:deprecated_experimental_mojo",
117     "//device/bluetooth:mocks",
118     "//device/bluetooth/uribeacon",
119     "//device/fido",
120     "//device/fido:mocks",
121     "//device/fido:test_support",
122     "//device/gamepad",
123     "//device/gamepad:test_helpers",
124     "//device/gamepad/public/cpp:shared_with_blink",
125     "//device/gamepad/public/mojom",
126     "//mojo/core/embedder",
127     "//mojo/public/cpp/bindings",
128     "//mojo/public/cpp/test_support:test_utils",
129     "//net",
130     "//testing/gmock",
131     "//testing/gtest",
132     "//third_party/blink/public:blink_headers",
133     "//tools/usb_gadget",
134     "//url",
135   ]
136
137   # U2F and Serial:
138   # Android doesn't compile.
139   # Linux, requires udev.
140   if (!is_linux_without_udev && !is_android) {
141     sources += [
142       "fido/hid/fido_hid_device_unittest.cc",
143       "fido/hid/fido_hid_discovery_unittest.cc",
144     ]
145     deps += [
146       "//device/fido:test_support",
147       "//services/device/public/cpp/hid",
148       "//services/device/public/mojom",
149       "//services/service_manager/public/cpp",
150       "//services/service_manager/public/mojom",
151     ]
152
153     # Serial is supported in below platforms. See //device/servial/BUILD.gn
154     if (is_win || is_linux || is_mac) {
155       sources += [ "serial/serial_device_enumerator_unittest.cc" ]
156       deps += [ "//device/serial" ]
157       if (is_linux || is_mac) {
158         sources += [ "serial/serial_io_handler_posix_unittest.cc" ]
159       }
160     }
161   }
162
163   if (use_udev) {
164     sources += [ "udev_linux/udev_unittest.cc" ]
165     deps += [ "//device/udev_linux" ]
166   }
167
168   # USB does not compile on iOS.
169   if (!is_ios) {
170     sources += [
171       "test/test_device_client.cc",
172       "test/test_device_client.h",
173       "usb/mojo/device_impl_unittest.cc",
174       "usb/mojo/device_manager_impl_unittest.cc",
175       "usb/public/cpp/usb_utils_unittest.cc",
176       "usb/usb_descriptors_unittest.cc",
177       "usb/usb_device_handle_unittest.cc",
178       "usb/usb_service_unittest.cc",
179       "usb/webusb_descriptors_unittest.cc",
180     ]
181     deps += [
182       ":usb_test_gadget",
183       "//device/base",
184       "//device/base:mocks",
185       "//device/usb",
186       "//device/usb:test_support",
187       "//device/usb/mojo",
188       "//device/usb/public/cpp",
189       "//device/usb/public/mojom",
190       "//net:test_support",
191     ]
192
193     if (!is_android) {
194       sources += [ "usb/usb_ids_unittest.cc" ]
195     }
196   }
197
198   # UsbContext is a libusb-specific object.
199   if (is_mac || is_win) {
200     sources += [ "usb/usb_context_unittest.cc" ]
201     deps += [ "//third_party/libusb" ]
202   }
203
204   if (is_android) {
205     deps += [
206       ":bluetooth_test_java",
207       ":bluetooth_test_jni_headers",
208       "//device/usb:java",
209     ]
210   }
211
212   if (is_chromeos) {
213     deps += [
214       "//chromeos",
215       "//chromeos:test_support",
216       "//chromeos:test_support_without_gmock",
217     ]
218   }
219
220   if ((is_chromeos || is_linux) && use_dbus) {
221     configs += [ "//build/config/linux/dbus" ]
222
223     sources += [
224       "bluetooth/bluez/bluetooth_adapter_profile_bluez_unittest.cc",
225       "bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc",
226       "bluetooth/bluez/bluetooth_bluez_unittest.cc",
227       "bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc",
228       "bluetooth/bluez/bluetooth_service_attribute_value_bluez_unittest.cc",
229       "bluetooth/bluez/bluetooth_service_record_bluez_unittest.cc",
230       "bluetooth/bluez/bluetooth_socket_bluez_unittest.cc",
231       "bluetooth/dbus/bluetooth_gatt_application_service_provider_unittest.cc",
232       "bluetooth/test/bluetooth_test_bluez.cc",
233       "bluetooth/test/bluetooth_test_bluez.h",
234     ]
235
236     deps += [ "//dbus" ]
237   }
238
239   if (is_linux) {
240     if (is_chromecast) {
241       # Cast does not support GATT server mode.
242       sources -= [
243         "bluetooth/bluetooth_local_gatt_characteristic_unittest.cc",
244         "bluetooth/bluetooth_local_gatt_descriptor_unittest.cc",
245         "bluetooth/bluetooth_local_gatt_service_unittest.cc",
246       ]
247
248       sources += [
249         "bluetooth/cast/bluetooth_adapter_cast_unittest.cc",
250         "bluetooth/cast/bluetooth_utils_unittest.cc",
251         "bluetooth/test/bluetooth_test_cast.cc",
252         "bluetooth/test/bluetooth_test_cast.h",
253       ]
254
255       deps += [
256         "//chromecast/device/bluetooth:util",
257         "//chromecast/device/bluetooth/le",
258         "//chromecast/device/bluetooth/le:test_support",
259         "//chromecast/device/bluetooth/shlib:mock_shlib",
260       ]
261     } else {
262       # BLE discovery: works on Linux.
263       sources += [ "fido/ble/fido_ble_discovery_unittest.cc" ]
264     }
265   }
266
267   if (is_mac) {
268     deps += [ "//third_party/ocmock" ]
269     ldflags = [ "-ObjC" ]
270     libs = [
271       "IOBluetooth.framework",
272       "IOKit.framework",
273     ]
274
275     # In the OSX 10.10 SDK, CoreBluetooth became a top level framework.
276     # Previously, it was nested in IOBluetooth. In order for Chrome to run on
277     # OSes older than OSX 10.10, the top level CoreBluetooth framework must be
278     # weakly linked.
279     if (mac_sdk_version == "10.10") {
280       ldflags += [
281         "-weak_framework",
282         "CoreBluetooth",
283       ]
284     }
285   }
286
287   if (is_win) {
288     sources += [
289       "bluetooth/bluetooth_classic_win_fake.cc",
290       "bluetooth/bluetooth_classic_win_fake.h",
291       "bluetooth/bluetooth_low_energy_win_fake.cc",
292       "bluetooth/bluetooth_low_energy_win_fake.h",
293       "bluetooth/test/fake_bluetooth_adapter_winrt.cc",
294       "bluetooth/test/fake_bluetooth_adapter_winrt.h",
295       "bluetooth/test/fake_bluetooth_le_advertisement_data_section_winrt.cc",
296       "bluetooth/test/fake_bluetooth_le_advertisement_data_section_winrt.h",
297       "bluetooth/test/fake_bluetooth_le_advertisement_publisher_status_changed_event_args_winrt.cc",
298       "bluetooth/test/fake_bluetooth_le_advertisement_publisher_status_changed_event_args_winrt.h",
299       "bluetooth/test/fake_bluetooth_le_advertisement_publisher_winrt.cc",
300       "bluetooth/test/fake_bluetooth_le_advertisement_publisher_winrt.h",
301       "bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.cc",
302       "bluetooth/test/fake_bluetooth_le_advertisement_received_event_args_winrt.h",
303       "bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.cc",
304       "bluetooth/test/fake_bluetooth_le_advertisement_watcher_winrt.h",
305       "bluetooth/test/fake_bluetooth_le_advertisement_winrt.cc",
306       "bluetooth/test/fake_bluetooth_le_advertisement_winrt.h",
307       "bluetooth/test/fake_bluetooth_le_device_winrt.cc",
308       "bluetooth/test/fake_bluetooth_le_device_winrt.h",
309       "bluetooth/test/fake_bluetooth_le_manufacturer_data_winrt.cc",
310       "bluetooth/test/fake_bluetooth_le_manufacturer_data_winrt.h",
311       "bluetooth/test/fake_device_information_custom_pairing_winrt.cc",
312       "bluetooth/test/fake_device_information_custom_pairing_winrt.h",
313       "bluetooth/test/fake_device_information_pairing_winrt.cc",
314       "bluetooth/test/fake_device_information_pairing_winrt.h",
315       "bluetooth/test/fake_device_information_winrt.cc",
316       "bluetooth/test/fake_device_information_winrt.h",
317       "bluetooth/test/fake_device_pairing_requested_event_args_winrt.cc",
318       "bluetooth/test/fake_device_pairing_requested_event_args_winrt.h",
319       "bluetooth/test/fake_device_pairing_result_winrt.cc",
320       "bluetooth/test/fake_device_pairing_result_winrt.h",
321       "bluetooth/test/fake_device_watcher_winrt.cc",
322       "bluetooth/test/fake_device_watcher_winrt.h",
323       "bluetooth/test/fake_gatt_characteristic_winrt.cc",
324       "bluetooth/test/fake_gatt_characteristic_winrt.h",
325       "bluetooth/test/fake_gatt_characteristics_result_winrt.cc",
326       "bluetooth/test/fake_gatt_characteristics_result_winrt.h",
327       "bluetooth/test/fake_gatt_descriptor_winrt.cc",
328       "bluetooth/test/fake_gatt_descriptor_winrt.h",
329       "bluetooth/test/fake_gatt_descriptors_result_winrt.cc",
330       "bluetooth/test/fake_gatt_descriptors_result_winrt.h",
331       "bluetooth/test/fake_gatt_device_service_winrt.cc",
332       "bluetooth/test/fake_gatt_device_service_winrt.h",
333       "bluetooth/test/fake_gatt_device_services_result_winrt.cc",
334       "bluetooth/test/fake_gatt_device_services_result_winrt.h",
335       "bluetooth/test/fake_gatt_read_result_winrt.cc",
336       "bluetooth/test/fake_gatt_read_result_winrt.h",
337       "bluetooth/test/fake_gatt_value_changed_event_args_winrt.cc",
338       "bluetooth/test/fake_gatt_value_changed_event_args_winrt.h",
339       "bluetooth/test/fake_gatt_write_result_winrt.cc",
340       "bluetooth/test/fake_gatt_write_result_winrt.h",
341       "bluetooth/test/fake_radio_winrt.cc",
342       "bluetooth/test/fake_radio_winrt.h",
343     ]
344   }
345
346   if (enable_vr) {
347     sources += [
348       "vr/orientation/orientation_device_provider_unittest.cc",
349       "vr/orientation/orientation_device_unittest.cc",
350       "vr/vr_device_base_unittest.cc",
351       "vr/vr_display_impl_unittest.cc",
352     ]
353
354     if (is_android) {
355       deps += [ "//device/vr:java" ]
356     }
357
358     defines = [ "DEVICE_VR_IMPLEMENTATION" ]
359
360     deps += [
361       "//device/vr",
362       "//device/vr:fakes",
363       "//device/vr/public/mojom",
364       "//services/device/public/cpp/generic_sensor",
365       "//ui/display",
366       "//ui/display:test_support",
367     ]
368   }
369 }
370
371 source_set("usb_test_gadget") {
372   testonly = true
373
374   sources = [
375     "test/usb_test_gadget.h",
376     "test/usb_test_gadget_impl.cc",
377   ]
378
379   deps = [
380     "//device/base",
381     "//device/usb",
382     "//net:test_support",
383   ]
384 }
385
386 if (is_android) {
387   bluetooth_java_sources_needing_jni = [
388     "bluetooth/test/android/java/src/org/chromium/device/bluetooth/Fakes.java",
389   ]
390
391   generate_jni("bluetooth_test_jni_headers") {
392     sources = bluetooth_java_sources_needing_jni
393     jni_package = "bluetooth"
394   }
395
396   android_library("bluetooth_test_java") {
397     testonly = true
398     java_files = bluetooth_java_sources_needing_jni
399     deps = [
400       "//base:base_java",
401       "//components/location/android:location_java",
402       "//device/bluetooth:java",
403       "//third_party/android_deps:android_support_annotations_java",
404       "//third_party/android_tools:android_test_mock_java",
405     ]
406
407     srcjar_deps = [ ":bluetooth_test_javagen" ]
408   }
409
410   junit_binary("device_junit_tests") {
411     java_files = [ "gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java" ]
412     deps = [
413       "$google_play_services_package:google_play_services_base_java",
414       "$google_play_services_package:google_play_services_basement_java",
415       "$google_play_services_package:google_play_services_location_java",
416       "//base:base_java",
417       "//base:base_java_test_support",
418       "//base:base_junit_test_support",
419       "//device/gamepad:java",
420       "//mojo/public/java:bindings_java",
421       "//third_party/android_deps:android_support_annotations_java",
422     ]
423     srcjar_deps = [ "//device/gamepad:java_enums_srcjar" ]
424   }
425
426   java_cpp_enum("bluetooth_test_javagen") {
427     sources = [
428       "bluetooth/test/bluetooth_test.h",
429     ]
430   }
431 }