Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / shell / BUILD.gn
blobbfff38e3e01fd7969110d50a01506ae08ed1e183
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/grit_rule.gni")
8 import("//tools/grit/repack.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   sources = [
24     "android/shell_jni_registrar.cc",
25     "android/shell_jni_registrar.h",
26     "android/shell_manager.cc",
27     "android/shell_manager.h",
28     "app/paths_mac.h",
29     "app/paths_mac.mm",
30     "app/shell_breakpad_client.cc",
31     "app/shell_breakpad_client.h",
32     "app/shell_main_delegate.cc",
33     "app/shell_main_delegate.h",
34     "app/shell_main_delegate_mac.h",
35     "app/shell_main_delegate_mac.mm",
36     "app/webkit_test_platform_support_android.cc",
37     "app/webkit_test_platform_support.h",
38     "app/webkit_test_platform_support_linux.cc",
39     "app/webkit_test_platform_support_mac.mm",
40     "app/webkit_test_platform_support_win.cc",
41     "browser/ipc_echo_message_filter.cc",
42     "browser/ipc_echo_message_filter.h",
43     "browser/notify_done_forwarder.cc",
44     "browser/notify_done_forwarder.h",
45     "browser/shell_android.cc",
46     "browser/shell_application_mac.h",
47     "browser/shell_application_mac.mm",
48     "browser/shell_browser_context.cc",
49     "browser/shell_browser_context.h",
50     "browser/shell_browser_main.cc",
51     "browser/shell_browser_main.h",
52     "browser/shell_browser_main_parts.cc",
53     "browser/shell_browser_main_parts.h",
54     "browser/shell_browser_main_parts_mac.mm",
55     "browser/shell.cc",
56     "browser/shell_content_browser_client.cc",
57     "browser/shell_content_browser_client.h",
58     "browser/shell_devtools_delegate.cc",
59     "browser/shell_devtools_delegate.h",
60     "browser/shell_devtools_frontend.cc",
61     "browser/shell_devtools_frontend.h",
62     "browser/shell_download_manager_delegate.cc",
63     "browser/shell_download_manager_delegate.h",
64     "browser/shell.h",
65     "browser/shell_javascript_dialog.h",
66     "browser/shell_javascript_dialog_mac.mm",
67     "browser/shell_javascript_dialog_manager.cc",
68     "browser/shell_javascript_dialog_manager.h",
69     "browser/shell_javascript_dialog_win.cc",
70     "browser/shell_layout_tests_android.cc",
71     "browser/shell_layout_tests_android.h",
72     "browser/shell_login_dialog.cc",
73     "browser/shell_login_dialog.h",
74     "browser/shell_login_dialog_mac.mm",
75     "browser/shell_mac.mm",
76     "browser/shell_message_filter.cc",
77     "browser/shell_message_filter.h",
78     "browser/shell_net_log.cc",
79     "browser/shell_net_log.h",
80     "browser/shell_network_delegate.cc",
81     "browser/shell_network_delegate.h",
82     "browser/shell_notification_manager.cc",
83     "browser/shell_notification_manager.h",
84     "browser/shell_platform_data_aura.cc",
85     "browser/shell_platform_data_aura.h",
86     "browser/shell_plugin_service_filter.cc",
87     "browser/shell_plugin_service_filter.h",
88     "browser/shell_quota_permission_context.cc",
89     "browser/shell_quota_permission_context.h",
90     "browser/shell_resource_dispatcher_host_delegate.cc",
91     "browser/shell_resource_dispatcher_host_delegate.h",
92     "browser/shell_speech_recognition_manager_delegate.cc",
93     "browser/shell_speech_recognition_manager_delegate.h",
94     "browser/shell_url_request_context_getter.cc",
95     "browser/shell_url_request_context_getter.h",
96     "browser/shell_web_contents_view_delegate_android.cc",
97     "browser/shell_web_contents_view_delegate_creator.h",
98     "browser/shell_web_contents_view_delegate.h",
99     "browser/shell_web_contents_view_delegate_mac.mm",
100     "browser/shell_web_contents_view_delegate_win.cc",
101     "browser/webkit_test_controller.cc",
102     "browser/webkit_test_controller.h",
103     "common/leak_detection_result.h",
104     "common/shell_content_client.cc",
105     "common/shell_content_client.h",
106     "common/shell_messages.cc",
107     "common/shell_messages.h",
108     "common/shell_switches.cc",
109     "common/shell_switches.h",
110     "common/shell_test_configuration.cc",
111     "common/shell_test_configuration.h",
112     "common/test_runner/test_preferences.cc",
113     "common/test_runner/test_preferences.h",
114     "common/webkit_test_helpers.cc",
115     "common/webkit_test_helpers.h",
116     "geolocation/shell_access_token_store.cc",
117     "geolocation/shell_access_token_store.h",
118     "renderer/gc_controller.cc",
119     "renderer/gc_controller.h",
120     "renderer/ipc_echo.cc",
121     "renderer/ipc_echo.h",
122     "renderer/leak_detector.cc",
123     "renderer/leak_detector.h",
124     "renderer/shell_content_renderer_client.cc",
125     "renderer/shell_content_renderer_client.h",
126     "renderer/shell_render_frame_observer.cc",
127     "renderer/shell_render_frame_observer.h",
128     "renderer/shell_render_process_observer.cc",
129     "renderer/shell_render_process_observer.h",
130     "renderer/shell_render_view_observer.cc",
131     "renderer/shell_render_view_observer.h",
132     "renderer/test_runner/TestPlugin.cpp",
133     "renderer/test_runner/TestPlugin.h",
134     "renderer/test_runner/WebTask.cpp",
135     "renderer/test_runner/WebTask.h",
136     "renderer/test_runner/WebTestDelegate.h",
137     "renderer/test_runner/WebTestInterfaces.cpp",
138     "renderer/test_runner/WebTestInterfaces.h",
139     "renderer/test_runner/accessibility_controller.cc",
140     "renderer/test_runner/accessibility_controller.h",
141     "renderer/test_runner/event_sender.cc",
142     "renderer/test_runner/event_sender.h",
143     "renderer/test_runner/gamepad_controller.cc",
144     "renderer/test_runner/gamepad_controller.h",
145     "renderer/test_runner/mock_color_chooser.cc",
146     "renderer/test_runner/mock_color_chooser.h",
147     "renderer/test_runner/mock_constraints.cc",
148     "renderer/test_runner/mock_constraints.h",
149     "renderer/test_runner/mock_grammar_check.cc",
150     "renderer/test_runner/mock_grammar_check.h",
151     "renderer/test_runner/mock_screen_orientation_client.cc",
152     "renderer/test_runner/mock_screen_orientation_client.h",
153     "renderer/test_runner/mock_spell_check.cc",
154     "renderer/test_runner/mock_spell_check.h",
155     "renderer/test_runner/mock_web_audio_device.cc",
156     "renderer/test_runner/mock_web_audio_device.h",
157     "renderer/test_runner/mock_web_media_stream_center.cc",
158     "renderer/test_runner/mock_web_media_stream_center.h",
159     "renderer/test_runner/mock_web_midi_accessor.cc",
160     "renderer/test_runner/mock_web_midi_accessor.h",
161     "renderer/test_runner/mock_web_push_client.cc",
162     "renderer/test_runner/mock_web_push_client.h",
163     "renderer/test_runner/mock_web_speech_recognizer.cc",
164     "renderer/test_runner/mock_web_speech_recognizer.h",
165     "renderer/test_runner/mock_web_theme_engine.cc",
166     "renderer/test_runner/mock_web_theme_engine.h",
167     "renderer/test_runner/mock_web_theme_engine_mac.h",
168     "renderer/test_runner/mock_web_theme_engine_mac.mm",
169     "renderer/test_runner/mock_web_user_media_client.cc",
170     "renderer/test_runner/mock_web_user_media_client.h",
171     "renderer/test_runner/mock_webrtc_data_channel_handler.cc",
172     "renderer/test_runner/mock_webrtc_data_channel_handler.h",
173     "renderer/test_runner/mock_webrtc_dtmf_sender_handler.cc",
174     "renderer/test_runner/mock_webrtc_dtmf_sender_handler.h",
175     "renderer/test_runner/mock_webrtc_peer_connection_handler.cc",
176     "renderer/test_runner/mock_webrtc_peer_connection_handler.h",
177     "renderer/test_runner/notification_presenter.cc",
178     "renderer/test_runner/notification_presenter.h",
179     "renderer/test_runner/spell_check_client.cc",
180     "renderer/test_runner/spell_check_client.h",
181     "renderer/test_runner/test_common.cc",
182     "renderer/test_runner/test_common.h",
183     "renderer/test_runner/test_interfaces.cc",
184     "renderer/test_runner/test_interfaces.h",
185     "renderer/test_runner/test_runner.cc",
186     "renderer/test_runner/test_runner.h",
187     "renderer/test_runner/text_input_controller.cc",
188     "renderer/test_runner/text_input_controller.h",
189     "renderer/test_runner/web_ax_object_proxy.cc",
190     "renderer/test_runner/web_ax_object_proxy.h",
191     "renderer/test_runner/web_frame_test_proxy.h",
192     "renderer/test_runner/web_permissions.cc",
193     "renderer/test_runner/web_permissions.h",
194     "renderer/test_runner/web_test_proxy.cc",
195     "renderer/test_runner/web_test_proxy.h",
196     "renderer/test_runner/web_test_runner.h",
197     "renderer/webkit_test_runner.cc",
198     "renderer/webkit_test_runner.h",
199   ]
201   defines = [ "CONTENT_SHELL_VERSION=\"$content_shell_version\"" ]
203   deps = [
204     ":resources",
205     "//base",
206     "//base:base_static",
207     "//base/allocator",
208     "//base/third_party/dynamic_annotations",
209     "//cc",
210     "//components/crash/app",
211     "//content:resources",
212     "//content/app:both",
213     "//content/app/resources",
214     "//content/app/strings",
215     "//content/gpu",
216     "//content/ppapi_plugin",
217     "//content/public/browser",
218     "//content/public/common",
219     "//content/public/plugin",
220     "//content/public/renderer",
221     "//content/public/utility",
222     "//content/test:layouttest_support",
223     "//gin",
224     "//gpu",
225     "//ipc",
226     "//media",
227     "//net",
228     "//net:net_resources",
229     "//skia",
230     "//third_party/WebKit/public:blink",
231     "//third_party/WebKit/public:resources",
232     "//third_party/WebKit/public:test_support",
233     "//third_party/icu",
234     "//ui/base",
235     "//ui/events:events_base",
236     "//ui/gfx",
237     "//ui/gfx/geometry",
238     "//ui/gfx/ipc",
239     "//ui/gl",
240     "//url",
241     "//v8",
242     "//webkit/browser:storage",
243     #'copy_test_netscape_plugin',  TODO(GYP)
244   ]
246   if (is_win) {
247     #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',  TODO(GYP)
249     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
250     cflags = [ "/wd4267" ]
251   }
253   if (is_linux) {
254     configs += [ "//build/config/linux:fontconfig" ]
255   }
257   if (use_x11) {
258     # Some tests rely on this tool at runtime. Note: it might be better if
259     # the tests that needed it had this as a dep instead of adding it here.
260     datadeps = [ "//tools/xdisplaycheck" ]
261   }
263   if (is_android) {
264     #deps += [ 'content_shell_jni_headers' ]  TODO(GYP)
265     #deps -= [ 'copy_test_netscape_plugin' ]  TODO(GYP)
266   }
268   if (is_posix && !is_mac && (!is_android || !is_android_webview_build)) {
269     deps += [ "//components/crash/browser" ]
270   }
272   if (use_aura) {
273     deps += [
274       "//ui/aura",
275       "//ui/aura:test_support",
276       "//ui/events",
277       "//ui/strings",
278       "//ui/wm",
279     ]
281     if (toolkit_views) {
282       sources += [ "browser/shell_views.cc" ]
283       deps += [
284         "//ui/resources",
285         "//ui/views/controls/webview",
286         "//ui/views",
287         "//ui/views:test_support",
288       ]
289     } else {
290       sources += [ "browser/shell_aura.cc" ]
291     }
292   }
294   # The test plugin relies on X11.
295   if (is_linux && !use_x11) {
296     #deps -= [ 'copy_test_netscape_plugin' ]  TODO(GYP)
297   }
299   if (is_chromeos) {
300     deps += [
301       "//ui/wm:test_support",
302       #'../chromeos/chromeos.gyp:chromeos',  TODO(GYP)
303     ]
304   }
306   if (is_linux) {
307     deps += [ "//third_party/freetype2" ]
308   }
310   if (!enable_plugins) {
311     sources -= [
312       "browser/shell_plugin_service_filter.cc",
313       "browser/shell_plugin_service_filter.h",
314     ]
315   }
318 grit("content_shell_resources_grit") {
319   visibility = ":*"
320   source = "shell_resources.grd"
321   outputs = [
322     "grit/shell_resources.h",
323     "shell_resources.pak",
324     "shell_resources.rc",
325   ]
328 copy("copy_shell_resources") {
329   sources = [ "$target_gen_dir/shell_resources.pak" ]
330   outputs = [ "$root_out_dir/shell_resources.pak" ]
332   deps = [ ":content_shell_resources_grit" ]
333   forward_dependent_configs_from = [ ":content_shell_resources_grit" ]
336 # Font copies.
337 if (!is_mac) {
338   copy("copy_ahem") {
339     visibility = ":*"
340     sources = [ "renderer/test_runner/resources/fonts/AHEM____.TTF" ]
341     outputs = [ "$root_out_dir/AHEM____.TTF" ]
342   }
344 if (use_x11) {
345   copy("copy_x11_fonts") {
346     visibility = ":*"
347     sources = [
348       "renderer/test_runner/resources/fonts/fonts.conf",
349       "//third_party/gardiner_mod/GardinerModBug.ttf",
350       "//third_party/gardiner_mod/GardinerModCat.ttf",
351     ]
352     outputs = [ "$root_out_dir/{{source_file_part}}" ]
353   }
355 if (is_android) {
356   copy("copy_android_fonts") {
357     visibility = ":*"
358     sources = [
359       "renderer/test_runner/resources/fonts/android_main_fonts.xml",
360       "renderer/test_runner/resources/fonts/android_fallback_fonts.xml",
361     ]
362     outputs = [ "$root_out_dir/{{source_file_part}}" ]
363   }
366 group("resources") {
367   deps = [
368     ":copy_shell_resources",
369   ]
370   forward_dependent_configs_from = [ ":copy_shell_resources" ]
372   if (is_mac) {
373     # TODO(GYP) Mac bundle resources.
374     #'all_dependent_settings': {
375     #  'mac_bundle_resources': [
376     #    'shell/renderer/test_runner/resources/fonts/AHEM____.TTF',
377     #    'shell/renderer/test_runner/resources/fonts/ChromiumAATTest.ttf',
378     #    '<(SHARED_INTERMEDIATE_DIR)/webkit/missingImage.png',
379     #    '<(SHARED_INTERMEDIATE_DIR)/webkit/textAreaResizeCorner.png',
380     #  ],
381     #},
382   } else {
383     deps += [ ":copy_ahem" ]
384   }
386   if (use_x11) {
387     deps += [ ":copy_x11_fonts" ]
388   }
389   if (is_android) {
390     deps += [ ":copy_android_fonts" ]
391   }
394 repack("pak") {
395   sources = [
396     "$root_gen_dir/blink/public/resources/blink_resources.pak",
397     "$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
398     "$root_gen_dir/content/app/strings/content_strings_en-US.pak",
399     "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
400     "$root_gen_dir/content/content_resources.pak",
401     "$root_gen_dir/content/shell/shell_resources.pak",
402     "$root_gen_dir/net/net_resources.pak",
403     "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
404     "$root_gen_dir/ui/resources/webui_resources.pak",
405     "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
406     "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
407   ]
409   deps = [
410     ":resources",
411     "//content:resources",
412     "//content/app/resources",
413     "//content/app/strings",
414     "//content/browser/tracing:resources",
415     "//net:net_resources",
416     "//third_party/WebKit/public:resources",
417     "//ui/resources",
418     "//ui/strings",
419   ]
421   if (is_android) {
422     output = "$root_out_dir/content_shell/assets/content_shell.pak"
423   } else {
424     sources += [ "$root_gen_dir/webkit/devtools_resources.pak" ]
425     deps += [ "//content/browser/devtools:resources" ]
426     output = "$root_out_dir/content_shell.pak"
427   }
430 executable("content_shell") {
431   # TODO(GYP) mac resource bundle stuff for this target.
432   # TODO(GYP) Windows content shell settings:
433   #  - Manifest.
434   #  - RC file.
435   #  - 'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
436   sources = [
437     "../app/startup_helper_win.cc",
438     "app/shell_main.cc",
439   ]
441   deps = [
442     ":content_shell_lib",
443     ":pak",
444     "//base/allocator",
445     "//third_party/mesa:osmesa",
446   ]
448   if (is_win) {
449     deps += [ "//sandbox" ]
450     if (!is_asan) {
451       configs -= [ "//build/config/win:console" ]
452       configs += [ "//build/config/win:windowed" ]
453     }
454   }
456   if (is_mac) {
457     # TODO(GYP) lots of stuff from GYP file here.
458   }
460   if (!is_android || !is_android_webview_build) {
461     # Some tests rely on this tool. It might be nicer if these tests relied on
462     # image diff rather than having content shell depend on it.
463     datadeps = [
464       "//tools/imagediff($host_toolchain)",
465     ]
466   }