- add sources.
[platform/framework/web/crosswalk.git] / src / sync / sync_tests.gypi
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.
4
5 {
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         'internal_api/public/base/model_type_test_util.cc',
31         'internal_api/public/base/model_type_test_util.h',
32         'js/js_test_util.cc',
33         'js/js_test_util.h',
34         'sessions/test_util.cc',
35         'sessions/test_util.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.cc',
53         'test/fake_sync_encryption_handler.h',
54         'test/null_directory_change_delegate.cc',
55         'test/null_directory_change_delegate.h',
56         'test/null_transaction_observer.cc',
57         'test/null_transaction_observer.h',
58         'test/sessions/test_scoped_session_event_listener.h',
59         'test/test_directory_backing_store.cc',
60         'test/test_directory_backing_store.h',
61         'test/test_transaction_observer.cc',
62         'test/test_transaction_observer.h',
63         'util/test_unrecoverable_error_handler.cc',
64         'util/test_unrecoverable_error_handler.h',
65       ],
66     },
67
68     # Test support files for the python sync test server.
69     {
70       'target_name': 'test_support_sync_testserver',
71       'type': 'static_library',
72       'variables': { 'enable_wexit_time_destructors': 1, },
73       'include_dirs': [
74         '..',
75       ],
76       'dependencies': [
77         '../base/base.gyp:base',
78         '../net/net.gyp:net_test_support',
79         # The sync test server uses Python modules generated by the sync protos.
80         '../third_party/protobuf/protobuf.gyp:py_proto',
81         'sync',
82       ],
83       'export_dependent_settings': [
84         '../base/base.gyp:base',
85         '../net/net.gyp:net_test_support',
86       ],
87       'sources': [
88         'test/local_sync_test_server.cc',
89         'test/local_sync_test_server.h',
90       ],
91     },
92
93     # Test support files for the 'sync_notifier' target.
94     {
95       'target_name': 'test_support_sync_notifier',
96       'type': 'static_library',
97       'include_dirs': [
98         '..',
99       ],
100       'defines': [
101         'SYNC_TEST'
102       ],
103       'dependencies': [
104         '../testing/gmock.gyp:gmock',
105         '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_proto_cpp',
106         'sync',
107       ],
108       'export_dependent_settings': [
109         '../testing/gmock.gyp:gmock',
110         '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_proto_cpp',
111         'sync',
112       ],
113       'sources': [
114         'notifier/fake_invalidation_handler.cc',
115         'notifier/fake_invalidation_handler.h',
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/invalidator_test_template.cc',
121         'notifier/invalidator_test_template.h',
122         'notifier/mock_ack_handler.cc',
123         'notifier/mock_ack_handler.h',
124       ],
125     },
126
127     # Test support files for the 'sync_internal_api' target.
128     {
129       'target_name': 'test_support_sync_internal_api',
130       'type': 'static_library',
131       'variables': { 'enable_wexit_time_destructors': 1, },
132       'include_dirs': [
133         '..',
134       ],
135       'defines': [
136         'SYNC_TEST'
137       ],
138       'dependencies': [
139         '../base/base.gyp:base',
140         '../testing/gtest.gyp:gtest',
141         'sync',
142         'test_support_sync_core',
143       ],
144       'export_dependent_settings': [
145         '../testing/gtest.gyp:gtest',
146         'sync',
147         'test_support_sync_core',
148       ],
149       'sources': [
150         'internal_api/public/base/invalidation_test_util.cc',
151         'internal_api/public/base/invalidation_test_util.h',
152         'internal_api/public/base/object_id_invalidation_map_test_util.cc',
153         'internal_api/public/base/object_id_invalidation_map_test_util.h',
154         'internal_api/public/test/fake_sync_manager.h',
155         'internal_api/public/test/sync_manager_factory_for_profile_sync_test.h',
156         'internal_api/public/test/test_entry_factory.h',
157         'internal_api/public/test/test_internal_components_factory.h',
158         'internal_api/public/test/test_user_share.h',
159         'internal_api/test/fake_sync_manager.cc',
160         'internal_api/test/sync_manager_factory_for_profile_sync_test.cc',
161         'internal_api/test/sync_manager_for_profile_sync_test.cc',
162         'internal_api/test/sync_manager_for_profile_sync_test.h',
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     },
168
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     },
194
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/cancelation_signal_unittest.cc',
236           'internal_api/public/base/enum_set_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_unittest.cc',
247           'engine/model_changing_syncer_command_unittest.cc',
248           'engine/sync_scheduler_unittest.cc',
249           'engine/syncer_proto_util_unittest.cc',
250           'engine/syncer_unittest.cc',
251           'engine/sync_directory_commit_contribution_unittest.cc',
252           'engine/sync_directory_update_handler_unittest.cc',
253           'engine/traffic_recorder_unittest.cc',
254           'js/js_arg_list_unittest.cc',
255           'js/js_event_details_unittest.cc',
256           'js/sync_js_controller_unittest.cc',
257           'protocol/proto_enum_conversions_unittest.cc',
258           'protocol/proto_value_conversions_unittest.cc',
259           'sessions/nudge_tracker_unittest.cc',
260           'sessions/status_controller_unittest.cc',
261           'sessions/sync_session_unittest.cc',
262           'syncable/directory_backing_store_unittest.cc',
263           'syncable/model_type_unittest.cc',
264           'syncable/nigori_util_unittest.cc',
265           'syncable/parent_child_index_unittest.cc',
266           'syncable/syncable_enum_conversions_unittest.cc',
267           'syncable/syncable_id_unittest.cc',
268           'syncable/syncable_unittest.cc',
269           'syncable/syncable_util_unittest.cc',
270           'util/cryptographer_unittest.cc',
271           'util/data_type_histogram_unittest.cc',
272           'util/get_session_name_unittest.cc',
273           'util/nigori_unittest.cc',
274           'util/protobuf_unittest.cc',
275         ],
276         'conditions': [
277           ['OS == "ios" and coverage != 0', {
278             'sources!': [
279               # These sources can't be built with coverage due to a toolchain
280               # bug: http://openradar.appspot.com/radar?id=1499403
281               'engine/syncer_unittest.cc',
282
283               # These tests crash when run with coverage turned on due to an
284               # issue with llvm_gcda_increment_indirect_counter:
285               # http://crbug.com/156058
286               'syncable/directory_backing_store_unittest.cc',
287             ],
288           }],
289         ],
290       },
291     },
292
293     # Unit tests for the 'sync_notifier' target.  This cannot be a static
294     # library because the unit test files have to be compiled directly
295     # into the executable, so we push the target files to the
296     # depending executable target via direct_dependent_settings.
297     {
298       'target_name': 'sync_notifier_tests',
299       'type': 'none',
300       # We only want unit test executables to include this target.
301       'suppress_wildcard': 1,
302       'dependencies': [
303         '../base/base.gyp:base',
304         '../jingle/jingle.gyp:notifier_test_util',
305         '../net/net.gyp:net_test_support',
306         '../testing/gmock.gyp:gmock',
307         '../testing/gtest.gyp:gtest',
308         '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation',
309         '../third_party/libjingle/libjingle.gyp:libjingle',
310         'sync',
311         'test_support_sync_notifier',
312       ],
313       # Propagate all dependencies since the actual compilation
314       # happens in the dependents.
315       'export_dependent_settings': [
316         '../base/base.gyp:base',
317         '../jingle/jingle.gyp:notifier_test_util',
318         '../net/net.gyp:net_test_support',
319         '../testing/gmock.gyp:gmock',
320         '../testing/gtest.gyp:gtest',
321         '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation',
322         '../third_party/libjingle/libjingle.gyp:libjingle',
323         'sync',
324         'test_support_sync_notifier',
325       ],
326       'direct_dependent_settings': {
327         'include_dirs': [
328           '..',
329         ],
330         'conditions': [
331           ['OS != "android"', {
332             'sources': [
333               'notifier/ack_tracker_unittest.cc',
334               'notifier/fake_invalidator_unittest.cc',
335               'notifier/invalidation_notifier_unittest.cc',
336               'notifier/invalidator_registrar_unittest.cc',
337               'notifier/non_blocking_invalidator_unittest.cc',
338               'notifier/object_id_invalidation_map_unittest.cc',
339               'notifier/p2p_invalidator_unittest.cc',
340               'notifier/push_client_channel_unittest.cc',
341               'notifier/registration_manager_unittest.cc',
342               'notifier/single_object_invalidation_set_unittest.cc',
343               'notifier/sync_invalidation_listener_unittest.cc',
344               'notifier/sync_system_resources_unittest.cc',
345               'notifier/unacked_invalidation_set_unittest.cc',
346             ],
347           }],
348         ],
349       },
350     },
351
352     # Unit tests for the 'sync_internal_api' target.  This cannot be a static
353     # library because the unit test files have to be compiled directly
354     # into the executable, so we push the target files to the
355     # depending executable target via direct_dependent_settings.
356     {
357       'target_name': 'sync_internal_api_tests',
358       'type': 'none',
359       # We only want unit test executables to include this target.
360       'suppress_wildcard': 1,
361       'dependencies': [
362         '../base/base.gyp:base',
363         '../net/net.gyp:net',
364         '../net/net.gyp:net_test_support',
365         '../testing/gmock.gyp:gmock',
366         '../testing/gtest.gyp:gtest',
367         'sync',
368         'test_support_sync_internal_api',
369       ],
370       # Propagate all dependencies since the actual compilation
371       # happens in the dependents.
372       'export_dependent_settings': [
373         '../base/base.gyp:base',
374         '../net/net.gyp:net',
375         '../net/net.gyp:net_test_support',
376         '../testing/gmock.gyp:gmock',
377         '../testing/gtest.gyp:gtest',
378         'sync',
379         'test_support_sync_internal_api',
380       ],
381       'direct_dependent_settings': {
382         'include_dirs': [
383           '..',
384         ],
385         'sources': [
386           'internal_api/debug_info_event_listener_unittest.cc',
387           'internal_api/http_bridge_unittest.cc',
388           'internal_api/js_mutation_event_observer_unittest.cc',
389           'internal_api/js_sync_encryption_handler_observer_unittest.cc',
390           'internal_api/js_sync_manager_observer_unittest.cc',
391           'internal_api/public/change_record_unittest.cc',
392           'internal_api/public/sessions/sync_session_snapshot_unittest.cc',
393           'internal_api/syncapi_server_connection_manager_unittest.cc',
394           'internal_api/sync_encryption_handler_impl_unittest.cc',
395           'internal_api/sync_manager_impl_unittest.cc',
396         ],
397         'conditions': [
398           ['OS == "ios"', {
399             'sources!': [
400               'internal_api/http_bridge_unittest.cc',
401             ],
402           }],
403         ],
404       },
405     },
406
407     # Unit tests for the 'sync_api' target.  This cannot be a static
408     # library because the unit test files have to be compiled directly
409     # into the executable, so we push the target files to the
410     # depending executable target via direct_dependent_settings.
411     {
412       'target_name': 'sync_api_tests',
413       'type': 'none',
414       # We only want unit test executables to include this target.
415       'suppress_wildcard': 1,
416       'dependencies': [
417         '../base/base.gyp:base',
418         '../testing/gtest.gyp:gtest',
419         'sync',
420         'test_support_sync_internal_api',
421       ],
422       # Propagate all dependencies since the actual compilation
423       # happens in the dependents.
424       'export_dependent_settings': [
425         '../base/base.gyp:base',
426         '../testing/gtest.gyp:gtest',
427         'sync',
428         'test_support_sync_internal_api',
429       ],
430       'direct_dependent_settings': {
431         'include_dirs': [
432           '..',
433         ],
434         'sources': [
435           'api/sync_change_unittest.cc',
436           'api/sync_error_unittest.cc',
437           'api/sync_merge_result_unittest.cc',
438         ],
439       },
440     },
441
442     # The unit test executable for sync tests.
443     {
444       'target_name': 'sync_unit_tests',
445       'type': '<(gtest_target_type)',
446       # Typed-parametrized tests generate exit-time destructors.
447       'variables': { 'enable_wexit_time_destructors': 0, },
448       'defines': [
449         'SYNC_TEST',
450       ],
451       'dependencies': [
452         '../base/base.gyp:run_all_unittests',
453         'sync_api_tests',
454         'sync_core_tests',
455         'sync_internal_api_tests',
456         'sync_notifier_tests',
457       ],
458       'conditions': [
459         # TODO(akalin): This is needed because histogram.cc uses
460         # leak_annotations.h, which pulls this in.  Make 'base'
461         # propagate this dependency.
462         ['OS=="linux" and linux_use_tcmalloc==1', {
463           'dependencies': [
464             '../base/allocator/allocator.gyp:allocator',
465           ],
466         }],
467         ['OS == "android" and gtest_target_type == "shared_library"', {
468           'dependencies': [
469             '../testing/android/native_test.gyp:native_test_native_code',
470           ],
471         }],
472       ],
473     },
474
475     # Test support files for using the Test Accounts service.
476     {
477       'target_name': 'test_support_accounts_client',
478       'type': 'static_library',
479       'direct_dependent_settings': {
480         'include_dirs': [
481           '..',
482         ],
483       },
484       'dependencies': [
485         '../base/base.gyp:base',
486         '../net/net.gyp:net',
487       ],
488       'sources': [
489         'test/accounts_client/test_accounts_client.cc',
490         'test/accounts_client/test_accounts_client.h',
491         'test/accounts_client/url_request_context_getter.cc',
492         'test/accounts_client/url_request_context_getter.h',
493       ],
494     },
495
496     # The Sync end-to-end (and associated infrastructure) tests.
497     {
498       'target_name': 'sync_endtoend_tests',
499       'type': '<(gtest_target_type)',
500       'dependencies': [
501         '../base/base.gyp:run_all_unittests',
502         '../testing/gmock.gyp:gmock',
503         '../testing/gtest.gyp:gtest',
504         '../url/url.gyp:url_lib',
505         'test_support_accounts_client',
506       ],
507       'sources': [
508         'test/accounts_client/test_accounts_client_unittest.cc',
509       ],
510     },
511
512   ],
513   'conditions': [
514     ['OS != "ios"', {
515       'targets': [
516         {
517           'target_name': 'sync_tools_helper',
518           'type': 'static_library',
519           'defines': [
520             'SYNC_IMPLEMENTATION',
521           ],
522           'include_dirs': [
523             '..',
524           ],
525           'dependencies': [
526             '../base/base.gyp:base',
527             'sync',
528           ],
529           'export_dependent_settings': [
530             '../base/base.gyp:base',
531             'sync',
532           ],
533           'sources': [
534             'tools/null_invalidation_state_tracker.cc',
535             'tools/null_invalidation_state_tracker.h',
536           ],
537         },
538
539         # A tool that can be used to launch a python sync server instance.
540         {
541           'target_name': 'run_sync_testserver',
542           'type': 'executable',
543           'dependencies': [
544             '../base/base.gyp:base',
545             '../base/base.gyp:test_support_base',
546             '../net/net.gyp:net_test_support',
547             '../testing/gtest.gyp:gtest',
548             'test_support_sync_testserver',
549           ],
550           'sources': [
551             'tools/testserver/run_sync_testserver.cc',
552           ],
553         },
554
555         # A tool to listen to sync notifications and print them out.
556         {
557           'target_name': 'sync_listen_notifications',
558           'type': 'executable',
559           'defines': [
560             'SYNC_TEST',
561           ],
562           'dependencies': [
563             '../base/base.gyp:base',
564             '../jingle/jingle.gyp:notifier',
565             '../net/net.gyp:net',
566             '../net/net.gyp:net_test_support',
567             'sync',
568             'sync_tools_helper',
569           ],
570           'sources': [
571             'tools/sync_listen_notifications.cc',
572           ],
573         },
574
575         # A standalone command-line sync client.
576         {
577           'target_name': 'sync_client',
578           'type': 'executable',
579           'defines': [
580             'SYNC_TEST',
581           ],
582           'dependencies': [
583             '../base/base.gyp:base',
584             '../jingle/jingle.gyp:notifier',
585             '../net/net.gyp:net',
586             '../net/net.gyp:net_test_support',
587             'sync',
588             'sync_tools_helper',
589             'test_support_sync_core'
590           ],
591           'sources': [
592             'tools/sync_client.cc',
593           ],
594         },
595       ],
596     }],
597     ['OS == "android"', {
598       'targets': [
599         {
600           'target_name': 'sync_javatests',
601           'type': 'none',
602           'variables': {
603             'java_in_dir': '../sync/android/javatests',
604           },
605           'dependencies': [
606             'sync_java',
607             'sync_java_test_support',
608             '../base/base.gyp:base_java_test_support',
609           ],
610           'includes': [ '../build/java.gypi' ],
611         },
612         {
613           'target_name': 'sync_java_test_support',
614           'type': 'none',
615           'variables': {
616             'package_name': 'sync_java_test_support',
617             'java_in_dir': '../sync/test/android/javatests',
618           },
619           'dependencies': [
620             'sync_java',
621           ],
622           'includes': [ '../build/java.gypi' ],
623         },
624       ],
625     }],
626     # Special target to wrap a gtest_target_type==shared_library
627     # sync_unit_tests into an android apk for execution.
628     ['OS == "android" and gtest_target_type == "shared_library"', {
629       'targets': [
630         {
631           'target_name': 'sync_unit_tests_apk',
632           'type': 'none',
633           'dependencies': [
634             'sync_unit_tests',
635           ],
636           'variables': {
637             'test_suite_name': 'sync_unit_tests',
638             'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)sync_unit_tests<(SHARED_LIB_SUFFIX)',
639           },
640           'includes': [ '../build/apk_test.gypi' ],
641         },
642       ],
643     }],
644   ],
645 }