[Downloads] Allow acquiring dangerous download file.
[chromium-blink-merge.git] / sync / sync_tests.gypi
blobf26ac4ad2631849843a936a3c23c7d3829372ead
1 # Copyright 2013 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.
6   'targets': [
7     # Test support files for the 'sync_core' target.
8     {
9       'target_name': 'test_support_sync_core',
10       'type': 'static_library',
11       'variables': { 'enable_wexit_time_destructors': 1, },
12       'include_dirs': [
13         '..',
14       ],
15       'defines': [
16         'SYNC_TEST'
17       ],
18       'dependencies': [
19         '../base/base.gyp:base',
20         '../testing/gmock.gyp:gmock',
21         '../testing/gtest.gyp:gtest',
22         'sync',
23       ],
24       'export_dependent_settings': [
25         '../testing/gmock.gyp:gmock',
26         '../testing/gtest.gyp:gtest',
27         'sync',
28       ],
29       'sources': [
30         'js/js_test_util.cc',
31         'js/js_test_util.h',
32         'sessions/test_util.cc',
33         'sessions/test_util.h',
34         'syncable/syncable_mock.cc',
35         'syncable/syncable_mock.h',
36         'test/callback_counter.h',
37         'test/engine/fake_model_worker.cc',
38         'test/engine/fake_model_worker.h',
39         'test/engine/fake_sync_scheduler.cc',
40         'test/engine/fake_sync_scheduler.h',
41         'test/engine/mock_connection_manager.cc',
42         'test/engine/mock_connection_manager.h',
43         'test/engine/syncer_command_test.cc',
44         'test/engine/syncer_command_test.h',
45         'test/engine/test_directory_setter_upper.cc',
46         'test/engine/test_directory_setter_upper.h',
47         'test/engine/test_id_factory.h',
48         'test/engine/test_syncable_utils.cc',
49         'test/engine/test_syncable_utils.h',
50         'test/fake_encryptor.cc',
51         'test/fake_encryptor.h',
52         'test/fake_sync_encryption_handler.h',
53         'test/fake_sync_encryption_handler.cc',
54         'test/fake_extensions_activity_monitor.cc',
55         'test/fake_extensions_activity_monitor.h',
56         'test/test_transaction_observer.cc',
57         'test/test_transaction_observer.h',
58         'test/null_directory_change_delegate.cc',
59         'test/null_directory_change_delegate.h',
60         'test/null_transaction_observer.cc',
61         'test/null_transaction_observer.h',
62         'test/sessions/test_scoped_session_event_listener.h',
63         'test/test_directory_backing_store.cc',
64         'test/test_directory_backing_store.h',
65         'util/test_unrecoverable_error_handler.cc',
66         'util/test_unrecoverable_error_handler.h',
67       ],
68     },
70     # Test support files for the python sync test server.
71     {
72       'target_name': 'test_support_sync_testserver',
73       'type': 'static_library',
74       'variables': { 'enable_wexit_time_destructors': 1, },
75       'include_dirs': [
76         '..',
77       ],
78       'dependencies': [
79         '../base/base.gyp:base',
80         '../net/net.gyp:net_test_support',
81         # The sync test server uses Python modules generated by the sync protos.
82         '../third_party/protobuf/protobuf.gyp:py_proto',
83         'sync',
84       ],
85       'export_dependent_settings': [
86         '../base/base.gyp:base',
87         '../net/net.gyp:net_test_support',
88       ],
89       'sources': [
90         'test/local_sync_test_server.cc',
91         'test/local_sync_test_server.h',
92       ],
93     },
95     # Test support files for the 'sync_notifier' target.
96     {
97       'target_name': 'test_support_sync_notifier',
98       'type': 'static_library',
99       'include_dirs': [
100         '..',
101       ],
102       'defines': [
103         'SYNC_TEST'
104       ],
105       'dependencies': [
106         '../testing/gmock.gyp:gmock',
107         '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_proto_cpp',
108         'sync',
109       ],
110       'export_dependent_settings': [
111         '../testing/gmock.gyp:gmock',
112         '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_proto_cpp',
113         'sync',
114       ],
115       'sources': [
116         'notifier/fake_invalidation_state_tracker.cc',
117         'notifier/fake_invalidation_state_tracker.h',
118         'notifier/fake_invalidator.cc',
119         'notifier/fake_invalidator.h',
120         'notifier/fake_invalidation_handler.cc',
121         'notifier/fake_invalidation_handler.h',
122         'notifier/invalidator_test_template.cc',
123         'notifier/invalidator_test_template.h',
124         'notifier/object_id_invalidation_map_test_util.cc',
125         'notifier/object_id_invalidation_map_test_util.h',
126       ],
127     },
129     # Test support files for the 'sync_internal_api' target.
130     {
131       'target_name': 'test_support_sync_internal_api',
132       'type': 'static_library',
133       'variables': { 'enable_wexit_time_destructors': 1, },
134       'include_dirs': [
135         '..',
136       ],
137       'defines': [
138         'SYNC_TEST'
139       ],
140       'dependencies': [
141         '../base/base.gyp:base',
142         '../testing/gtest.gyp:gtest',
143         'sync',
144         'test_support_sync_core',
145       ],
146       'export_dependent_settings': [
147         '../testing/gtest.gyp:gtest',
148         'sync',
149         'test_support_sync_core',
150       ],
151       'sources': [
152         'internal_api/public/base/invalidation_test_util.cc',
153         'internal_api/public/base/invalidation_test_util.h',
154         'internal_api/public/base/model_type_invalidation_map_test_util.cc',
155         'internal_api/public/base/model_type_invalidation_map_test_util.h',
156         'internal_api/public/base/model_type_test_util.cc',
157         'internal_api/public/base/model_type_test_util.h',
158         'internal_api/public/test/fake_sync_manager.h',
159         'internal_api/public/test/test_entry_factory.h',
160         'internal_api/public/test/test_internal_components_factory.h',
161         'internal_api/public/test/test_user_share.h',
162         'internal_api/test/fake_sync_manager.cc',
163         'internal_api/test/test_entry_factory.cc',
164         'internal_api/test/test_internal_components_factory.cc',
165         'internal_api/test/test_user_share.cc',
166       ],
167     },
169     # Test support files for the 'sync_api' target.
170     {
171       'target_name': 'test_support_sync_api',
172       'type': 'static_library',
173       'include_dirs': [
174         '..',
175       ],
176       'defines': [
177         'SYNC_TEST'
178       ],
179       'dependencies': [
180         '../testing/gmock.gyp:gmock',
181         'sync',
182       ],
183       'export_dependent_settings': [
184         '../testing/gmock.gyp:gmock',
185         'sync',
186       ],
187       'sources': [
188         'api/fake_syncable_service.cc',
189         'api/fake_syncable_service.h',
190         'api/sync_error_factory_mock.cc',
191         'api/sync_error_factory_mock.h',
192       ],
193     },
195     # Unit tests for the 'sync_core' target.  This cannot be a static
196     # library because the unit test files have to be compiled directly
197     # into the executable, so we push the target files to the
198     # depending executable target via direct_dependent_settings.
199     {
200       'target_name': 'sync_core_tests',
201       'type': 'none',
202       # We only want unit test executables to include this target.
203       'suppress_wildcard': 1,
204       'dependencies': [
205         '../base/base.gyp:base',
206         '../sql/sql.gyp:sql',
207         '../testing/gmock.gyp:gmock',
208         '../testing/gtest.gyp:gtest',
209         'sync',
210         'test_support_sync_core',
211       ],
212       'conditions': [
213         ['OS=="linux" and chromeos==1', {
214           # Required by get_session_name_unittest.cc on Chrome OS.
215           'dependencies': [
216             '../chromeos/chromeos.gyp:chromeos',
217           ],
218         }],
219       ],
220       # Propagate all dependencies since the actual compilation
221       # happens in the dependents.
222       'export_dependent_settings': [
223         '../base/base.gyp:base',
224         '../sql/sql.gyp:sql',
225         '../testing/gmock.gyp:gmock',
226         '../testing/gtest.gyp:gtest',
227         'sync',
228         'test_support_sync_core',
229       ],
230       'direct_dependent_settings': {
231         'include_dirs': [
232           '..',
233         ],
234         'sources': [
235           'internal_api/public/base/enum_set_unittest.cc',
236           'internal_api/public/base/model_type_invalidation_map_unittest.cc',
237           'internal_api/public/base/node_ordinal_unittest.cc',
238           'internal_api/public/base/ordinal_unittest.cc',
239           'internal_api/public/base/unique_position_unittest.cc',
240           'internal_api/public/engine/model_safe_worker_unittest.cc',
241           'internal_api/public/util/immutable_unittest.cc',
242           'internal_api/public/util/weak_handle_unittest.cc',
243           'engine/apply_control_data_updates_unittest.cc',
244           'engine/apply_updates_and_resolve_conflicts_command_unittest.cc',
245           'engine/backoff_delay_provider_unittest.cc',
246           'engine/download_updates_command_unittest.cc',
247           'engine/model_changing_syncer_command_unittest.cc',
248           'engine/process_commit_response_command_unittest.cc',
249           'engine/process_updates_command_unittest.cc',
250           'engine/store_timestamps_command_unittest.cc',
251           'engine/sync_scheduler_unittest.cc',
252           'engine/syncer_proto_util_unittest.cc',
253           'engine/syncer_unittest.cc',
254           'engine/throttled_data_type_tracker_unittest.cc',
255           'engine/traffic_recorder_unittest.cc',
256           'js/js_arg_list_unittest.cc',
257           'js/js_event_details_unittest.cc',
258           'js/sync_js_controller_unittest.cc',
259           'protocol/proto_enum_conversions_unittest.cc',
260           'protocol/proto_value_conversions_unittest.cc',
261           'sessions/nudge_tracker_unittest.cc',
262           'sessions/ordered_commit_set_unittest.cc',
263           'sessions/status_controller_unittest.cc',
264           'sessions/sync_session_unittest.cc',
265           'syncable/directory_backing_store_unittest.cc',
266           'syncable/model_type_unittest.cc',
267           'syncable/nigori_util_unittest.cc',
268           'syncable/parent_child_index_unittest.cc',
269           'syncable/syncable_enum_conversions_unittest.cc',
270           'syncable/syncable_id_unittest.cc',
271           'syncable/syncable_unittest.cc',
272           'syncable/syncable_util_unittest.cc',
273           'util/cryptographer_unittest.cc',
274           'util/data_encryption_win_unittest.cc',
275           'util/data_type_histogram_unittest.cc',
276           'util/get_session_name_unittest.cc',
277           'util/nigori_unittest.cc',
278           'util/protobuf_unittest.cc',
279         ],
280         'conditions': [
281           ['OS == "ios" and coverage != 0', {
282             'sources!': [
283               # These sources can't be built with coverage due to a toolchain
284               # bug: http://openradar.appspot.com/radar?id=1499403
285               'engine/syncer_unittest.cc',
287               # These tests crash when run with coverage turned on due to an
288               # issue with llvm_gcda_increment_indirect_counter:
289               # http://crbug.com/156058
290               'syncable/directory_backing_store_unittest.cc',
291             ],
292           }],
293         ],
294       },
295     },
297     # Unit tests for the 'sync_notifier' target.  This cannot be a static
298     # library because the unit test files have to be compiled directly
299     # into the executable, so we push the target files to the
300     # depending executable target via direct_dependent_settings.
301     {
302       'target_name': 'sync_notifier_tests',
303       'type': 'none',
304       # We only want unit test executables to include this target.
305       'suppress_wildcard': 1,
306       'dependencies': [
307         '../base/base.gyp:base',
308         '../jingle/jingle.gyp:notifier_test_util',
309         '../net/net.gyp:net_test_support',
310         '../testing/gmock.gyp:gmock',
311         '../testing/gtest.gyp:gtest',
312         '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation',
313         '../third_party/libjingle/libjingle.gyp:libjingle',
314         'sync',
315         'test_support_sync_notifier',
316       ],
317       # Propagate all dependencies since the actual compilation
318       # happens in the dependents.
319       'export_dependent_settings': [
320         '../base/base.gyp:base',
321         '../jingle/jingle.gyp:notifier_test_util',
322         '../net/net.gyp:net_test_support',
323         '../testing/gmock.gyp:gmock',
324         '../testing/gtest.gyp:gtest',
325         '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation',
326         '../third_party/libjingle/libjingle.gyp:libjingle',
327         'sync',
328         'test_support_sync_notifier',
329       ],
330       'direct_dependent_settings': {
331         'include_dirs': [
332           '..',
333         ],
334         'sources': [
335           'notifier/invalidator_factory_unittest.cc',
336         ],
337         'conditions': [
338           ['OS != "android"', {
339             'sources': [
340               'notifier/ack_tracker_unittest.cc',
341               'notifier/fake_invalidator_unittest.cc',
342               'notifier/invalidation_notifier_unittest.cc',
343               'notifier/invalidator_registrar_unittest.cc',
344               'notifier/non_blocking_invalidator_unittest.cc',
345               'notifier/p2p_invalidator_unittest.cc',
346               'notifier/push_client_channel_unittest.cc',
347               'notifier/registration_manager_unittest.cc',
348               'notifier/sync_invalidation_listener_unittest.cc',
349               'notifier/sync_system_resources_unittest.cc',
350             ],
351           }],
352         ],
353       },
354     },
356     # Unit tests for the 'sync_internal_api' target.  This cannot be a static
357     # library because the unit test files have to be compiled directly
358     # into the executable, so we push the target files to the
359     # depending executable target via direct_dependent_settings.
360     {
361       'target_name': 'sync_internal_api_tests',
362       'type': 'none',
363       # We only want unit test executables to include this target.
364       'suppress_wildcard': 1,
365       'dependencies': [
366         '../base/base.gyp:base',
367         '../net/net.gyp:net',
368         '../net/net.gyp:net_test_support',
369         '../testing/gmock.gyp:gmock',
370         '../testing/gtest.gyp:gtest',
371         'sync',
372         'test_support_sync_internal_api',
373       ],
374       # Propagate all dependencies since the actual compilation
375       # happens in the dependents.
376       'export_dependent_settings': [
377         '../base/base.gyp:base',
378         '../net/net.gyp:net',
379         '../net/net.gyp:net_test_support',
380         '../testing/gmock.gyp:gmock',
381         '../testing/gtest.gyp:gtest',
382         'sync',
383         'test_support_sync_internal_api',
384       ],
385       'direct_dependent_settings': {
386         'include_dirs': [
387           '..',
388         ],
389         'sources': [
390           'internal_api/debug_info_event_listener_unittest.cc',
391           'internal_api/http_bridge_unittest.cc',
392           'internal_api/js_mutation_event_observer_unittest.cc',
393           'internal_api/js_sync_encryption_handler_observer_unittest.cc',
394           'internal_api/js_sync_manager_observer_unittest.cc',
395           'internal_api/public/change_record_unittest.cc',
396           'internal_api/public/sessions/sync_session_snapshot_unittest.cc',
397           'internal_api/public/sessions/sync_source_info_unittest.cc',
398           'internal_api/syncapi_server_connection_manager_unittest.cc',
399           'internal_api/sync_encryption_handler_impl_unittest.cc',
400           'internal_api/sync_manager_impl_unittest.cc',
401         ],
402         'conditions': [
403           ['OS == "ios"', {
404             'sources!': [
405               'internal_api/http_bridge_unittest.cc',
406             ],
407           }],
408         ],
409       },
410     },
412     # Unit tests for the 'sync_api' target.  This cannot be a static
413     # library because the unit test files have to be compiled directly
414     # into the executable, so we push the target files to the
415     # depending executable target via direct_dependent_settings.
416     {
417       'target_name': 'sync_api_tests',
418       'type': 'none',
419       # We only want unit test executables to include this target.
420       'suppress_wildcard': 1,
421       'dependencies': [
422         '../base/base.gyp:base',
423         '../testing/gtest.gyp:gtest',
424         'sync',
425         'test_support_sync_internal_api',
426       ],
427       # Propagate all dependencies since the actual compilation
428       # happens in the dependents.
429       'export_dependent_settings': [
430         '../base/base.gyp:base',
431         '../testing/gtest.gyp:gtest',
432         'sync',
433         'test_support_sync_internal_api',
434       ],
435       'direct_dependent_settings': {
436         'include_dirs': [
437           '..',
438         ],
439         'sources': [
440           'api/sync_change_unittest.cc',
441           'api/sync_error_unittest.cc',
442           'api/sync_merge_result_unittest.cc',
443         ],
444       },
445     },
447     # The unit test executable for sync tests.
448     {
449       'target_name': 'sync_unit_tests',
450       'type': '<(gtest_target_type)',
451       # Typed-parametrized tests generate exit-time destructors.
452       'variables': { 'enable_wexit_time_destructors': 0, },
453       'defines': [
454         'SYNC_TEST',
455       ],
456       'dependencies': [
457         '../base/base.gyp:run_all_unittests',
458         'sync_api_tests',
459         'sync_core_tests',
460         'sync_internal_api_tests',
461         'sync_notifier_tests',
462       ],
463       'conditions': [
464         # TODO(akalin): This is needed because histogram.cc uses
465         # leak_annotations.h, which pulls this in.  Make 'base'
466         # propagate this dependency.
467         ['OS=="linux" and linux_use_tcmalloc==1', {
468           'dependencies': [
469             '../base/allocator/allocator.gyp:allocator',
470           ],
471         }],
472         ['OS == "android" and gtest_target_type == "shared_library"', {
473           'dependencies': [
474             '../testing/android/native_test.gyp:native_test_native_code',
475           ],
476         }],
477       ],
478     },
480     # Test support files for using the Test Accounts service.
481     {
482       'target_name': 'test_support_accounts_client',
483       'type': 'static_library',
484       'direct_dependent_settings': {
485         'include_dirs': [
486           '..',
487         ],
488       },
489       'dependencies': [
490         '../base/base.gyp:base',
491         '../net/net.gyp:net',
492       ],
493       'sources': [
494         'test/accounts_client/test_accounts_client.cc',
495         'test/accounts_client/test_accounts_client.h',
496         'test/accounts_client/url_request_context_getter.cc',
497         'test/accounts_client/url_request_context_getter.h',
498       ],
499     },
500     
501     # The Sync end-to-end (and associated infrastructure) tests.
502     {
503       'target_name': 'sync_endtoend_tests',
504       'type': '<(gtest_target_type)',
505       'dependencies': [
506         '../base/base.gyp:run_all_unittests',
507         '../build/temp_gyp/googleurl.gyp:googleurl',
508         '../testing/gmock.gyp:gmock',
509         '../testing/gtest.gyp:gtest',
510         'test_support_accounts_client',
511       ],
512       'sources': [
513         'test/accounts_client/test_accounts_client_unittest.cc',
514       ],
515     },
517   ],
518   'conditions': [
519     ['OS != "ios"', {
520       'targets': [
521         {
522           'target_name': 'sync_tools_helper',
523           'type': 'static_library',
524           'defines': [
525             'SYNC_IMPLEMENTATION',
526           ],
527           'include_dirs': [
528             '..',
529           ],
530           'dependencies': [
531             '../base/base.gyp:base',
532             'sync',
533           ],
534           'export_dependent_settings': [
535             '../base/base.gyp:base',
536             'sync',
537           ],
538           'sources': [
539             'tools/null_invalidation_state_tracker.cc',
540             'tools/null_invalidation_state_tracker.h',
541           ],
542         },
544         # A tool that can be used to launch a python sync server instance.
545         {
546           'target_name': 'run_sync_testserver',
547           'type': 'executable',
548           'dependencies': [
549             '../base/base.gyp:base',
550             '../base/base.gyp:test_support_base',
551             '../net/net.gyp:net_test_support',
552             '../testing/gtest.gyp:gtest',
553             'test_support_sync_testserver',
554           ],
555           'sources': [
556             'tools/testserver/run_sync_testserver.cc',
557           ],
558         },
560         # A tool to listen to sync notifications and print them out.
561         {
562           'target_name': 'sync_listen_notifications',
563           'type': 'executable',
564           'defines': [
565             'SYNC_TEST',
566           ],
567           'dependencies': [
568             '../base/base.gyp:base',
569             '../jingle/jingle.gyp:notifier',
570             '../net/net.gyp:net',
571             '../net/net.gyp:net_test_support',
572             'sync',
573             'sync_tools_helper',
574           ],
575           'sources': [
576             'tools/sync_listen_notifications.cc',
577           ],
578         },
580         # A standalone command-line sync client.
581         {
582           'target_name': 'sync_client',
583           'type': 'executable',
584           'defines': [
585             'SYNC_TEST',
586           ],
587           'dependencies': [
588             '../base/base.gyp:base',
589             '../jingle/jingle.gyp:notifier',
590             '../net/net.gyp:net',
591             '../net/net.gyp:net_test_support',
592             'sync',
593             'sync_tools_helper',
594             'test_support_sync_core'
595           ],
596           'sources': [
597             'tools/sync_client.cc',
598           ],
599         },
600       ],
601     }],
602     ['OS == "android"', {
603       'targets': [
604         {
605           'target_name': 'sync_javatests',
606           'type': 'none',
607           'variables': {
608             'java_in_dir': '../sync/android/javatests',
609           },
610           'dependencies': [
611             'sync_java',
612             'sync_java_test_support',
613             '../base/base.gyp:base_java_test_support',
614           ],
615           'includes': [ '../build/java.gypi' ],
616         },
617         {
618           'target_name': 'sync_java_test_support',
619           'type': 'none',
620           'variables': {
621             'package_name': 'sync_java_test_support',
622             'java_in_dir': '../sync/test/android/javatests',
623           },
624           'dependencies': [
625             'sync_java',
626           ],
627           'includes': [ '../build/java.gypi' ],
628         },
629       ],
630     }],
631     # Special target to wrap a gtest_target_type==shared_library
632     # sync_unit_tests into an android apk for execution.
633     ['OS == "android" and gtest_target_type == "shared_library"', {
634       'targets': [
635         {
636           'target_name': 'sync_unit_tests_apk',
637           'type': 'none',
638           'dependencies': [
639             'sync_unit_tests',
640           ],
641           'variables': {
642             'test_suite_name': 'sync_unit_tests',
643             'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)sync_unit_tests<(SHARED_LIB_SUFFIX)',
644           },
645           'includes': [ '../build/apk_test.gypi' ],
646         },
647       ],
648     }],
649   ],