Content Shell: Move shell_layout_tests_android into layout_tests/.
[chromium-blink-merge.git] / content / shell / BUILD.gn
blob08b2f6671d34ea4aa1d2f3534851fc2d870bfc3a
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/features.gni")
6 import("//build/config/ui.gni")
7 import("//tools/grit/repack.gni")
8 import("//tools/grit/grit_rule.gni")
9 if (is_android) {
10   import("//build/config/android/config.gni")
13 declare_args() {
14   content_shell_product_name = "Content Shell"
16   # The "19" is so that sites that sniff for version think that this is
17   # something reasonably current; the "77.34.5" is a hint that this isn't a
18   # standard Chrome.
19   content_shell_version = "19.77.34.5"
22 static_library("content_shell_lib") {
23   testonly = true
24   sources = [
25     "android/shell_jni_registrar.cc",
26     "android/shell_jni_registrar.h",
27     "android/shell_manager.cc",
28     "android/shell_manager.h",
29     "app/paths_mac.h",
30     "app/paths_mac.mm",
31     "app/shell_crash_reporter_client.cc",
32     "app/shell_crash_reporter_client.h",
33     "app/shell_main_delegate.cc",
34     "app/shell_main_delegate.h",
35     "app/shell_main_delegate_mac.h",
36     "app/shell_main_delegate_mac.mm",
37     "app/webkit_test_platform_support_android.cc",
38     "app/webkit_test_platform_support.h",
39     "app/webkit_test_platform_support_linux.cc",
40     "app/webkit_test_platform_support_mac.mm",
41     "app/webkit_test_platform_support_win.cc",
42     "browser/ipc_echo_message_filter.cc",
43     "browser/ipc_echo_message_filter.h",
44     "browser/layout_test/layout_test_android.cc",
45     "browser/layout_test/layout_test_android.h",
46     "browser/layout_test/layout_test_browser_context.cc",
47     "browser/layout_test/layout_test_browser_context.h",
48     "browser/layout_test/layout_test_browser_main.cc",
49     "browser/layout_test/layout_test_browser_main.h",
50     "browser/layout_test/layout_test_browser_main_parts.cc",
51     "browser/layout_test/layout_test_browser_main_parts.h",
52     "browser/layout_test/layout_test_devtools_frontend.cc",
53     "browser/layout_test/layout_test_devtools_frontend.h",
54     "browser/layout_test/layout_test_download_manager_delegate.cc",
55     "browser/layout_test/layout_test_download_manager_delegate.h",
56     "browser/layout_test/layout_test_javascript_dialog_manager.cc",
57     "browser/layout_test/layout_test_javascript_dialog_manager.h",
58     "browser/layout_test/layout_test_resource_dispatcher_host_delegate.cc",
59     "browser/layout_test/layout_test_resource_dispatcher_host_delegate.h",
60     "browser/layout_test/layout_test_url_request_context_getter.cc",
61     "browser/layout_test/layout_test_url_request_context_getter.h",
62     "browser/notify_done_forwarder.cc",
63     "browser/notify_done_forwarder.h",
64     "browser/shell_android.cc",
65     "browser/shell_application_mac.h",
66     "browser/shell_application_mac.mm",
67     "browser/shell_browser_context.cc",
68     "browser/shell_browser_context.h",
69     "browser/shell_browser_main.cc",
70     "browser/shell_browser_main.h",
71     "browser/shell_browser_main_parts.cc",
72     "browser/shell_browser_main_parts.h",
73     "browser/shell_browser_main_parts_mac.mm",
74     "browser/shell.cc",
75     "browser/shell_content_browser_client.cc",
76     "browser/shell_content_browser_client.h",
77     "browser/shell_devtools_delegate.cc",
78     "browser/shell_devtools_delegate.h",
79     "browser/shell_devtools_frontend.cc",
80     "browser/shell_devtools_frontend.h",
81     "browser/shell_download_manager_delegate.cc",
82     "browser/shell_download_manager_delegate.h",
83     "browser/shell.h",
84     "browser/shell_javascript_dialog.h",
85     "browser/shell_javascript_dialog_mac.mm",
86     "browser/shell_javascript_dialog_manager.cc",
87     "browser/shell_javascript_dialog_manager.h",
88     "browser/shell_javascript_dialog_win.cc",
89     "browser/shell_mojo_test_utils_android.cc",
90     "browser/shell_mojo_test_utils_android.h",
91     "browser/shell_login_dialog.cc",
92     "browser/shell_login_dialog.h",
93     "browser/shell_login_dialog_mac.mm",
94     "browser/shell_mac.mm",
95     "browser/shell_message_filter.cc",
96     "browser/shell_message_filter.h",
97     "browser/shell_net_log.cc",
98     "browser/shell_net_log.h",
99     "browser/shell_network_delegate.cc",
100     "browser/shell_network_delegate.h",
101     "browser/shell_notification_manager.cc",
102     "browser/shell_notification_manager.h",
103     "browser/shell_platform_data_aura.cc",
104     "browser/shell_platform_data_aura.h",
105     "browser/shell_plugin_service_filter.cc",
106     "browser/shell_plugin_service_filter.h",
107     "browser/shell_quota_permission_context.cc",
108     "browser/shell_quota_permission_context.h",
109     "browser/shell_resource_dispatcher_host_delegate.cc",
110     "browser/shell_resource_dispatcher_host_delegate.h",
111     "browser/shell_speech_recognition_manager_delegate.cc",
112     "browser/shell_speech_recognition_manager_delegate.h",
113     "browser/shell_url_request_context_getter.cc",
114     "browser/shell_url_request_context_getter.h",
115     "browser/shell_web_contents_view_delegate_android.cc",
116     "browser/shell_web_contents_view_delegate_creator.h",
117     "browser/shell_web_contents_view_delegate.h",
118     "browser/shell_web_contents_view_delegate_mac.mm",
119     "browser/shell_web_contents_view_delegate_win.cc",
120     "browser/webkit_test_controller.cc",
121     "browser/webkit_test_controller.h",
122     "common/leak_detection_result.h",
123     "common/shell_content_client.cc",
124     "common/shell_content_client.h",
125     "common/shell_messages.cc",
126     "common/shell_messages.h",
127     "common/shell_switches.cc",
128     "common/shell_switches.h",
129     "common/shell_test_configuration.cc",
130     "common/shell_test_configuration.h",
131     "common/test_runner/test_preferences.cc",
132     "common/test_runner/test_preferences.h",
133     "common/webkit_test_helpers.cc",
134     "common/webkit_test_helpers.h",
135     "geolocation/shell_access_token_store.cc",
136     "geolocation/shell_access_token_store.h",
137     "renderer/ipc_echo.cc",
138     "renderer/ipc_echo.h",
139     "renderer/layout_test/gc_controller.cc",
140     "renderer/layout_test/gc_controller.h",
141     "renderer/layout_test/layout_test_content_renderer_client.cc",
142     "renderer/layout_test/layout_test_content_renderer_client.h",
143     "renderer/layout_test/layout_test_render_frame_observer.cc",
144     "renderer/layout_test/layout_test_render_frame_observer.h",
145     "renderer/layout_test/layout_test_render_process_observer.cc",
146     "renderer/layout_test/layout_test_render_process_observer.h",
147     "renderer/layout_test/leak_detector.cc",
148     "renderer/layout_test/leak_detector.h",
149     "renderer/layout_test/webkit_test_runner.cc",
150     "renderer/layout_test/webkit_test_runner.h",
151     "renderer/shell_content_renderer_client.cc",
152     "renderer/shell_content_renderer_client.h",
153     "renderer/shell_render_view_observer.cc",
154     "renderer/shell_render_view_observer.h",
155     "renderer/test_runner/accessibility_controller.cc",
156     "renderer/test_runner/accessibility_controller.h",
157     "renderer/test_runner/event_sender.cc",
158     "renderer/test_runner/event_sender.h",
159     "renderer/test_runner/gamepad_controller.cc",
160     "renderer/test_runner/gamepad_controller.h",
161     "renderer/test_runner/mock_color_chooser.cc",
162     "renderer/test_runner/mock_color_chooser.h",
163     "renderer/test_runner/mock_constraints.cc",
164     "renderer/test_runner/mock_constraints.h",
165     "renderer/test_runner/mock_credential_manager_client.cc",
166     "renderer/test_runner/mock_credential_manager_client.h",
167     "renderer/test_runner/mock_grammar_check.cc",
168     "renderer/test_runner/mock_grammar_check.h",
169     "renderer/test_runner/mock_screen_orientation_client.cc",
170     "renderer/test_runner/mock_screen_orientation_client.h",
171     "renderer/test_runner/mock_spell_check.cc",
172     "renderer/test_runner/mock_spell_check.h",
173     "renderer/test_runner/mock_web_audio_device.cc",
174     "renderer/test_runner/mock_web_audio_device.h",
175     "renderer/test_runner/mock_web_media_stream_center.cc",
176     "renderer/test_runner/mock_web_media_stream_center.h",
177     "renderer/test_runner/mock_web_midi_accessor.cc",
178     "renderer/test_runner/mock_web_midi_accessor.h",
179     "renderer/test_runner/mock_web_push_client.cc",
180     "renderer/test_runner/mock_web_push_client.h",
181     "renderer/test_runner/mock_web_speech_recognizer.cc",
182     "renderer/test_runner/mock_web_speech_recognizer.h",
183     "renderer/test_runner/mock_web_theme_engine.cc",
184     "renderer/test_runner/mock_web_theme_engine.h",
185     "renderer/test_runner/mock_web_user_media_client.cc",
186     "renderer/test_runner/mock_web_user_media_client.h",
187     "renderer/test_runner/mock_webrtc_data_channel_handler.cc",
188     "renderer/test_runner/mock_webrtc_data_channel_handler.h",
189     "renderer/test_runner/mock_webrtc_dtmf_sender_handler.cc",
190     "renderer/test_runner/mock_webrtc_dtmf_sender_handler.h",
191     "renderer/test_runner/mock_webrtc_peer_connection_handler.cc",
192     "renderer/test_runner/mock_webrtc_peer_connection_handler.h",
193     "renderer/test_runner/notification_presenter.cc",
194     "renderer/test_runner/notification_presenter.h",
195     "renderer/test_runner/spell_check_client.cc",
196     "renderer/test_runner/spell_check_client.h",
197     "renderer/test_runner/test_common.cc",
198     "renderer/test_runner/test_common.h",
199     "renderer/test_runner/test_interfaces.cc",
200     "renderer/test_runner/test_interfaces.h",
201     "renderer/test_runner/test_plugin.cc",
202     "renderer/test_runner/test_plugin.h",
203     "renderer/test_runner/test_runner.cc",
204     "renderer/test_runner/test_runner.h",
205     "renderer/test_runner/text_input_controller.cc",
206     "renderer/test_runner/text_input_controller.h",
207     "renderer/test_runner/web_ax_object_proxy.cc",
208     "renderer/test_runner/web_ax_object_proxy.h",
209     "renderer/test_runner/web_frame_test_proxy.h",
210     "renderer/test_runner/web_permissions.cc",
211     "renderer/test_runner/web_permissions.h",
212     "renderer/test_runner/web_task.cc",
213     "renderer/test_runner/web_task.h",
214     "renderer/test_runner/web_test_delegate.h",
215     "renderer/test_runner/web_test_interfaces.cc",
216     "renderer/test_runner/web_test_interfaces.h",
217     "renderer/test_runner/web_test_proxy.cc",
218     "renderer/test_runner/web_test_proxy.h",
219     "renderer/test_runner/web_test_runner.h",
220   ]
222   defines = [ "CONTENT_SHELL_VERSION=\"$content_shell_version\"" ]
224   public_deps = [
225     # This exposes all public content APIs.
226     "//content/public/app:both",
227     "//content/public/browser",
228     "//content/public/common",
229     "//content/public/plugin",
230     "//content/public/renderer",
231     "//content/public/utility",
232   ]
233   deps = [
234     ":resources",
235     "//base",
236     "//base:base_static",
237     "//base/allocator",
238     "//base/third_party/dynamic_annotations",
239     "//cc",
240     "//components/crash/app",
241     "//components/web_cache/renderer",
242     "//content:resources",
243     "//content/app/resources",
244     "//content/app/strings",
245     "//content/gpu",
246     "//content/test:layouttest_support",
247     "//gin",
248     "//gpu",
249     "//ipc",
250     "//media",
251     "//net",
252     "//net:net_resources",
253     "//skia",
254     "//storage/browser",
255     "//third_party/WebKit/public:blink",
256     "//third_party/WebKit/public:resources",
257     "//third_party/WebKit/public:test_support",
258     "//third_party/icu",
259     "//ui/base",
260     "//ui/events:events_base",
261     "//ui/gfx",
262     "//ui/gfx/geometry",
263     "//ui/gfx/ipc",
264     "//ui/gl",
265     "//url",
266     "//v8",
267     #'copy_test_netscape_plugin',  TODO(GYP)
268   ]
269   if (enable_plugins) {
270     deps += [ "//content/ppapi_plugin" ]
271   }
273   if (is_win) {
274     #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',  TODO(GYP)
276     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
277     cflags = [ "/wd4267" ]
278   }
280   if (is_linux) {
281     configs += [ "//build/config/linux:fontconfig" ]
282   }
284   if (use_x11) {
285     # Some tests rely on this tool at runtime. Note: it might be better if
286     # the tests that needed it had this as a dep instead of adding it here.
287     datadeps = [ "//tools/xdisplaycheck" ]
288   }
290   if (is_android) {
291     deps += [ "//content/shell/android:content_shell_jni_headers" ]
292     #deps -= [ "copy_test_netscape_plugin" ]  TODO(GYP)
293   }
295   if (is_posix && !is_mac && (!is_android || !is_android_webview_build)) {
296     deps += [ "//components/crash/browser" ]
297   }
299   if (use_aura) {
300     deps += [
301       "//ui/aura",
302       "//ui/aura:test_support",
303       "//ui/events",
304       "//ui/strings",
305       "//ui/wm",
306     ]
308     if (toolkit_views) {
309       sources += [ "browser/shell_views.cc" ]
310       deps += [
311         "//ui/resources",
312         "//ui/views/controls/webview",
313         "//ui/views",
314         "//ui/views:test_support",
315       ]
316     } else {
317       sources += [ "browser/shell_aura.cc" ]
318     }
319   } else {
320     sources -= [
321       "browser/shell_platform_data_aura.cc",
322       "browser/shell_platform_data_aura.h",
323     ]
324   }
326   # The test plugin relies on X11.
327   if (is_linux && !use_x11) {
328     #deps -= [ 'copy_test_netscape_plugin' ]  TODO(GYP)
329   }
331   if (is_chromeos) {
332     deps += [
333       "//chromeos",
334       "//ui/wm:test_support",
335     ]
336   }
338   if (is_linux) {
339     deps += [ "//third_party/freetype2" ]
340   }
342   if (!enable_plugins) {
343     sources -= [
344       "browser/shell_plugin_service_filter.cc",
345       "browser/shell_plugin_service_filter.h",
346     ]
347   }
350 grit("content_shell_resources_grit") {
351   visibility = [ ":*" ]
352   source = "shell_resources.grd"
353   outputs = [
354     "grit/shell_resources.h",
355     "shell_resources.pak",
356     "shell_resources.rc",
357   ]
360 copy("copy_shell_resources") {
361   sources = [ "$target_gen_dir/shell_resources.pak" ]
362   outputs = [ "$root_out_dir/shell_resources.pak" ]
364   public_deps = [ ":content_shell_resources_grit" ]
367 # Font copies.
368 if (!is_mac) {
369   copy("copy_ahem") {
370     visibility = [ ":*" ]
371     sources = [ "renderer/test_runner/resources/fonts/AHEM____.TTF" ]
372     outputs = [ "$root_out_dir/AHEM____.TTF" ]
373   }
375 if (use_x11) {
376   copy("copy_x11_fonts") {
377     visibility = [ ":*" ]
378     sources = [
379       "renderer/test_runner/resources/fonts/fonts.conf",
380       "//third_party/gardiner_mod/GardinerModBug.ttf",
381       "//third_party/gardiner_mod/GardinerModCat.ttf",
382     ]
383     outputs = [ "$root_out_dir/{{source_file_part}}" ]
384   }
386 if (is_android) {
387   copy("copy_android_fonts") {
388     visibility = [ ":*" ]
389     sources = [
390       "renderer/test_runner/resources/fonts/android_main_fonts.xml",
391       "renderer/test_runner/resources/fonts/android_fallback_fonts.xml",
392     ]
393     outputs = [ "$root_out_dir/{{source_file_part}}" ]
394   }
397 group("resources") {
398   public_deps = [
399     ":copy_shell_resources",
400   ]
401   deps = []
403   if (is_mac) {
404     # TODO(GYP) Mac bundle resources.
405     #'all_dependent_settings': {
406     #  'mac_bundle_resources': [
407     #    'shell/renderer/test_runner/resources/fonts/AHEM____.TTF',
408     #    'shell/renderer/test_runner/resources/fonts/ChromiumAATTest.ttf',
409     #    '<(SHARED_INTERMEDIATE_DIR)/webkit/missingImage.png',
410     #    '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png',
411     #  ],
412     #},
413   } else {
414     deps += [ ":copy_ahem" ]
415   }
417   if (use_x11) {
418     deps += [ ":copy_x11_fonts" ]
419   }
420   if (is_android) {
421     deps += [ ":copy_android_fonts" ]
422   }
425 repack("pak") {
426   sources = [
427     "$root_gen_dir/blink/public/resources/blink_resources.pak",
428     "$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
429     "$root_gen_dir/content/app/strings/content_strings_en-US.pak",
430     "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
431     "$root_gen_dir/content/content_resources.pak",
432     "$root_gen_dir/content/shell/shell_resources.pak",
433     "$root_gen_dir/net/net_resources.pak",
434     "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
435     "$root_gen_dir/ui/resources/webui_resources.pak",
436     "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
437     "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
438   ]
440   deps = [
441     ":resources",
442     "//content:resources",
443     "//content/app/resources",
444     "//content/app/strings",
445     "//content/browser/tracing:resources",
446     "//net:net_resources",
447     "//third_party/WebKit/public:resources",
448     "//ui/resources",
449     "//ui/strings",
450   ]
452   sources += [ "$root_gen_dir/webkit/devtools_resources.pak" ]
453   deps += [ "//content/browser/devtools:resources" ]
454   output = "$root_out_dir/content_shell.pak"
457 # TODO(GYP): Figure out what this should be on android
458 if (!is_android) {
460 executable("content_shell") {
461   testonly = true
462   # TODO(GYP) mac resource bundle stuff for this target.
463   # TODO(GYP) Windows content shell settings:
464   #  - Manifest.
465   #  - RC file.
466   #  - 'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
467   sources = [
468     "../app/startup_helper_win.cc",
469     "app/shell_main.cc",
470   ]
472   deps = [
473     ":content_shell_lib",
474     ":pak",
475     "//base/allocator",
476   ]
478   if (is_win) {
479     deps += [ "//sandbox" ]
480     if (!is_asan) {
481       configs -= [ "//build/config/win:console" ]
482       configs += [ "//build/config/win:windowed" ]
483     }
484   }
486   if (is_mac) {
487     # TODO(GYP) lots of stuff from GYP file here.
488   }
490   if (is_android && !is_android_webview_build) {
491     # Some tests rely on this tool. It might be nicer if these tests relied on
492     # image diff rather than having content shell depend on it.
493     datadeps = [
494       "//tools/imagediff($host_toolchain)",
495     ]
496   }