[chromium] move EventSender into TestRunner.a
[WebKit-https.git] / Tools / DumpRenderTree / DumpRenderTree.gyp / DumpRenderTree.gyp
1 #
2 # Copyright (C) 2011 Google Inc. All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met:
7 #
8 #         * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 #         * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following disclaimer
12 # in the documentation and/or other materials provided with the
13 # distribution.
14 #         * Neither the name of Google Inc. nor the names of its
15 # contributors may be used to endorse or promote products derived from
16 # this software without specific prior written permission.
17 #
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #
30
31 {
32     'variables': {
33         'ahem_path': '../../DumpRenderTree/qt/fonts/AHEM____.TTF',
34         'tools_dir': '../..',
35         'source_dir': '../../../Source',
36         'conditions': [
37             # Location of the chromium src directory and target type is different
38             # if webkit is built inside chromium or as standalone project.
39             ['inside_chromium_build==0', {
40                 # Webkit is being built outside of the full chromium project.
41                 # e.g. via build-webkit --chromium
42                 'chromium_src_dir': '<(source_dir)/WebKit/chromium',
43             },{
44                 # WebKit is checked out in src/chromium/third_party/WebKit
45                 'chromium_src_dir': '<(tools_dir)/../../..',
46             }],
47         ],
48     },
49     'includes': [
50         '../DumpRenderTree.gypi',
51         '../../../Source/WebKit/chromium/features.gypi',
52     ],
53     'targets': [
54         {
55             'target_name': 'ImageDiff',
56             'type': 'executable',
57             'dependencies': [
58                 '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support_gfx',
59             ],
60             'include_dirs': [
61                 '<(DEPTH)',
62             ],
63             'sources': [
64                 '<(tools_dir)/DumpRenderTree/chromium/ImageDiff.cpp',
65             ],
66             'conditions': [
67                 ['OS=="android" and android_build_type==0', {
68                     # The Chromium Android port will compare images on host rather
69                     # than target (a device or emulator) for performance reasons.
70                     'toolsets': ['host'],
71                 }],
72                 ['OS=="android" and android_build_type!=0', {
73                     'type': 'none',
74                 }],
75             ],
76         },
77         {
78             'target_name': 'TestRunner',
79             'type': 'static_library',
80             'dependencies': [
81                 '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit',
82                 '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf',
83                 '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support',
84             ],
85             'include_dirs': [
86                 '<(chromium_src_dir)',
87                 '<(source_dir)/WebKit/chromium/public',
88                 '<(DEPTH)',
89                 '../chromium/TestRunner',
90             ],
91             'direct_dependent_settings': {
92                 'include_dirs': [
93                     '../chromium/TestRunner',
94                 ],
95             },
96             'sources': [
97                 '<@(test_runner_files)',
98             ],
99             'conditions': [
100                 ['toolkit_uses_gtk == 1', {
101                     'defines': [
102                         'WTF_USE_GTK=1',
103                     ],
104                     'dependencies': [
105                         '<(chromium_src_dir)/build/linux/system.gyp:gtk',
106                     ],
107                     'include_dirs': [
108                         '<(source_dir)/WebKit/chromium/public/gtk',
109                     ],
110                 }],
111             ],
112         },
113         {
114             'target_name': 'DumpRenderTree',
115             'type': 'executable',
116             'mac_bundle': 1,
117             'dependencies': [
118                 'ImageDiff',
119                 'TestRunner',
120                 'copy_TestNetscapePlugIn',
121                 '<(source_dir)/WebKit/chromium/WebKit.gyp:inspector_resources',
122                 '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit',
123                 '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf',
124                 '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl',
125                 '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc',
126                 '<(chromium_src_dir)/third_party/mesa/mesa.gyp:osmesa',
127                 '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8',
128                 '<(chromium_src_dir)/base/base.gyp:test_support_base',
129                 '<(chromium_src_dir)/webkit/support/webkit_support.gyp:blob',
130                 '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support',
131                 '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_user_agent',
132             ],
133             'include_dirs': [
134                 '<(chromium_src_dir)',
135                 '<(source_dir)/WebKit/chromium/public',
136                 '<(DEPTH)',
137             ],
138             'defines': [
139                 # Technically not a unit test but require functions available only to
140                 # unit tests.
141                 'UNIT_TEST',
142             ],
143             'sources': [
144                 '<@(drt_files)',
145             ],
146             'conditions': [
147                 ['OS=="mac" or OS=="win" or toolkit_uses_gtk==1', {
148                     # These platforms have their own implementations of
149                     # checkLayoutTestSystemDependencies() and openStartupDialog().
150                     'sources/': [
151                         ['exclude', 'TestShellStub\\.cpp$'],
152                     ],
153                 }],
154                 ['OS=="win"', {
155                     'dependencies': [
156                         'LayoutTestHelper',
157                         '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:libEGL',
158                         '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:libGLESv2',
159                     ],
160                     'resource_include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/webkit'],
161                     'sources': [
162                         '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc',
163                         '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc',
164                         '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc',
165                         '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.rc',
166                     ],
167                     'conditions': [
168                         ['inside_chromium_build==1', {
169                             'configurations': {
170                                 'Debug_Base': {
171                                     'msvs_settings': {
172                                         'VCLinkerTool': {
173                                             'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
174                                         },
175                                     },
176                                 },
177                             },
178                         }],
179                     ],
180                     'copies': [{
181                         'destination': '<(PRODUCT_DIR)',
182                         'files': ['<(ahem_path)'],
183                     }],
184                 },{ # OS!="win"
185                     'sources/': [
186                         ['exclude', 'Win\\.cpp$'],
187                     ],
188                     'actions': [
189                         {
190                             'action_name': 'repack_locale',
191                             'variables': {
192                                 'repack_path': '<(chromium_src_dir)/tools/grit/grit/format/repack.py',
193                                 'pak_inputs': [
194                                     '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
195                                     '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.pak',
196                                     '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak',
197                                     '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.pak',
198                                     '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.pak',
199                             ]},
200                             'inputs': [
201                                 '<(repack_path)',
202                                 '<@(pak_inputs)',
203                             ],
204                             'outputs': [
205                                 '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak',
206                             ],
207                             'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'],
208                             'process_outputs_as_mac_bundle_resources': 1,
209                         },
210                     ], # actions
211                 }],
212                 ['OS=="mac"', {
213                     'dependencies': [
214                         '<(source_dir)/WebKit/chromium/WebKit.gyp:copy_mesa',
215                         'LayoutTestHelper',
216                     ],
217                     'mac_bundle_resources': [
218                         '<(ahem_path)',
219                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher100.ttf',
220                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher200.ttf',
221                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher300.ttf',
222                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher400.ttf',
223                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher500.ttf',
224                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher600.ttf',
225                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher700.ttf',
226                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher800.ttf',
227                         '<(tools_dir)/DumpRenderTree/fonts/WebKitWeightWatcher900.ttf',
228                         '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png',
229                     ],
230                 },{ # OS!="mac"
231                     'sources/': [
232                         # .mm is already excluded by common.gypi
233                         ['exclude', 'Mac\\.cpp$'],
234                     ],
235                 }],
236                 ['os_posix!=1 or OS=="mac"', {
237                     'sources/': [
238                         ['exclude', 'Posix\\.cpp$'],
239                     ],
240                 }],
241                 ['use_x11 == 1', {
242                     'dependencies': [
243                         '<(chromium_src_dir)/build/linux/system.gyp:fontconfig',
244                     ],
245                     'copies': [{
246                         'destination': '<(PRODUCT_DIR)',
247                         'files': [
248                             '<(ahem_path)',
249                             '<(tools_dir)/DumpRenderTree/chromium/fonts.conf',
250                             '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak',
251                         ]
252                     }],
253                     'variables': {
254                         # FIXME: Enable warnings on other platforms.
255                         'chromium_code': 1,
256                     },
257                     'conditions': [
258                         ['linux_use_tcmalloc == 1', {
259                             'dependencies': [
260                                 '<(chromium_src_dir)/base/allocator/allocator.gyp:allocator',
261                             ],
262                         }],
263                     ],
264                 },{ # use_x11 != 1
265                     'sources/': [
266                         ['exclude', 'X11\\.cpp$'],
267                     ]
268                 }],
269                 ['toolkit_uses_gtk == 1', {
270                     'defines': [
271                         'WTF_USE_GTK=1',
272                     ],
273                     'dependencies': [
274                         '<(chromium_src_dir)/build/linux/system.gyp:gtk',
275                     ],
276                     'include_dirs': [
277                         '<(source_dir)/WebKit/chromium/public/gtk',
278                     ],
279                 }],
280                 ['OS=="android"', {
281                     'type': 'shared_library',
282                     'dependencies': [
283                         '<(chromium_src_dir)/base/base.gyp:test_support_base',
284                         '<(chromium_src_dir)/tools/android/forwarder/forwarder.gyp:forwarder',
285                         '<(chromium_src_dir)/testing/android/native_test.gyp:native_test_native_code',
286                     ],
287                     'dependencies!': [
288                         'ImageDiff',
289                         'copy_TestNetscapePlugIn',
290                         '<(chromium_src_dir)/third_party/mesa/mesa.gyp:osmesa',
291                     ],
292                     'copies': [{
293                         'destination': '<(PRODUCT_DIR)',
294                         'files': [
295                             '<(ahem_path)',
296                             '<(tools_dir)/DumpRenderTree/chromium/android_main_fonts.xml',
297                             '<(tools_dir)/DumpRenderTree/chromium/android_fallback_fonts.xml',
298                             '<(INTERMEDIATE_DIR)/repack/DumpRenderTree.pak',
299                         ]
300                     }],
301                 }, { # OS!="android"
302                     'sources/': [
303                         ['exclude', 'Android\\.cpp$'],
304                     ],
305                 }],
306                 ['OS=="android" and android_build_type==0', {
307                     'dependencies': [
308                         'ImageDiff#host',
309                     ],
310                 }],
311                 ['inside_chromium_build==1 and component=="shared_library"', {
312                     'sources': [
313                         '<(source_dir)/WebKit/chromium/src/ChromiumCurrentTime.cpp',
314                         '<(source_dir)/WebKit/chromium/src/ChromiumThreading.cpp',
315                     ],
316                     'include_dirs': [
317                         '<(source_dir)/WebKit/chromium/public',
318                     ],
319                     'dependencies': [
320                         '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf',
321                     ],
322                 }],
323                 ['inside_chromium_build==0', {
324                     'dependencies': [
325                         '<(chromium_src_dir)/webkit/support/setup_third_party.gyp:third_party_headers',
326                     ]
327                 }],
328                 ['inside_chromium_build==0 or component!="shared_library"', {
329                     'dependencies': [
330                         '<(source_dir)/WebCore/WebCore.gyp/WebCore.gyp:webcore_test_support',
331                     ],
332                     'include_dirs': [
333                         # WARNING: Do not view this particular case as a precedent for
334                         # including WebCore headers in DumpRenderTree project.
335                         '<(source_dir)/WebCore/testing/v8', # for WebCoreTestSupport.h, needed to link in window.internals code.
336                     ],
337                     'sources': [
338                         '<(source_dir)/WebKit/chromium/src/WebTestingSupport.cpp',
339                         '<(source_dir)/WebKit/chromium/public/WebTestingSupport.h',
340                     ],
341                 }],
342             ],
343         },
344         {
345             'target_name': 'TestNetscapePlugIn',
346             'type': 'loadable_module',
347             'sources': [ '<@(test_plugin_files)' ],
348             'dependencies': [
349                 '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi',
350             ],
351             'include_dirs': [
352                 '<(chromium_src_dir)',
353                 '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn',
354                 '<(tools_dir)/DumpRenderTree/chromium/TestNetscapePlugIn/ForwardingHeaders',
355             ],
356             'conditions': [
357                 ['OS=="mac"', {
358                     'mac_bundle': 1,
359                     'product_extension': 'plugin',
360                     'link_settings': {
361                         'libraries': [
362                             '$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
363                             '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework',
364                             '$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework',
365                         ]
366                     },
367                     'xcode_settings': {
368                         'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
369                         'INFOPLIST_FILE': '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn/mac/Info.plist',
370                     },
371                 }],
372                 ['os_posix == 1 and OS != "mac"', {
373                     'cflags': [
374                         '-fvisibility=default',
375                     ],
376                 }],
377                 ['OS=="win"', {
378                     'defines': [
379                         # This seems like a hack, but this is what Safari Win does.
380                         'snprintf=_snprintf',
381                     ],
382                     'sources': [
383                         '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.def',
384                         '<(tools_dir)/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.rc',
385                     ],
386                     # The .rc file requires that the name of the dll is npTestNetscapePlugIn.dll.
387                     'product_name': 'npTestNetscapePlugIn',
388                 }],
389             ],
390         },
391         {
392             'target_name': 'copy_TestNetscapePlugIn',
393             'type': 'none',
394             'dependencies': [
395                 'TestNetscapePlugIn',
396             ],
397             'conditions': [
398                 ['OS=="win"', {
399                     'copies': [{
400                         'destination': '<(PRODUCT_DIR)/plugins',
401                         'files': ['<(PRODUCT_DIR)/npTestNetscapePlugIn.dll'],
402                     }],
403                 }],
404                 ['OS=="mac"', {
405                     'dependencies': ['TestNetscapePlugIn'],
406                     'copies': [{
407                         'destination': '<(PRODUCT_DIR)/plugins/',
408                         'files': ['<(PRODUCT_DIR)/TestNetscapePlugIn.plugin/'],
409                     }],
410                 }],
411                 ['os_posix == 1 and OS != "mac"', {
412                     'copies': [{
413                         'destination': '<(PRODUCT_DIR)/plugins',
414                         'files': ['<(PRODUCT_DIR)/libTestNetscapePlugIn.so'],
415                     }],
416                 }],
417             ],
418         },
419     ], # targets
420     'conditions': [
421         ['OS=="win"', {
422             'targets': [{
423                 'target_name': 'LayoutTestHelper',
424                 'type': 'executable',
425                 'sources': ['<(tools_dir)/DumpRenderTree/chromium/LayoutTestHelperWin.cpp'],
426             }],
427         }],
428         ['OS=="mac"', {
429             'targets': [{
430                 'target_name': 'LayoutTestHelper',
431                 'type': 'executable',
432                 'sources': ['<(tools_dir)/DumpRenderTree/chromium/LayoutTestHelper.mm'],
433                 'link_settings': {
434                     'libraries': [
435                         '$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
436                     ],
437                 },
438             }],
439         }],
440         ['os_posix==1 and OS!="mac" and gcc_version>=46', {
441             'target_defaults': {
442                 # Disable warnings about c++0x compatibility, as some names (such
443                 # as nullptr) conflict with upcoming c++0x types.
444                 'cflags_cc': ['-Wno-c++0x-compat'],
445             },
446         }],
447         ['OS=="android"', {
448             # Wrap libDumpRenderTree.so into an android apk for execution.
449             'targets': [{
450                 'target_name': 'DumpRenderTree_apk',
451                 'type': 'none',
452                 'dependencies': [
453                     '<(chromium_src_dir)/base/base.gyp:base_java',
454                     '<(chromium_src_dir)/net/net.gyp:net_java',
455                     '<(chromium_src_dir)/media/media.gyp:media_java',
456                     'DumpRenderTree',
457                 ],
458                 'variables': {
459                     'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)DumpRenderTree<(SHARED_LIB_SUFFIX)',
460                     'input_jars_paths': [
461                         '<(PRODUCT_DIR)/lib.java/chromium_base.jar',
462                         '<(PRODUCT_DIR)/lib.java/chromium_net.jar',
463                         '<(PRODUCT_DIR)/lib.java/chromium_media.jar',
464                     ],
465                 },
466                 # Part of the following was copied from <(chromium_src_dir)/build/apk_test.gpyi.
467                 # Not including it because gyp include doesn't support variable in path or under
468                 # conditions. And we also have some different requirements.
469                 'actions': [{
470                     'action_name': 'apk_DumpRenderTree',
471                     'message': 'Building DumpRenderTree test apk.',
472                     'inputs': [
473                         '<(chromium_src_dir)/testing/android/AndroidManifest.xml',
474                         '<(chromium_src_dir)/testing/android/generate_native_test.py',
475                         '<(input_shlib_path)',
476                         '<@(input_jars_paths)',
477                     ],
478                     'outputs': [
479                         '<(PRODUCT_DIR)/DumpRenderTree_apk/DumpRenderTree-debug.apk',
480                     ],
481                     'action': [
482                         '<(chromium_src_dir)/testing/android/generate_native_test.py',
483                         '--native_library',
484                         '<(input_shlib_path)',
485                         '--jars',
486                         '"<@(input_jars_paths)"',
487                         '--output',
488                         '<(PRODUCT_DIR)/DumpRenderTree_apk',
489                         '--ant-args',
490                         '-DPRODUCT_DIR=<(ant_build_out)',
491                         '--ant-compile',
492                         '--app_abi',
493                         '<(android_app_abi)',
494                     ],
495                 }],
496             }],
497         }],
498     ], # conditions
499 }