1# Copyright 2014 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{
6  'targets': [
7    {
8      'target_name': 'remoting_test_common',
9      'type': 'static_library',
10      'dependencies': [
11        '../base/base.gyp:base',
12        '../net/net.gyp:net_test_support',
13        '../testing/gmock.gyp:gmock',
14        '../testing/gtest.gyp:gtest',
15        'remoting_base',
16        'remoting_client',
17        'remoting_host',
18        'remoting_protocol',
19        'remoting_resources',
20      ],
21      'sources': [
22        'host/fake_desktop_capturer.cc',
23        'host/fake_desktop_capturer.h',
24        'host/fake_desktop_environment.cc',
25        'host/fake_desktop_environment.h',
26        'host/fake_host_status_monitor.h',
27        'host/fake_mouse_cursor_monitor.cc',
28        'host/fake_mouse_cursor_monitor.h',
29        'host/policy_hack/fake_policy_watcher.cc',
30        'host/policy_hack/fake_policy_watcher.h',
31        'host/policy_hack/mock_policy_callback.cc',
32        'host/policy_hack/mock_policy_callback.h',
33        'protocol/fake_authenticator.cc',
34        'protocol/fake_authenticator.h',
35        'protocol/fake_datagram_socket.cc',
36        'protocol/fake_datagram_socket.h',
37        'protocol/fake_session.cc',
38        'protocol/fake_session.h',
39        'protocol/fake_stream_socket.cc',
40        'protocol/fake_stream_socket.h',
41        'protocol/protocol_mock_objects.cc',
42        'protocol/protocol_mock_objects.h',
43        'signaling/fake_signal_strategy.cc',
44        'signaling/fake_signal_strategy.h',
45        'signaling/mock_signal_strategy.cc',
46        'signaling/mock_signal_strategy.h',
47        'test/fake_network_dispatcher.cc',
48        'test/fake_network_dispatcher.h',
49        'test/fake_network_manager.cc',
50        'test/fake_network_manager.h',
51        'test/fake_port_allocator.cc',
52        'test/fake_port_allocator.h',
53        'test/fake_socket_factory.cc',
54        'test/fake_socket_factory.h',
55        'test/leaky_bucket.cc',
56        'test/leaky_bucket.h',
57      ],
58      'conditions': [
59        ['enable_remoting_host == 0', {
60          'dependencies!': [
61            'remoting_host',
62          ],
63          'sources/': [
64            ['exclude', '^host/'],
65          ]
66        }],
67      ],
68    },
69
70    # Remoting unit tests
71    {
72      'target_name': 'remoting_unittests',
73      'type': '<(gtest_target_type)',
74      'dependencies': [
75        '../base/base.gyp:base',
76        '../base/base.gyp:base_i18n',
77        '../base/base.gyp:test_support_base',
78        '../ipc/ipc.gyp:ipc',
79        '../net/net.gyp:net_test_support',
80        '../ppapi/ppapi.gyp:ppapi_cpp',
81        '../testing/gmock.gyp:gmock',
82        '../testing/gtest.gyp:gtest',
83        '../third_party/libyuv/libyuv.gyp:libyuv',
84        '../third_party/webrtc/modules/modules.gyp:desktop_capture',
85        '../ui/base/ui_base.gyp:ui_base',
86        '../ui/gfx/gfx.gyp:gfx',
87        '../ui/gfx/gfx.gyp:gfx_geometry',
88        'remoting_base',
89        'remoting_breakpad',
90        'remoting_client',
91        'remoting_client_plugin',
92        'remoting_host',
93        'remoting_host_setup_base',
94        'remoting_it2me_host_static',
95        'remoting_native_messaging_base',
96        'remoting_protocol',
97        'remoting_resources',
98        'remoting_test_common',
99      ],
100      'defines': [
101        'VERSION=<(version_full)',
102      ],
103      'include_dirs': [
104        '../testing/gmock/include',
105      ],
106      'sources': [
107        'base/auth_token_util_unittest.cc',
108        'base/auto_thread_task_runner_unittest.cc',
109        'base/auto_thread_unittest.cc',
110        'base/breakpad_win_unittest.cc',
111        'base/capabilities_unittest.cc',
112        'base/compound_buffer_unittest.cc',
113        'base/rate_counter_unittest.cc',
114        'base/resources_unittest.cc',
115        'base/rsa_key_pair_unittest.cc',
116        'base/run_all_unittests.cc',
117        'base/running_average_unittest.cc',
118        'base/test_rsa_key_pair.h',
119        'base/typed_buffer_unittest.cc',
120        'base/util_unittest.cc',
121        'client/audio_player_unittest.cc',
122        'client/client_status_logger_unittest.cc',
123        'client/key_event_mapper_unittest.cc',
124        'client/plugin/normalizing_input_filter_cros_unittest.cc',
125        'client/plugin/normalizing_input_filter_mac_unittest.cc',
126        'client/server_log_entry_client_unittest.cc',
127        'codec/audio_encoder_opus_unittest.cc',
128        'codec/codec_test.cc',
129        'codec/codec_test.h',
130        'codec/video_decoder_vpx_unittest.cc',
131        'codec/video_encoder_helper_unittest.cc',
132        'codec/video_encoder_verbatim_unittest.cc',
133        'codec/video_encoder_vpx_unittest.cc',
134        'host/audio_silence_detector_unittest.cc',
135        'host/branding.cc',
136        'host/branding.h',
137        'host/capture_scheduler_unittest.cc',
138        'host/chromeos/aura_desktop_capturer_unittest.cc',
139        'host/chromoting_host_context_unittest.cc',
140        'host/chromoting_host_unittest.cc',
141        'host/client_session_unittest.cc',
142        'host/config_file_watcher_unittest.cc',
143        'host/daemon_process_unittest.cc',
144        'host/desktop_process_unittest.cc',
145        'host/desktop_shape_tracker_unittest.cc',
146        'host/fake_desktop_capturer.cc',
147        'host/fake_desktop_capturer.h',
148        'host/fake_host_extension.cc',
149        'host/fake_host_extension.h',
150        'host/fake_host_status_monitor.h',
151        'host/gnubby_auth_handler_posix_unittest.cc',
152        'host/heartbeat_sender_unittest.cc',
153        'host/host_change_notification_listener_unittest.cc',
154        'host/host_extension_session_manager_unittest.cc',
155        'host/host_mock_objects.cc',
156        'host/host_status_logger_unittest.cc',
157        'host/host_status_sender_unittest.cc',
158        'host/ipc_desktop_environment_unittest.cc',
159        'host/it2me/it2me_native_messaging_host_unittest.cc',
160        'host/json_host_config_unittest.cc',
161        'host/linux/audio_pipe_reader_unittest.cc',
162        'host/linux/unicode_to_keysym_unittest.cc',
163        'host/linux/x_server_clipboard_unittest.cc',
164        'host/local_input_monitor_unittest.cc',
165        'host/native_messaging/native_messaging_reader_unittest.cc',
166        'host/native_messaging/native_messaging_writer_unittest.cc',
167        'host/pairing_registry_delegate_linux_unittest.cc',
168        'host/pairing_registry_delegate_win_unittest.cc',
169        'host/pin_hash_unittest.cc',
170        'host/policy_hack/policy_watcher_unittest.cc',
171        'host/register_support_host_request_unittest.cc',
172        'host/remote_input_filter_unittest.cc',
173        'host/resizing_host_observer_unittest.cc',
174        'host/screen_resolution_unittest.cc',
175        'host/server_log_entry_host_unittest.cc',
176        'host/setup/me2me_native_messaging_host.cc',
177        'host/setup/me2me_native_messaging_host.h',
178        'host/setup/me2me_native_messaging_host_unittest.cc',
179        'host/setup/oauth_helper_unittest.cc',
180        'host/setup/pin_validator_unittest.cc',
181        'host/shaped_desktop_capturer_unittest.cc',
182        'host/token_validator_factory_impl_unittest.cc',
183        'host/video_frame_recorder_unittest.cc',
184        'host/video_scheduler_unittest.cc',
185        'host/win/rdp_client_unittest.cc',
186        'host/win/worker_process_launcher.cc',
187        'host/win/worker_process_launcher.h',
188        'host/win/worker_process_launcher_unittest.cc',
189        'protocol/authenticator_test_base.cc',
190        'protocol/authenticator_test_base.h',
191        'protocol/buffered_socket_writer_unittest.cc',
192        'protocol/channel_multiplexer_unittest.cc',
193        'protocol/chromium_socket_factory_unittest.cc',
194        'protocol/clipboard_echo_filter_unittest.cc',
195        'protocol/clipboard_filter_unittest.cc',
196        'protocol/connection_tester.cc',
197        'protocol/connection_tester.h',
198        'protocol/connection_to_client_unittest.cc',
199        'protocol/content_description_unittest.cc',
200        'protocol/input_event_tracker_unittest.cc',
201        'protocol/input_filter_unittest.cc',
202        'protocol/jingle_messages_unittest.cc',
203        'protocol/jingle_session_unittest.cc',
204        'protocol/message_decoder_unittest.cc',
205        'protocol/message_reader_unittest.cc',
206        'protocol/monitored_video_stub_unittest.cc',
207        'protocol/mouse_input_filter_unittest.cc',
208        'protocol/negotiating_authenticator_unittest.cc',
209        'protocol/network_settings_unittest.cc',
210        'protocol/pairing_registry_unittest.cc',
211        'protocol/ppapi_module_stub.cc',
212        'protocol/ssl_hmac_channel_authenticator_unittest.cc',
213        'protocol/third_party_authenticator_unittest.cc',
214        'protocol/v2_authenticator_unittest.cc',
215        'signaling/fake_signal_strategy.cc',
216        'signaling/fake_signal_strategy.h',
217        'signaling/iq_sender_unittest.cc',
218        'signaling/log_to_server_unittest.cc',
219        'signaling/server_log_entry_unittest.cc',
220        'signaling/server_log_entry_unittest.h',
221      ],
222      'conditions': [
223        [ 'OS=="win"', {
224          'defines': [
225            '_ATL_NO_EXCEPTIONS',
226          ],
227          'include_dirs': [
228            '../breakpad/src',
229          ],
230          'link_settings': {
231            'libraries': [
232              '-lrpcrt4.lib',
233              '-lwtsapi32.lib',
234            ],
235          },
236        }],
237        [ 'OS=="android"', {
238          'dependencies!': [
239            'remoting_client_plugin',
240          ],
241        }],
242        [ 'OS=="android"', {
243          'dependencies': [
244            '../testing/android/native_test.gyp:native_test_native_code',
245          ],
246        }],
247        [ 'chromeos==0', {
248          'sources!': [
249            'client/plugin/normalizing_input_filter_cros_unittest.cc',
250            'host/chromeos/aura_desktop_capturer_unittest.cc',
251          ],
252        }],
253        ['enable_remoting_host == 0', {
254          'dependencies!': [
255            'remoting_host',
256            'remoting_host_setup_base',
257            'remoting_native_messaging_base',
258          ],
259          'sources/': [
260            ['exclude', '^codec/'],
261            ['exclude', '^host/'],
262            ['exclude', '^base/resources_unittest\\.cc$'],
263          ]
264        }],
265        ['enable_it2me_host == 0', {
266          'dependencies!': [
267            'remoting_it2me_host_static',
268          ],
269          'sources/': [
270            ['exclude', '^host/it2me/'],
271          ]
272        }],
273        [ 'OS == "linux" and use_allocator!="none"', {
274          'dependencies': [
275            '../base/allocator/allocator.gyp:allocator',
276          ],
277        }],
278      ],  # end of 'conditions'
279    },  # end of target 'remoting_unittests'
280    {
281      'target_name': 'remoting_browser_test_resources',
282      'type': 'none',
283      'variables': {
284        'zip_script': '../build/android/gyp/zip.py',
285      },
286      'copies': [
287        {
288          'destination': '<(PRODUCT_DIR)',
289            'files': [
290              '<@(remoting_webapp_js_browser_test_files)',
291            ],
292        },
293      ], #end of copies
294      'actions': [
295        {
296          # Store the browser test resources into a zip file so there is a
297          # consistent filename to reference for build archiving (i.e. in
298          # FILES.cfg).
299          'action_name': 'zip browser test resources',
300          'inputs': [
301            '<(zip_script)',
302            '<@(remoting_webapp_js_browser_test_files)'
303          ],
304          'outputs': [
305            '<(PRODUCT_DIR)/remoting-browser-tests.zip',
306          ],
307          'action': [
308            'python',
309            '<(zip_script)',
310            '--input-dir', 'webapp/browser_test',
311            '--output', '<@(_outputs)',
312           ],
313        },
314      ], # end of actions
315    },  # end of target 'remoting_browser_test_resources'
316    {
317      'target_name': 'remoting_webapp_unittest',
318      'type': 'none',
319      'variables': {
320        'output_dir': '<(PRODUCT_DIR)/remoting/unittests',
321        'webapp_js_files': [
322          '<@(remoting_webapp_main_html_js_files)',
323          '<@(remoting_webapp_js_wcs_sandbox_files)',
324          '<@(remoting_webapp_background_js_files)',
325        ]
326      },
327      'copies': [
328        {
329          'destination': '<(output_dir)/qunit',
330          'files': [
331            '../third_party/qunit/src/browser_test_harness.js',
332            '../third_party/qunit/src/qunit.css',
333            '../third_party/qunit/src/qunit.js',
334          ],
335        },
336        {
337          'destination': '<(output_dir)/blanketjs',
338          'files': [
339            '../third_party/blanketjs/src/blanket.js',
340            '../third_party/blanketjs/src/qunit_adapter.js',
341          ],
342        },
343        {
344          'destination': '<(output_dir)/sinonjs',
345          'files': [
346            '../third_party/sinonjs/src/sinon.js',
347            '../third_party/sinonjs/src/sinon-qunit.js',
348          ],
349        },
350        {
351          'destination': '<(output_dir)',
352          'files': [
353            '<@(webapp_js_files)',
354            '<@(remoting_webapp_unittest_js_files)',
355            '<@(remoting_webapp_unittest_additional_files)'
356          ],
357        },
358      ],
359      'actions': [
360        {
361          'action_name': 'Build Remoting Webapp unittest.html',
362          'inputs': [
363            'webapp/build-html.py',
364            '<(remoting_webapp_unittest_template_main)',
365            '<@(webapp_js_files)',
366            '<@(remoting_webapp_unittest_js_files)'
367          ],
368          'outputs': [
369            '<(output_dir)/unittest.html',
370          ],
371          'action': [
372            'python', 'webapp/build-html.py',
373            '<@(_outputs)',
374            '<(remoting_webapp_unittest_template_main)',
375            # GYP automatically removes subsequent duplicated command line
376            # arguments.  Therefore, the excludejs flag must be set before the
377            # instrumentedjs flag or else GYP will ignore the files in the
378            # exclude list.
379            '--exclude-js', '<@(remoting_webapp_unittest_exclude_files)',
380            '--js', '<@(remoting_webapp_unittest_js_files)',
381            '--instrument-js', '<@(webapp_js_files)',
382           ],
383        },
384      ],
385    },  # end of target 'remoting_webapp_js_unittest'
386  ],  # end of targets
387
388  'conditions': [
389    ['enable_remoting_host==1', {
390      'targets': [
391        # Remoting performance tests
392        {
393          'target_name': 'remoting_perftests',
394          'type': '<(gtest_target_type)',
395          'dependencies': [
396            '../base/base.gyp:base',
397            '../base/base.gyp:test_support_base',
398            '../testing/gtest.gyp:gtest',
399            '../third_party/webrtc/modules/modules.gyp:desktop_capture',
400            '../third_party/libjingle/libjingle.gyp:libjingle',
401            'remoting_base',
402            'remoting_test_common',
403          ],
404          'defines': [
405            'VERSION=<(version_full)',
406          ],
407          'include_dirs': [
408            '../testing/gmock/include',
409          ],
410          'sources': [
411            'base/run_all_unittests.cc',
412            'codec/codec_test.cc',
413            'codec/codec_test.h',
414            'codec/video_encoder_vpx_perftest.cc',
415            'test/protocol_perftest.cc',
416          ],
417          'conditions': [
418            [ 'OS=="mac" or (OS=="linux" and chromeos==0)', {
419              # RunAllTests calls chrome::RegisterPathProvider() under Mac and
420              # Linux, so we need the chrome_common.gypi dependency.
421              'dependencies': [
422                '../chrome/common_constants.gyp:common_constants',
423              ],
424            }],
425            [ 'OS=="android"', {
426              'dependencies': [
427                '../testing/android/native_test.gyp:native_test_native_code',
428              ],
429            }],
430            [ 'OS == "linux" and use_allocator!="none"', {
431              'dependencies': [
432                '../base/allocator/allocator.gyp:allocator',
433              ],
434            }],
435          ],  # end of 'conditions'
436        },  # end of target 'remoting_perftests'
437      ]
438    }]
439  ]
440}
441