1#
2# libjingle
3# Copyright 2012 Google Inc.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are met:
7#
8#  1. Redistributions of source code must retain the above copyright notice,
9#     this list of conditions and the following disclaimer.
10#  2. Redistributions in binary form must reproduce the above copyright notice,
11#     this list of conditions and the following disclaimer in the documentation
12#     and/or other materials provided with the distribution.
13#  3. The name of the author may not be used to endorse or promote products
14#     derived from this software without specific prior written permission.
15#
16# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27{
28  'includes': ['build/common.gypi'],
29  'targets': [
30    {
31      'target_name': 'libjingle_unittest_main',
32      'type': 'static_library',
33      'dependencies': [
34        '<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils',
35        '<@(libjingle_tests_additional_deps)',
36      ],
37      'direct_dependent_settings': {
38        'include_dirs': [
39          '<(libyuv_dir)/include',
40          '<(DEPTH)/testing/gtest/include',
41          '<(DEPTH)/testing/gtest',
42        ],
43      },
44      'conditions': [
45        ['build_libyuv==1', {
46          'dependencies': ['<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv',],
47        }],
48      ],
49      'include_dirs': [
50         '<(DEPTH)/testing/gtest/include',
51         '<(DEPTH)/testing/gtest',
52       ],
53      'sources': [
54        'media/base/fakecapturemanager.h',
55        'media/base/fakemediaengine.h',
56        'media/base/fakenetworkinterface.h',
57        'media/base/fakertp.h',
58        'media/base/fakevideocapturer.h',
59        'media/base/fakevideorenderer.h',
60        'media/base/testutils.cc',
61        'media/base/testutils.h',
62        'media/devices/fakedevicemanager.h',
63        'media/webrtc/fakewebrtccall.cc',
64        'media/webrtc/fakewebrtccall.h',
65        'media/webrtc/fakewebrtccommon.h',
66        'media/webrtc/fakewebrtcdeviceinfo.h',
67        'media/webrtc/fakewebrtcvcmfactory.h',
68        'media/webrtc/fakewebrtcvideocapturemodule.h',
69        'media/webrtc/fakewebrtcvideoengine.h',
70        'media/webrtc/fakewebrtcvoiceengine.h',
71      ],
72    },  # target libjingle_unittest_main
73    {
74      'target_name': 'libjingle_media_unittest',
75      'type': 'executable',
76      'dependencies': [
77        '<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils',
78        'libjingle.gyp:libjingle_media',
79        'libjingle_unittest_main',
80      ],
81      'sources': [
82        'media/base/capturemanager_unittest.cc',
83        'media/base/codec_unittest.cc',
84        'media/base/rtpdataengine_unittest.cc',
85        'media/base/rtpdump_unittest.cc',
86        'media/base/rtputils_unittest.cc',
87        'media/base/streamparams_unittest.cc',
88        'media/base/testutils.cc',
89        'media/base/testutils.h',
90        'media/base/videoadapter_unittest.cc',
91        'media/base/videocapturer_unittest.cc',
92        'media/base/videocommon_unittest.cc',
93        'media/base/videoengine_unittest.h',
94        'media/base/videoframe_unittest.h',
95        'media/devices/dummydevicemanager_unittest.cc',
96        'media/devices/filevideocapturer_unittest.cc',
97        'media/sctp/sctpdataengine_unittest.cc',
98        'media/webrtc/simulcast_unittest.cc',
99        'media/webrtc/webrtcmediaengine_unittest.cc',
100        'media/webrtc/webrtcvideocapturer_unittest.cc',
101        'media/webrtc/webrtcvideoframe_unittest.cc',
102        'media/webrtc/webrtcvideoframefactory_unittest.cc',
103        # Disabled because some tests fail.
104        # TODO(ronghuawu): Reenable these tests.
105        # 'media/devices/devicemanager_unittest.cc',
106        'media/webrtc/webrtcvideoengine2_unittest.cc',
107        'media/webrtc/webrtcvoiceengine_unittest.cc',
108      ],
109      'conditions': [
110        ['OS=="win"', {
111          'conditions': [
112            ['use_openssl==0', {
113              'dependencies': [
114                '<(DEPTH)/net/third_party/nss/ssl.gyp:libssl',
115                '<(DEPTH)/third_party/nss/nss.gyp:nspr',
116                '<(DEPTH)/third_party/nss/nss.gyp:nss',
117              ],
118            }],
119          ],
120          'msvs_settings': {
121            'VCLinkerTool': {
122              'AdditionalDependencies': [
123                # TODO(ronghuawu): Since we've included strmiids in
124                # libjingle_media target, we shouldn't need this here.
125                # Find out why it doesn't work without this.
126                'strmiids.lib',
127              ],
128            },
129          },
130        }],
131        ['OS=="win" and clang==1', {
132          'msvs_settings': {
133            'VCCLCompilerTool': {
134              'AdditionalOptions': [
135                # Disable warnings failing when compiling with Clang on Windows.
136                # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
137                '-Wno-unused-function',
138              ],
139            },
140          },
141        },],
142        ['OS=="ios"', {
143          'sources!': [
144            'media/sctp/sctpdataengine_unittest.cc',
145          ],
146        }],
147      ],
148    },  # target libjingle_media_unittest
149    {
150      'target_name': 'libjingle_p2p_unittest',
151      'type': 'executable',
152      'dependencies': [
153        '<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils',
154        'libjingle.gyp:libjingle',
155        'libjingle.gyp:libjingle_peerconnection',
156        'libjingle.gyp:libjingle_p2p',
157        'libjingle_unittest_main',
158      ],
159      'include_dirs': [
160        '<(DEPTH)/third_party/libsrtp/srtp',
161      ],
162      'sources': [
163        'session/media/bundlefilter_unittest.cc',
164        'session/media/channel_unittest.cc',
165        'session/media/channelmanager_unittest.cc',
166        'session/media/currentspeakermonitor_unittest.cc',
167        'session/media/mediasession_unittest.cc',
168        'session/media/rtcpmuxfilter_unittest.cc',
169        'session/media/srtpfilter_unittest.cc',
170      ],
171      'conditions': [
172        ['build_libsrtp==1', {
173          'dependencies': [
174            '<(DEPTH)/third_party/libsrtp/libsrtp.gyp:libsrtp',
175          ],
176        }],
177        ['OS=="win"', {
178          'msvs_settings': {
179            'VCLinkerTool': {
180              'AdditionalDependencies': [
181                'strmiids.lib',
182              ],
183            },
184          },
185        }],
186      ],
187    },  # target libjingle_p2p_unittest
188    {
189      'target_name': 'libjingle_peerconnection_unittest',
190      'type': '<(gtest_target_type)',
191      'dependencies': [
192        '<(DEPTH)/testing/gmock.gyp:gmock',
193        '<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils',
194        '<(webrtc_root)/common.gyp:webrtc_common',
195        'libjingle.gyp:libjingle',
196        'libjingle.gyp:libjingle_p2p',
197        'libjingle.gyp:libjingle_peerconnection',
198        'libjingle_unittest_main',
199      ],
200      'direct_dependent_settings': {
201        'include_dirs': [
202          '<(DEPTH)/testing/gmock/include',
203        ],
204      },
205      'sources': [
206        'app/webrtc/datachannel_unittest.cc',
207        'app/webrtc/dtlsidentitystore_unittest.cc',
208        'app/webrtc/dtmfsender_unittest.cc',
209        'app/webrtc/fakemetricsobserver.cc',
210        'app/webrtc/fakemetricsobserver.h',
211        'app/webrtc/jsepsessiondescription_unittest.cc',
212        'app/webrtc/localaudiosource_unittest.cc',
213        'app/webrtc/mediastream_unittest.cc',
214        'app/webrtc/peerconnection_unittest.cc',
215        'app/webrtc/peerconnectionendtoend_unittest.cc',
216        'app/webrtc/peerconnectionfactory_unittest.cc',
217        'app/webrtc/peerconnectioninterface_unittest.cc',
218        # 'app/webrtc/peerconnectionproxy_unittest.cc',
219        'app/webrtc/remotevideocapturer_unittest.cc',
220        'app/webrtc/rtpsenderreceiver_unittest.cc',
221        'app/webrtc/statscollector_unittest.cc',
222        'app/webrtc/test/fakeaudiocapturemodule.cc',
223        'app/webrtc/test/fakeaudiocapturemodule.h',
224        'app/webrtc/test/fakeaudiocapturemodule_unittest.cc',
225        'app/webrtc/test/fakeconstraints.h',
226        'app/webrtc/test/fakedatachannelprovider.h',
227        'app/webrtc/test/fakedtlsidentitystore.h',
228        'app/webrtc/test/fakeperiodicvideocapturer.h',
229        'app/webrtc/test/fakevideotrackrenderer.h',
230        'app/webrtc/test/mockpeerconnectionobservers.h',
231        'app/webrtc/test/peerconnectiontestwrapper.h',
232        'app/webrtc/test/peerconnectiontestwrapper.cc',
233        'app/webrtc/test/testsdpstrings.h',
234        'app/webrtc/videosource_unittest.cc',
235        'app/webrtc/videotrack_unittest.cc',
236        'app/webrtc/webrtcsdp_unittest.cc',
237        'app/webrtc/webrtcsession_unittest.cc',
238      ],
239      'conditions': [
240        ['OS=="android"', {
241          'sources': [
242            'app/webrtc/test/androidtestinitializer.cc',
243            'app/webrtc/test/androidtestinitializer.h',
244          ],
245          'dependencies': [
246            '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
247            'libjingle.gyp:libjingle_peerconnection_jni',
248          ],
249        }],
250        ['OS=="win" and clang==1', {
251          'msvs_settings': {
252            'VCCLCompilerTool': {
253              'AdditionalOptions': [
254                # Disable warnings failing when compiling with Clang on Windows.
255                # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
256                '-Wno-unused-function',
257              ],
258            },
259          },
260        }],
261      ],
262    },  # target libjingle_peerconnection_unittest
263  ],
264  'conditions': [
265    ['OS=="linux"', {
266      'variables': {
267        'junit_jar': '<(DEPTH)/third_party/junit-jar/junit-4.11.jar',
268      },
269      'targets': [
270        {
271          'target_name': 'libjingle_peerconnection_test_jar',
272          'type': 'none',
273          'dependencies': [
274            'libjingle.gyp:libjingle_peerconnection_jar',
275          ],
276          'actions': [
277            {
278              'variables': {
279                'java_src_dir': 'app/webrtc/javatests/src',
280                'java_files': [
281                  'app/webrtc/java/testcommon/src/org/webrtc/PeerConnectionTest.java',
282                  'app/webrtc/javatests/src/org/webrtc/PeerConnectionTestJava.java',
283                ],
284              },
285              'action_name': 'create_jar',
286              'inputs': [
287                'build/build_jar.sh',
288                '<@(java_files)',
289                '<(PRODUCT_DIR)/libjingle_peerconnection.jar',
290                '<(PRODUCT_DIR)/lib/libjingle_peerconnection_so.so',
291                '<(junit_jar)',
292              ],
293              'outputs': [
294                '<(PRODUCT_DIR)/libjingle_peerconnection_test.jar',
295              ],
296              'action': [
297                'build/build_jar.sh', '<(java_home)', '<@(_outputs)',
298                '<(INTERMEDIATE_DIR)',
299                '<(java_src_dir):<(PRODUCT_DIR)/libjingle_peerconnection.jar:<(junit_jar)',
300                '<@(java_files)'
301              ],
302            },
303          ],
304        },
305        {
306          'target_name': 'libjingle_peerconnection_java_unittest',
307          'type': 'none',
308          'actions': [
309            {
310              'action_name': 'copy libjingle_peerconnection_java_unittest',
311              'inputs': [
312                'app/webrtc/javatests/libjingle_peerconnection_java_unittest.sh',
313                '<(PRODUCT_DIR)/libjingle_peerconnection_test_jar',
314                '<(junit_jar)',
315              ],
316              'outputs': [
317                '<(PRODUCT_DIR)/libjingle_peerconnection_java_unittest',
318              ],
319              'action': [
320                'bash', '-c',
321                'rm -f <(PRODUCT_DIR)/libjingle_peerconnection_java_unittest && '
322                'sed -e "s@GYP_JAVA_HOME@<(java_home)@" '
323                '< app/webrtc/javatests/libjingle_peerconnection_java_unittest.sh '
324                '> <(PRODUCT_DIR)/libjingle_peerconnection_java_unittest && '
325                'cp <(junit_jar) <(PRODUCT_DIR) && '
326                'chmod u+x <(PRODUCT_DIR)/libjingle_peerconnection_java_unittest'
327              ],
328            },
329          ],
330        },
331      ],
332    }],
333    ['OS=="android"', {
334      'targets': [
335        {
336          'target_name': 'libjingle_peerconnection_android_unittest',
337          'type': 'none',
338          'dependencies': [
339            'libjingle.gyp:libjingle_peerconnection_java',
340          ],
341          'variables': {
342            'apk_name': 'libjingle_peerconnection_android_unittest',
343            'java_in_dir': 'app/webrtc/androidtests',
344            'resource_dir': 'app/webrtc/androidtests/res',
345            'additional_src_dirs': ['app/webrtc/java/testcommon'],
346            'native_lib_target': 'libjingle_peerconnection_so',
347            'is_test_apk': 1,
348          },
349          'includes': [ '../build/java_apk.gypi' ],
350        },
351      ],  # targets
352    }],  # OS=="android"
353    ['OS=="ios" or (OS=="mac" and target_arch!="ia32")', {
354      # The >=10.7 above is required to make ARC link cleanly (e.g. as
355      # opposed to _compile_ cleanly, which the library under test
356      # does just fine on 10.6 too).
357      'targets': [
358        {
359          'target_name': 'libjingle_peerconnection_objc_test',
360          'type': 'executable',
361          'includes': [ 'build/objc_app.gypi' ],
362          'dependencies': [
363            '<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils',
364            '<(webrtc_root)/system_wrappers/system_wrappers.gyp:field_trial_default',
365            'libjingle.gyp:libjingle_peerconnection_objc',
366          ],
367          'sources': [
368            'app/webrtc/objctests/RTCPeerConnectionSyncObserver.h',
369            'app/webrtc/objctests/RTCPeerConnectionSyncObserver.m',
370            'app/webrtc/objctests/RTCPeerConnectionTest.mm',
371            'app/webrtc/objctests/RTCSessionDescriptionSyncObserver.h',
372            'app/webrtc/objctests/RTCSessionDescriptionSyncObserver.m',
373            # TODO(fischman): figure out if this works for ios or if it
374            # needs a GUI driver.
375            'app/webrtc/objctests/mac/main.mm',
376          ],
377          'conditions': [
378            ['OS=="mac"', {
379              'xcode_settings': {
380                # Need to build against 10.7 framework for full ARC support
381                # on OSX.
382                'MACOSX_DEPLOYMENT_TARGET' : '10.7',
383                # common.gypi enables this for mac but we want this to be
384                # disabled like it is for ios.
385                'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'NO',
386              },
387            }],
388          ],
389        },  # target libjingle_peerconnection_objc_test
390        {
391          'target_name': 'apprtc_signaling_gunit_test',
392          'type': 'executable',
393          'includes': [ 'build/objc_app.gypi' ],
394          'dependencies': [
395            '<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils',
396            '<(webrtc_root)/system_wrappers/system_wrappers.gyp:field_trial_default',
397            '<(DEPTH)/third_party/ocmock/ocmock.gyp:ocmock',
398            '<(webrtc_root)/webrtc_examples.gyp:apprtc_signaling',
399          ],
400          'sources': [
401            'app/webrtc/objctests/mac/main.mm',
402            '<(webrtc_root)/examples/objc/AppRTCDemo/tests/ARDAppClientTest.mm',
403          ],
404          'conditions': [
405            ['OS=="mac"', {
406              'xcode_settings': {
407                'MACOSX_DEPLOYMENT_TARGET' : '10.8',
408              },
409            }],
410          ],
411        },  # target apprtc_signaling_gunit_test
412      ],
413    }],
414    ['OS=="android"', {
415      'targets': [
416        {
417          'target_name': 'libjingle_peerconnection_unittest_apk_target',
418          'type': 'none',
419          'dependencies': [
420            '<(DEPTH)/webrtc/build/apk_tests.gyp:libjingle_peerconnection_unittest_apk',
421          ],
422        },
423      ],
424    }],
425    ['test_isolation_mode != "noop"', {
426      'targets': [
427        {
428          'target_name': 'libjingle_media_unittest_run',
429          'type': 'none',
430          'dependencies': [
431            'libjingle_media_unittest',
432          ],
433          'includes': [
434            'build/isolate.gypi',
435          ],
436          'sources': [
437            'libjingle_media_unittest.isolate',
438          ],
439        },
440        {
441          'target_name': 'libjingle_p2p_unittest_run',
442          'type': 'none',
443          'dependencies': [
444            'libjingle_p2p_unittest',
445          ],
446          'includes': [
447            'build/isolate.gypi',
448          ],
449          'sources': [
450            'libjingle_p2p_unittest.isolate',
451          ],
452        },
453        {
454          'target_name': 'libjingle_peerconnection_unittest_run',
455          'type': 'none',
456          'dependencies': [
457            'libjingle_peerconnection_unittest',
458          ],
459          'includes': [
460            'build/isolate.gypi',
461          ],
462          'sources': [
463            'libjingle_peerconnection_unittest.isolate',
464          ],
465        },
466      ],
467    }],
468  ],
469}
470