• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/test_directory_setter_upper.cc',
44        'test/engine/test_directory_setter_upper.h',
45        'test/engine/test_id_factory.h',
46        'test/engine/test_syncable_utils.cc',
47        'test/engine/test_syncable_utils.h',
48        'test/fake_encryptor.cc',
49        'test/fake_encryptor.h',
50        'test/fake_sync_encryption_handler.cc',
51        'test/fake_sync_encryption_handler.h',
52        'test/null_directory_change_delegate.cc',
53        'test/null_directory_change_delegate.h',
54        'test/null_transaction_observer.cc',
55        'test/null_transaction_observer.h',
56        'test/sessions/test_scoped_session_event_listener.h',
57        'test/sessions/mock_debug_info_getter.h',
58        'test/sessions/mock_debug_info_getter.cc',
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/unacked_invalidation_set_test_util.cc',
123        'notifier/unacked_invalidation_set_test_util.h',
124        'internal_api/public/base/object_id_invalidation_map_test_util.h',
125        'internal_api/public/base/object_id_invalidation_map_test_util.cc',
126      ],
127    },
128
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/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/backoff_delay_provider_unittest.cc',
245          'engine/download_unittest.cc',
246          'engine/sync_scheduler_unittest.cc',
247          'engine/syncer_proto_util_unittest.cc',
248          'engine/syncer_unittest.cc',
249          'engine/sync_directory_commit_contribution_unittest.cc',
250          'engine/sync_directory_update_handler_unittest.cc',
251          'engine/traffic_recorder_unittest.cc',
252          'js/js_arg_list_unittest.cc',
253          'js/js_event_details_unittest.cc',
254          'js/sync_js_controller_unittest.cc',
255          'protocol/proto_enum_conversions_unittest.cc',
256          'protocol/proto_value_conversions_unittest.cc',
257          'sessions/nudge_tracker_unittest.cc',
258          'sessions/status_controller_unittest.cc',
259          'sessions/sync_session_unittest.cc',
260          'syncable/directory_backing_store_unittest.cc',
261          'syncable/model_type_unittest.cc',
262          'syncable/nigori_util_unittest.cc',
263          'syncable/parent_child_index_unittest.cc',
264          'syncable/syncable_enum_conversions_unittest.cc',
265          'syncable/syncable_id_unittest.cc',
266          'syncable/syncable_unittest.cc',
267          'syncable/syncable_util_unittest.cc',
268          'util/cryptographer_unittest.cc',
269          'util/data_type_histogram_unittest.cc',
270          'util/get_session_name_unittest.cc',
271          'util/nigori_unittest.cc',
272          'util/protobuf_unittest.cc',
273        ],
274      },
275    },
276
277    # Unit tests for the 'sync_notifier' target.  This cannot be a static
278    # library because the unit test files have to be compiled directly
279    # into the executable, so we push the target files to the
280    # depending executable target via direct_dependent_settings.
281    {
282      'target_name': 'sync_notifier_tests',
283      'type': 'none',
284      # We only want unit test executables to include this target.
285      'suppress_wildcard': 1,
286      'dependencies': [
287        '../base/base.gyp:base',
288        '../jingle/jingle.gyp:notifier_test_util',
289        '../net/net.gyp:net_test_support',
290        '../testing/gmock.gyp:gmock',
291        '../testing/gtest.gyp:gtest',
292        '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation',
293        '../third_party/libjingle/libjingle.gyp:libjingle',
294        'sync',
295        'test_support_sync_notifier',
296      ],
297      # Propagate all dependencies since the actual compilation
298      # happens in the dependents.
299      'export_dependent_settings': [
300        '../base/base.gyp:base',
301        '../jingle/jingle.gyp:notifier_test_util',
302        '../net/net.gyp:net_test_support',
303        '../testing/gmock.gyp:gmock',
304        '../testing/gtest.gyp:gtest',
305        '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation',
306        '../third_party/libjingle/libjingle.gyp:libjingle',
307        'sync',
308        'test_support_sync_notifier',
309      ],
310      'direct_dependent_settings': {
311        'include_dirs': [
312          '..',
313        ],
314        'conditions': [
315          ['OS != "android"', {
316            'sources': [
317              'notifier/fake_invalidator_unittest.cc',
318              'notifier/invalidation_notifier_unittest.cc',
319              'notifier/invalidator_registrar_unittest.cc',
320              'notifier/non_blocking_invalidator_unittest.cc',
321              'notifier/object_id_invalidation_map_unittest.cc',
322              'notifier/p2p_invalidator_unittest.cc',
323              'notifier/push_client_channel_unittest.cc',
324              'notifier/registration_manager_unittest.cc',
325              'notifier/single_object_invalidation_set_unittest.cc',
326              'notifier/sync_invalidation_listener_unittest.cc',
327              'notifier/sync_system_resources_unittest.cc',
328              'notifier/unacked_invalidation_set_unittest.cc',
329            ],
330          }],
331        ],
332      },
333    },
334
335    # Unit tests for the 'sync_internal_api' target.  This cannot be a static
336    # library because the unit test files have to be compiled directly
337    # into the executable, so we push the target files to the
338    # depending executable target via direct_dependent_settings.
339    {
340      'target_name': 'sync_internal_api_tests',
341      'type': 'none',
342      # We only want unit test executables to include this target.
343      'suppress_wildcard': 1,
344      'dependencies': [
345        '../base/base.gyp:base',
346        '../net/net.gyp:net',
347        '../net/net.gyp:net_test_support',
348        '../testing/gmock.gyp:gmock',
349        '../testing/gtest.gyp:gtest',
350        'sync',
351        'test_support_sync_internal_api',
352      ],
353      # Propagate all dependencies since the actual compilation
354      # happens in the dependents.
355      'export_dependent_settings': [
356        '../base/base.gyp:base',
357        '../net/net.gyp:net',
358        '../net/net.gyp:net_test_support',
359        '../testing/gmock.gyp:gmock',
360        '../testing/gtest.gyp:gtest',
361        'sync',
362        'test_support_sync_internal_api',
363      ],
364      'direct_dependent_settings': {
365        'include_dirs': [
366          '..',
367        ],
368        'sources': [
369          'internal_api/debug_info_event_listener_unittest.cc',
370          'internal_api/http_bridge_unittest.cc',
371          'internal_api/js_mutation_event_observer_unittest.cc',
372          'internal_api/js_sync_encryption_handler_observer_unittest.cc',
373          'internal_api/js_sync_manager_observer_unittest.cc',
374          'internal_api/public/change_record_unittest.cc',
375          'internal_api/public/sessions/sync_session_snapshot_unittest.cc',
376          'internal_api/syncapi_server_connection_manager_unittest.cc',
377          'internal_api/sync_encryption_handler_impl_unittest.cc',
378          'internal_api/sync_manager_impl_unittest.cc',
379        ],
380        'conditions': [
381          ['OS == "ios"', {
382            'sources!': [
383              'internal_api/http_bridge_unittest.cc',
384            ],
385          }],
386        ],
387      },
388    },
389
390    # Unit tests for the 'sync_api' target.  This cannot be a static
391    # library because the unit test files have to be compiled directly
392    # into the executable, so we push the target files to the
393    # depending executable target via direct_dependent_settings.
394    {
395      'target_name': 'sync_api_tests',
396      'type': 'none',
397      # We only want unit test executables to include this target.
398      'suppress_wildcard': 1,
399      'dependencies': [
400        '../base/base.gyp:base',
401        '../testing/gtest.gyp:gtest',
402        'sync',
403        'test_support_sync_internal_api',
404      ],
405      # Propagate all dependencies since the actual compilation
406      # happens in the dependents.
407      'export_dependent_settings': [
408        '../base/base.gyp:base',
409        '../testing/gtest.gyp:gtest',
410        'sync',
411        'test_support_sync_internal_api',
412      ],
413      'direct_dependent_settings': {
414        'include_dirs': [
415          '..',
416        ],
417        'sources': [
418          'api/sync_change_unittest.cc',
419          'api/sync_error_unittest.cc',
420          'api/sync_merge_result_unittest.cc',
421        ],
422      },
423    },
424
425    # The unit test executable for sync tests.
426    {
427      'target_name': 'sync_unit_tests',
428      'type': '<(gtest_target_type)',
429      # Typed-parametrized tests generate exit-time destructors.
430      'variables': { 'enable_wexit_time_destructors': 0, },
431      'defines': [
432        'SYNC_TEST',
433      ],
434      'dependencies': [
435        '../base/base.gyp:run_all_unittests',
436        'sync_api_tests',
437        'sync_core_tests',
438        'sync_internal_api_tests',
439        'sync_notifier_tests',
440      ],
441      'conditions': [
442        # TODO(akalin): This is needed because histogram.cc uses
443        # leak_annotations.h, which pulls this in.  Make 'base'
444        # propagate this dependency.
445        ['OS=="linux" and linux_use_tcmalloc==1', {
446          'dependencies': [
447            '../base/allocator/allocator.gyp:allocator',
448          ],
449        }],
450        ['OS == "android" and gtest_target_type == "shared_library"', {
451          'dependencies': [
452            '../testing/android/native_test.gyp:native_test_native_code',
453          ],
454        }],
455      ],
456    },
457
458    # Test support files for using the Test Accounts service.
459    {
460      'target_name': 'test_support_accounts_client',
461      'type': 'static_library',
462      'direct_dependent_settings': {
463        'include_dirs': [
464          '..',
465        ],
466      },
467      'dependencies': [
468        '../base/base.gyp:base',
469        '../net/net.gyp:net',
470      ],
471      'sources': [
472        'test/accounts_client/test_accounts_client.cc',
473        'test/accounts_client/test_accounts_client.h',
474        'test/accounts_client/url_request_context_getter.cc',
475        'test/accounts_client/url_request_context_getter.h',
476      ],
477    },
478
479    # The Sync end-to-end (and associated infrastructure) tests.
480    {
481      'target_name': 'sync_endtoend_tests',
482      'type': '<(gtest_target_type)',
483      'dependencies': [
484        '../base/base.gyp:run_all_unittests',
485        '../testing/gmock.gyp:gmock',
486        '../testing/gtest.gyp:gtest',
487        '../url/url.gyp:url_lib',
488        'test_support_accounts_client',
489      ],
490      'sources': [
491        'test/accounts_client/test_accounts_client_unittest.cc',
492      ],
493    },
494
495  ],
496  'conditions': [
497    ['OS != "ios"', {
498      'targets': [
499        {
500          'target_name': 'sync_tools_helper',
501          'type': 'static_library',
502          'defines': [
503            'SYNC_IMPLEMENTATION',
504          ],
505          'include_dirs': [
506            '..',
507          ],
508          'dependencies': [
509            '../base/base.gyp:base',
510            'sync',
511          ],
512          'export_dependent_settings': [
513            '../base/base.gyp:base',
514            'sync',
515          ],
516          'sources': [
517            'tools/null_invalidation_state_tracker.cc',
518            'tools/null_invalidation_state_tracker.h',
519          ],
520        },
521
522        # A tool that can be used to launch a python sync server instance.
523        {
524          'target_name': 'run_sync_testserver',
525          'type': 'executable',
526          'dependencies': [
527            '../base/base.gyp:base',
528            '../base/base.gyp:test_support_base',
529            '../net/net.gyp:net_test_support',
530            '../testing/gtest.gyp:gtest',
531            'test_support_sync_testserver',
532          ],
533          'sources': [
534            'tools/testserver/run_sync_testserver.cc',
535          ],
536        },
537
538        # A tool to listen to sync notifications and print them out.
539        {
540          'target_name': 'sync_listen_notifications',
541          'type': 'executable',
542          'defines': [
543            'SYNC_TEST',
544          ],
545          'dependencies': [
546            '../base/base.gyp:base',
547            '../jingle/jingle.gyp:notifier',
548            '../net/net.gyp:net',
549            '../net/net.gyp:net_test_support',
550            'sync',
551            'sync_tools_helper',
552          ],
553          'sources': [
554            'tools/sync_listen_notifications.cc',
555          ],
556        },
557
558        # A standalone command-line sync client.
559        {
560          'target_name': 'sync_client',
561          'type': 'executable',
562          'defines': [
563            'SYNC_TEST',
564          ],
565          'dependencies': [
566            '../base/base.gyp:base',
567            '../jingle/jingle.gyp:notifier',
568            '../net/net.gyp:net',
569            '../net/net.gyp:net_test_support',
570            'sync',
571            'sync_tools_helper',
572            'test_support_sync_core'
573          ],
574          'sources': [
575            'tools/sync_client.cc',
576          ],
577        },
578      ],
579    }],
580    ['OS == "android"', {
581      'targets': [
582        {
583          'target_name': 'sync_javatests',
584          'type': 'none',
585          'variables': {
586            'java_in_dir': '../sync/android/javatests',
587          },
588          'dependencies': [
589            'sync_java',
590            'sync_java_test_support',
591            '../base/base.gyp:base_java_test_support',
592          ],
593          'includes': [ '../build/java.gypi' ],
594        },
595        {
596          'target_name': 'sync_java_test_support',
597          'type': 'none',
598          'variables': {
599            'package_name': 'sync_java_test_support',
600            'java_in_dir': '../sync/test/android/javatests',
601          },
602          'dependencies': [
603            'sync_java',
604          ],
605          'includes': [ '../build/java.gypi' ],
606        },
607      ],
608    }],
609    # Special target to wrap a gtest_target_type==shared_library
610    # sync_unit_tests into an android apk for execution.
611    ['OS == "android" and gtest_target_type == "shared_library"', {
612      'targets': [
613        {
614          'target_name': 'sync_unit_tests_apk',
615          'type': 'none',
616          'dependencies': [
617            'sync_unit_tests',
618          ],
619          'variables': {
620            'test_suite_name': 'sync_unit_tests',
621            'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)sync_unit_tests<(SHARED_LIB_SUFFIX)',
622          },
623          'includes': [ '../build/apk_test.gypi' ],
624        },
625      ],
626    }],
627  ],
628}
629