Roll src/third_party/skia 2440fcd:4de8c3a
[chromium-blink-merge.git] / content / shell / BUILD.gn
blob1ee13ab28df51b695a212cd101007694503f6ce3
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/sanitizers/sanitizers.gni")
7 import("//build/config/ui.gni")
8 import("//build/config/win/manifest.gni")
9 import("//tools/grit/repack.gni")
10 import("//tools/grit/grit_rule.gni")
11 if (is_android) {
12   import("//build/config/android/config.gni")
15 declare_args() {
16   content_shell_product_name = "Content Shell"
18   # The "19" is so that sites that sniff for version think that this is
19   # something reasonably current; the "77.34.5" is a hint that this isn't a
20   # standard Chrome.
21   content_shell_version = "19.77.34.5"
24 static_library("content_shell_lib") {
25   testonly = true
26   sources = [
27     "android/shell_jni_registrar.cc",
28     "android/shell_jni_registrar.h",
29     "android/shell_manager.cc",
30     "android/shell_manager.h",
31     "app/blink_test_platform_support.h",
32     "app/blink_test_platform_support_android.cc",
33     "app/blink_test_platform_support_linux.cc",
34     "app/blink_test_platform_support_mac.mm",
35     "app/blink_test_platform_support_win.cc",
36     "app/paths_mac.h",
37     "app/paths_mac.mm",
38     "app/shell_crash_reporter_client.cc",
39     "app/shell_crash_reporter_client.h",
40     "app/shell_main_delegate.cc",
41     "app/shell_main_delegate.h",
42     "app/shell_main_delegate_mac.h",
43     "app/shell_main_delegate_mac.mm",
44     "browser/blink_test_controller.cc",
45     "browser/blink_test_controller.h",
46     "browser/ipc_echo_message_filter.cc",
47     "browser/ipc_echo_message_filter.h",
48     "browser/layout_test/layout_test_android.cc",
49     "browser/layout_test/layout_test_android.h",
50     "browser/layout_test/layout_test_bluetooth_adapter_provider.cc",
51     "browser/layout_test/layout_test_bluetooth_adapter_provider.h",
52     "browser/layout_test/layout_test_bluetooth_chooser_factory.cc",
53     "browser/layout_test/layout_test_bluetooth_chooser_factory.h",
54     "browser/layout_test/layout_test_browser_context.cc",
55     "browser/layout_test/layout_test_browser_context.h",
56     "browser/layout_test/layout_test_browser_main.cc",
57     "browser/layout_test/layout_test_browser_main.h",
58     "browser/layout_test/layout_test_browser_main_parts.cc",
59     "browser/layout_test/layout_test_browser_main_parts.h",
60     "browser/layout_test/layout_test_content_browser_client.cc",
61     "browser/layout_test/layout_test_content_browser_client.h",
62     "browser/layout_test/layout_test_devtools_frontend.cc",
63     "browser/layout_test/layout_test_devtools_frontend.h",
64     "browser/layout_test/layout_test_download_manager_delegate.cc",
65     "browser/layout_test/layout_test_download_manager_delegate.h",
66     "browser/layout_test/layout_test_javascript_dialog_manager.cc",
67     "browser/layout_test/layout_test_javascript_dialog_manager.h",
68     "browser/layout_test/layout_test_message_filter.cc",
69     "browser/layout_test/layout_test_message_filter.h",
70     "browser/layout_test/layout_test_navigator_connect_service_factory.cc",
71     "browser/layout_test/layout_test_navigator_connect_service_factory.h",
72     "browser/layout_test/layout_test_notification_manager.cc",
73     "browser/layout_test/layout_test_notification_manager.h",
74     "browser/layout_test/layout_test_permission_manager.cc",
75     "browser/layout_test/layout_test_permission_manager.h",
76     "browser/layout_test/layout_test_push_messaging_service.cc",
77     "browser/layout_test/layout_test_push_messaging_service.h",
78     "browser/layout_test/layout_test_resource_dispatcher_host_delegate.cc",
79     "browser/layout_test/layout_test_resource_dispatcher_host_delegate.h",
80     "browser/layout_test/layout_test_url_request_context_getter.cc",
81     "browser/layout_test/layout_test_url_request_context_getter.h",
82     "browser/notify_done_forwarder.cc",
83     "browser/notify_done_forwarder.h",
84     "browser/shell.cc",
85     "browser/shell.h",
86     "browser/shell_access_token_store.cc",
87     "browser/shell_access_token_store.h",
88     "browser/shell_android.cc",
89     "browser/shell_application_mac.h",
90     "browser/shell_application_mac.mm",
91     "browser/shell_browser_context.cc",
92     "browser/shell_browser_context.h",
93     "browser/shell_browser_main.cc",
94     "browser/shell_browser_main.h",
95     "browser/shell_browser_main_parts.cc",
96     "browser/shell_browser_main_parts.h",
97     "browser/shell_browser_main_parts_mac.mm",
98     "browser/shell_content_browser_client.cc",
99     "browser/shell_content_browser_client.h",
100     "browser/shell_devtools_frontend.cc",
101     "browser/shell_devtools_frontend.h",
102     "browser/shell_devtools_manager_delegate.cc",
103     "browser/shell_devtools_manager_delegate.h",
104     "browser/shell_download_manager_delegate.cc",
105     "browser/shell_download_manager_delegate.h",
106     "browser/shell_javascript_dialog.h",
107     "browser/shell_javascript_dialog_mac.mm",
108     "browser/shell_javascript_dialog_manager.cc",
109     "browser/shell_javascript_dialog_manager.h",
110     "browser/shell_javascript_dialog_win.cc",
111     "browser/shell_login_dialog.cc",
112     "browser/shell_login_dialog.h",
113     "browser/shell_login_dialog_mac.mm",
114     "browser/shell_mac.mm",
115     "browser/shell_mojo_test_utils_android.cc",
116     "browser/shell_mojo_test_utils_android.h",
117     "browser/shell_net_log.cc",
118     "browser/shell_net_log.h",
119     "browser/shell_network_delegate.cc",
120     "browser/shell_network_delegate.h",
121     "browser/shell_permission_manager.cc",
122     "browser/shell_permission_manager.h",
123     "browser/shell_platform_data_aura.cc",
124     "browser/shell_platform_data_aura.h",
125     "browser/shell_plugin_service_filter.cc",
126     "browser/shell_plugin_service_filter.h",
127     "browser/shell_quota_permission_context.cc",
128     "browser/shell_quota_permission_context.h",
129     "browser/shell_resource_dispatcher_host_delegate.cc",
130     "browser/shell_resource_dispatcher_host_delegate.h",
131     "browser/shell_speech_recognition_manager_delegate.cc",
132     "browser/shell_speech_recognition_manager_delegate.h",
133     "browser/shell_url_request_context_getter.cc",
134     "browser/shell_url_request_context_getter.h",
135     "browser/shell_web_contents_view_delegate.h",
136     "browser/shell_web_contents_view_delegate_android.cc",
137     "browser/shell_web_contents_view_delegate_creator.h",
138     "browser/shell_web_contents_view_delegate_mac.mm",
139     "browser/shell_web_contents_view_delegate_win.cc",
140     "common/layout_test/layout_test_messages.cc",
141     "common/layout_test/layout_test_messages.h",
142     "common/leak_detection_result.h",
143     "common/shell_content_client.cc",
144     "common/shell_content_client.h",
145     "common/shell_messages.cc",
146     "common/shell_messages.h",
147     "common/shell_switches.cc",
148     "common/shell_switches.h",
149     "common/shell_test_configuration.cc",
150     "common/shell_test_configuration.h",
151     "renderer/ipc_echo.cc",
152     "renderer/ipc_echo.h",
153     "renderer/layout_test/blink_test_helpers.cc",
154     "renderer/layout_test/blink_test_helpers.h",
155     "renderer/layout_test/blink_test_runner.cc",
156     "renderer/layout_test/blink_test_runner.h",
157     "renderer/layout_test/gc_controller.cc",
158     "renderer/layout_test/gc_controller.h",
159     "renderer/layout_test/layout_test_content_renderer_client.cc",
160     "renderer/layout_test/layout_test_content_renderer_client.h",
161     "renderer/layout_test/layout_test_render_frame_observer.cc",
162     "renderer/layout_test/layout_test_render_frame_observer.h",
163     "renderer/layout_test/layout_test_render_process_observer.cc",
164     "renderer/layout_test/layout_test_render_process_observer.h",
165     "renderer/layout_test/leak_detector.cc",
166     "renderer/layout_test/leak_detector.h",
167     "renderer/layout_test/test_media_stream_renderer_factory.cc",
168     "renderer/layout_test/test_media_stream_renderer_factory.h",
169     "renderer/layout_test/test_video_frame_provider.cc",
170     "renderer/layout_test/test_video_frame_provider.h",
171     "renderer/shell_content_renderer_client.cc",
172     "renderer/shell_content_renderer_client.h",
173     "renderer/shell_render_view_observer.cc",
174     "renderer/shell_render_view_observer.h",
175     "utility/shell_content_utility_client.cc",
176     "utility/shell_content_utility_client.h",
177   ]
179   configs += [
180     "//build/config:precompiled_headers",
182     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
183     "//build/config/compiler:no_size_t_to_int_warning",
184   ]
186   defines = [ "CONTENT_SHELL_VERSION=\"$content_shell_version\"" ]
188   public_deps = [
189     # This exposes all public content APIs.
190     "//content/public/app:both",
191     "//content/public/browser",
192     "//content/public/common",
193     "//content/public/plugin",
194     "//content/public/renderer",
195     "//content/public/utility",
196   ]
197   deps = [
198     ":resources",
199     "//base",
200     "//base:base_static",
201     "//base/allocator",
202     "//base/third_party/dynamic_annotations",
203     "//cc",
204     "//components/crash/content/app",
205     "//components/devtools_discovery",
206     "//components/devtools_http_handler",
207     "//components/plugins/renderer",
208     "//components/test_runner:test_runner",
209     "//components/url_formatter",
210     "//components/web_cache/renderer",
211     "//content:resources",
212     "//content/app/resources",
213     "//content/app/strings",
214     "//content/gpu",
215     "//content/test:layouttest_support",
216     "//device/bluetooth",
217     "//device/bluetooth:mocks",
218     "//gin",
219     "//gpu",
220     "//ipc",
221     "//media",
222     "//net",
223     "//net:net_resources",
224     "//skia",
225     "//storage/browser",
226     "//testing/gmock",
227     "//testing/gtest",
228     "//third_party/WebKit/public:blink",
229     "//third_party/WebKit/public:image_resources",
230     "//third_party/WebKit/public:resources",
231     "//third_party/WebKit/public:test_support",
232     "//third_party/icu",
233     "//ui/base",
234     "//ui/base/ime",
235     "//ui/events:events_base",
236     "//ui/gfx",
237     "//ui/gfx/geometry",
238     "//ui/gfx/ipc",
239     "//ui/gl",
240     "//url",
241     "//v8",
243     #'copy_test_netscape_plugin',  TODO(GYP)
244   ]
245   if (enable_plugins) {
246     deps += [ "//content/ppapi_plugin" ]
247   }
249   if (is_win) {
250     #'LinkIncremental': '<(msvs_large_module_debug_link_mode)',  TODO(GYP)
251     sources += [
252       "common/v8_breakpad_support_win.cc",
253       "common/v8_breakpad_support_win.h",
254     ]
255   }
257   if (is_linux) {
258     configs += [ "//build/config/linux:fontconfig" ]
259   }
261   if (use_x11) {
262     # Some tests rely on this tool at runtime. Note: it might be better if
263     # the tests that needed it had this as a dep instead of adding it here.
264     data_deps = [ "//tools/xdisplaycheck" ]
266     deps += [ "//ui/events/devices" ]
267   }
269   if (is_android) {
270     deps += [ "//content/shell/android:content_shell_jni_headers" ]
271     #deps -= [ "copy_test_netscape_plugin" ]  TODO(GYP)
272   }
274   if (is_posix && !is_mac) {
275     deps += [ "//components/crash/content/browser" ]
276   }
278   if (use_aura) {
279     deps += [
280       "//ui/aura",
281       "//ui/aura:test_support",
282       "//ui/events",
283       "//ui/strings",
284       "//ui/wm",
285     ]
287     if (toolkit_views) {
288       sources += [ "browser/shell_views.cc" ]
289       deps += [
290         "//ui/resources",
291         "//ui/views/controls/webview",
292         "//ui/views",
293         "//ui/views:test_support",
294       ]
295     } else {
296       sources += [ "browser/shell_aura.cc" ]
297     }
298   } else {
299     sources -= [
300       "browser/shell_platform_data_aura.cc",
301       "browser/shell_platform_data_aura.h",
302     ]
303   }
305   # The test plugin relies on X11.
306   if (is_linux && !use_x11) {
307     #deps -= [ 'copy_test_netscape_plugin' ]  TODO(GYP)
308   }
310   if (is_chromeos) {
311     deps += [
312       "//chromeos",
313       "//ui/wm:test_support",
314     ]
315   }
317   if (is_linux) {
318     deps += [ "//third_party/freetype2" ]
319   }
321   if (!enable_plugins) {
322     sources -= [
323       "browser/shell_plugin_service_filter.cc",
324       "browser/shell_plugin_service_filter.h",
325     ]
326   }
329 grit("content_shell_resources_grit") {
330   visibility = [ ":*" ]
331   source = "shell_resources.grd"
332   outputs = [
333     "grit/shell_resources.h",
334     "shell_resources.pak",
335   ]
338 copy("copy_shell_resources") {
339   sources = [
340     "$target_gen_dir/shell_resources.pak",
341   ]
342   outputs = [
343     "$root_out_dir/shell_resources.pak",
344   ]
346   public_deps = [
347     ":content_shell_resources_grit",
348   ]
351 group("resources") {
352   public_deps = [
353     ":copy_shell_resources",
354   ]
355   deps = [
356     "//components/test_runner:resources",
357   ]
360 repack("pak") {
361   sources = [
362     "$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak",
363     "$root_gen_dir/blink/public/resources/blink_resources.pak",
364     "$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
365     "$root_gen_dir/content/app/strings/content_strings_en-US.pak",
366     "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
367     "$root_gen_dir/content/content_resources.pak",
368     "$root_gen_dir/content/shell/shell_resources.pak",
369     "$root_gen_dir/net/net_resources.pak",
370     "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
371     "$root_gen_dir/ui/resources/webui_resources.pak",
372     "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
373     "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
374   ]
376   deps = [
377     ":resources",
378     "//content:resources",
379     "//content/app/resources",
380     "//content/app/strings",
381     "//content/browser/tracing:resources",
382     "//net:net_resources",
383     "//third_party/WebKit/public:image_resources",
384     "//third_party/WebKit/public:resources",
385     "//ui/resources",
386     "//ui/strings",
387   ]
389   if (toolkit_views) {
390     deps += [ "//ui/views/resources" ]
391     sources +=
392         [ "$root_gen_dir/ui/views/resources/views_resources_100_percent.pak" ]
393   }
395   sources += [ "$root_gen_dir/blink/devtools_resources.pak" ]
396   deps += [ "//content/browser/devtools:resources" ]
397   output = "$root_out_dir/content_shell.pak"
400 # TODO(GYP): Figure out what this should be on android
401 # and make linking this work on the Mac.
402 if (!is_android && !is_mac) {
403   # TODO(brettw) when GYP is no longer necessary, delete
404   # content/shell/app/shell.exe.manifest. This file is not used in GN.
405   executable("content_shell") {
406     testonly = true
408     # TODO(GYP) mac resource bundle stuff for this target.
409     # TODO(GYP) Windows content shell settings:
410     #  - RC file.
411     #  - 'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
412     sources = [
413       "app/shell_main.cc",
414     ]
416     deps = [
417       ":content_shell_lib",
418       ":pak",
419       "//base/allocator",
420       "//build/config/sanitizers:deps",
421       "//build/win:default_exe_manifest",
422     ]
424     if (is_win) {
425       deps += [ "//sandbox" ]
426       if (!is_asan) {
427         configs -= [ "//build/config/win:console" ]
428         configs += [ "//build/config/win:windowed" ]
429       }
430     }
432     if (is_mac) {
433       # TODO(GYP) lots of stuff from GYP file here.
434     }
436     if (is_android) {
437       # Some tests rely on this tool. It might be nicer if these tests relied on
438       # image diff rather than having content shell depend on it.
439       data_deps = [ "//tools/imagediff($host_toolchain)" ]
440     }
441   }
442 } else {
443   group("content_shell") {
444     testonly = true
445     deps = [
446       ":content_shell_lib",
447     ]
448   }
451 if (is_win) {
452   # GYP version: content/content_shell_and_tests.gyp:content_shell_crash_service
453   executable("crash_service") {
454     sources = [
455       "tools/content_shell_crash_service.cc",
456     ]
458     deps = [
459       "//base",
460       "//build/config/sanitizers:deps",
461       "//components/crash/content/tools:crash_service",
462     ]
464     configs -= [ "//build/config/win:console" ]
465     configs += [ "//build/config/win:windowed" ]
466   }