1# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS.  All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9# TODO(andrew): consider moving test_support to src/base/test.
10{
11  'includes': [
12    '../build/common.gypi',
13  ],
14  'targets': [
15    {
16      'target_name': 'channel_transport',
17      'type': 'static_library',
18      'dependencies': [
19        '<(DEPTH)/testing/gtest.gyp:gtest',
20        '<(webrtc_root)/common.gyp:webrtc_common',
21        '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
22      ],
23      'sources': [
24        'channel_transport/channel_transport.cc',
25        'channel_transport/channel_transport.h',
26        'channel_transport/traffic_control_win.cc',
27        'channel_transport/traffic_control_win.h',
28        'channel_transport/udp_socket_manager_posix.cc',
29        'channel_transport/udp_socket_manager_posix.h',
30        'channel_transport/udp_socket_manager_wrapper.cc',
31        'channel_transport/udp_socket_manager_wrapper.h',
32        'channel_transport/udp_socket_posix.cc',
33        'channel_transport/udp_socket_posix.h',
34        'channel_transport/udp_socket_wrapper.cc',
35        'channel_transport/udp_socket_wrapper.h',
36        'channel_transport/udp_socket2_manager_win.cc',
37        'channel_transport/udp_socket2_manager_win.h',
38        'channel_transport/udp_socket2_win.cc',
39        'channel_transport/udp_socket2_win.h',
40        'channel_transport/udp_transport.h',
41        'channel_transport/udp_transport_impl.cc',
42        'channel_transport/udp_transport_impl.h',
43      ],
44      'conditions': [
45        ['OS=="win" and clang==1', {
46          'msvs_settings': {
47            'VCCLCompilerTool': {
48              'AdditionalOptions': [
49                # Disable warnings failing when compiling with Clang on Windows.
50                # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
51                '-Wno-parentheses-equality',
52                '-Wno-reorder',
53                '-Wno-tautological-constant-out-of-range-compare',
54                '-Wno-unused-private-field',
55              ],
56            },
57          },
58        }],
59      ],  # conditions.
60    },
61    {
62      'target_name': 'fake_video_frames',
63      'type': 'static_library',
64      'sources': [
65        'fake_texture_frame.cc',
66        'fake_texture_frame.h',
67        'frame_generator.cc',
68        'frame_generator.h',
69      ],
70      'dependencies': [
71        '<(webrtc_root)/common_video/common_video.gyp:common_video',
72      ],
73    },
74    {
75      'target_name': 'rtp_test_utils',
76      'type': 'static_library',
77      'sources': [
78        'rtcp_packet_parser.cc',
79        'rtcp_packet_parser.h',
80        'rtp_file_reader.cc',
81        'rtp_file_reader.h',
82        'rtp_file_writer.cc',
83        'rtp_file_writer.h',
84      ],
85      'dependencies': [
86        '<(DEPTH)/webrtc/common.gyp:webrtc_common',
87        '<(DEPTH)/testing/gtest.gyp:gtest',
88        '<(webrtc_root)/modules/modules.gyp:rtp_rtcp',
89      ],
90    },
91    {
92      'target_name': 'field_trial',
93      'type': 'static_library',
94      'sources': [
95        'field_trial.cc',
96        'field_trial.h',
97      ],
98      'dependencies': [
99        '<(webrtc_root)/common.gyp:webrtc_common',
100        '<(webrtc_root)/system_wrappers/system_wrappers.gyp:field_trial_default',
101        '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
102      ],
103    },
104    {
105      'target_name': 'histogram',
106      'type': 'static_library',
107      'sources': [
108        'histogram.cc',
109        'histogram.h',
110      ],
111      'dependencies': [
112        '<(webrtc_root)/common.gyp:webrtc_common',
113        '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
114      ],
115    },
116    {
117      'target_name': 'test_main',
118      'type': 'static_library',
119      'sources': [
120        'test_main.cc',
121      ],
122      'dependencies': [
123        'field_trial',
124        'histogram',
125        'test_support',
126        '<(DEPTH)/testing/gtest.gyp:gtest',
127        '<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
128      ],
129    },
130    {
131      'target_name': 'test_support',
132      'type': 'static_library',
133      'dependencies': [
134        '<(DEPTH)/testing/gtest.gyp:gtest',
135        '<(DEPTH)/testing/gmock.gyp:gmock',
136        '<(webrtc_root)/common.gyp:gtest_prod',
137        '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
138      ],
139      'sources': [
140        'testsupport/fileutils.cc',
141        'testsupport/fileutils.h',
142        'testsupport/frame_reader.cc',
143        'testsupport/frame_reader.h',
144        'testsupport/frame_writer.cc',
145        'testsupport/frame_writer.h',
146        'testsupport/iosfileutils.mm',
147        'testsupport/mock/mock_frame_reader.h',
148        'testsupport/mock/mock_frame_writer.h',
149        'testsupport/packet_reader.cc',
150        'testsupport/packet_reader.h',
151        'testsupport/perf_test.cc',
152        'testsupport/perf_test.h',
153        'testsupport/trace_to_stderr.cc',
154        'testsupport/trace_to_stderr.h',
155      ],
156      'conditions': [
157        ['OS=="ios"', {
158          'xcode_settings': {
159            'CLANG_ENABLE_OBJC_ARC': 'YES',
160          },
161        }],
162        ['use_x11==1', {
163          'dependencies': [
164            '<(DEPTH)/tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
165          ],
166        }],
167      ],
168    },
169    {
170      # Depend on this target when you want to have test_support but also the
171      # main method needed for gtest to execute!
172      'target_name': 'test_support_main',
173      'type': 'static_library',
174      'dependencies': [
175        'field_trial',
176        'histogram',
177        'test_support',
178        '<(DEPTH)/testing/gmock.gyp:gmock',
179        '<(DEPTH)/testing/gtest.gyp:gtest',
180        '<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
181      ],
182      'sources': [
183        'run_all_unittests.cc',
184        'test_suite.cc',
185        'test_suite.h',
186      ],
187    },
188    {
189      # Depend on this target when you want to have test_support and a special
190      # main for mac which will run your test on a worker thread and consume
191      # events on the main thread. Useful if you want to access a webcam.
192      # This main will provide all the scaffolding and objective-c black magic
193      # for you. All you need to do is to implement a function in the
194      # run_threaded_main_mac.h file (ImplementThisToRunYourTest).
195      'target_name': 'test_support_main_threaded_mac',
196      'type': 'static_library',
197      'dependencies': [
198        'test_support',
199      ],
200      'sources': [
201        'testsupport/mac/run_threaded_main_mac.h',
202        'testsupport/mac/run_threaded_main_mac.mm',
203      ],
204    },
205    {
206      'target_name': 'test_support_unittests',
207      'type': '<(gtest_target_type)',
208      'dependencies': [
209        'channel_transport',
210        'test_support_main',
211        '<(DEPTH)/testing/gmock.gyp:gmock',
212        '<(DEPTH)/testing/gtest.gyp:gtest',
213      ],
214      'sources': [
215        'channel_transport/udp_transport_unittest.cc',
216        'channel_transport/udp_socket_manager_unittest.cc',
217        'channel_transport/udp_socket_wrapper_unittest.cc',
218        'testsupport/always_passing_unittest.cc',
219        'testsupport/unittest_utils.h',
220        'testsupport/fileutils_unittest.cc',
221        'testsupport/frame_reader_unittest.cc',
222        'testsupport/frame_writer_unittest.cc',
223        'testsupport/packet_reader_unittest.cc',
224        'testsupport/perf_test_unittest.cc',
225      ],
226      # Disable warnings to enable Win64 build, issue 1323.
227      'msvs_disabled_warnings': [
228        4267,  # size_t to int truncation.
229      ],
230      'conditions': [
231        ['OS=="android"', {
232          'dependencies': [
233            '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
234          ],
235        }],
236      ],
237    },
238  ],
239  'conditions': [
240    ['include_tests==1 and OS=="android"', {
241      'targets': [
242        {
243          'target_name': 'test_support_unittests_apk_target',
244          'type': 'none',
245          'dependencies': [
246            '<(apk_tests_path):test_support_unittests_apk',
247          ],
248        },
249      ],
250    }],
251    ['test_isolation_mode != "noop"', {
252      'targets': [
253        {
254          'target_name': 'test_support_unittests_run',
255          'type': 'none',
256          'dependencies': [
257            'test_support_unittests',
258          ],
259          'includes': [
260            '../build/isolate.gypi',
261          ],
262          'sources': [
263            'test_support_unittests.isolate',
264          ],
265        },
266      ],
267    }],
268  ],
269}
270