Content settings: remove some plugin-related code/resources when... there are no...
[chromium-blink-merge.git] / content / test / BUILD.gn
blob83a97f6ef3986654d1321fa4e4ed3668a3d40c17
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/chrome_build.gni")
6 import("//build/config/crypto.gni")
7 import("//build/config/features.gni")
8 import("//build/config/ui.gni")
9 import("//build/module_args/v8.gni")
10 import("//media/media_options.gni")
11 import("//testing/test.gni")
12 import("//third_party/mojo/src/mojo/public/tools/bindings/mojom.gni")
14 content_tests_gypi_values =
15     exec_script("//build/gypi_to_gn.py",
16                 [
17                   rebase_path("../content_tests.gypi"),
18                   "--replace=<(SHARED_INTERMEDIATE_DIR)=$root_gen_dir",
19                 ],
20                 "scope",
21                 [ "../content_tests.gypi" ])
23 # GYP version //content/content_tests.gypi:test_support_content
24 source_set("test_support") {
25   testonly = true
26   configs += [ "//build/config:precompiled_headers" ]
27   public_deps = [
28     "//content/public/app:both",
29     "//content/public/browser",
30     "//content/public/common",
31   ]
32   deps = [
33     "//cc/blink",
34     "//net:test_support",
35     "//skia",
36     "//storage/common",
37     "//testing/gmock",
38     "//testing/gtest",
39     "//ui/accessibility:ax_gen",
40     "//ui/base",
41     "//ui/base/ime",
42     "//ui/base:test_support",
43     "//ui/events:dom_keycode_converter",
44     "//ui/events:events_base",
45     "//ui/events:test_support",
46     "//ui/events:gesture_detection",
47     "//ui/gfx:test_support",
48     "//ui/gl",
49     "//ui/gl:test_support",
50     "//ui/resources",
51     "//url",
52   ]
54   if (!is_ios) {
55     sources =
56         rebase_path(content_tests_gypi_values.test_support_content_sources,
57                     ".",
58                     "//content")
60     public_deps += [ "//third_party/WebKit/public:blink" ]
61     deps += [
62       ":content_test_mojo_bindings",
63       "//components/scheduler:scheduler",
64       "//components/scheduler:test_support",
65       "//content/browser/speech/proto",
66       "//content/public/child",
67       "//content/gpu",
68       "//content/public/plugin",
69       "//content/public/renderer",
70       "//content/public/utility",
71       "//content/shell:pak",
72       "//cc",
73       "//cc:test_support",
74       "//ipc/mojo",
75       "//media",
76       "//mojo/application/public/cpp:cpp_for_chromium",
77       "//mojo/environment:chromium",
78       "//ppapi/host",
79       "//ppapi/proxy",
80       "//ppapi/proxy:test_support",
81       "//ppapi/shared_impl",
82       "//ppapi/shared_impl:test_support",
83       "//storage/browser",
84       "//storage/common",
85       "//ui/surface",
86       "//v8",
87     ]
89     if (enable_plugins) {
90       deps += [ "//content/ppapi_plugin" ]
91     }
93     if (enable_webrtc) {
94       sources += [
95         "../renderer/media/mock_data_channel_impl.cc",
96         "../renderer/media/mock_data_channel_impl.h",
97         "../renderer/media/mock_media_stream_dispatcher.cc",
98         "../renderer/media/mock_media_stream_dispatcher.h",
99         "../renderer/media/mock_peer_connection_impl.cc",
100         "../renderer/media/mock_peer_connection_impl.h",
101         "../renderer/media/mock_web_rtc_peer_connection_handler_client.cc",
102         "../renderer/media/mock_web_rtc_peer_connection_handler_client.h",
103         "../renderer/media/webrtc/mock_peer_connection_dependency_factory.cc",
104         "../renderer/media/webrtc/mock_peer_connection_dependency_factory.h",
105       ]
107       deps += [
108         "//third_party/libjingle:libjingle_webrtc",
109         "//third_party/libjingle:libpeerconnection",
110         "//third_party/webrtc/modules/video_capture",
111       ]
112     }
113     if (!enable_plugins) {
114       sources -= [ "ppapi_unittest.cc" ]
115     }
117     if (use_glib) {
118       configs += [ "//build/config/linux:glib" ]
119     }
121     if (use_aura) {
122       deps += [
123         "//ui/aura:test_support",
124         "//ui/resources:ui_test_pak",
125         "//ui/wm",
126       ]
127     }
129     if (use_aura || is_mac) {
130       deps += [ "//ui/compositor" ]
131     }
133     if (use_ozone) {
134       deps += [ "//ui/ozone" ]
135     }
137     if (is_win) {
138       deps += [
139         "//content:startup_helper_win",
140         "//third_party/iaccessible2",
141       ]
142     }
144     if (!is_android && !is_ios) {
145       sources += [
146         "../browser/compositor/test/no_transport_image_transport_factory.cc",
147         "../browser/compositor/test/no_transport_image_transport_factory.h",
148       ]
149       deps += [
150         "//ui/compositor",
151         "//third_party/libvpx",
152       ]
153     }
155     if (is_android) {
156       deps += [
157         "//content/shell/android:copy_content_shell_assets",
158         "//ui/android",
159         "//ui/shell_dialogs",
160       ]
161     }
163     if (is_win) {
164       deps += [ "//sandbox" ]
165     }
166   } else {  # is_ios
167     sources = [
168       "public/test/content_test_suite_base.cc",
169       "public/test/mock_notification_observer.cc",
170       "public/test/mock_resource_context.cc",
171       "public/test/test_browser_thread.cc",
172       "public/test/test_content_client_initializer.cc",
173       "public/test/test_notification_tracker.cc",
174       "public/test/test_utils.cc",
175       "public/test/unittest_test_suite.cc",
176       "test/content_test_suite.cc",
177       "test/test_content_browser_client.cc",
178       "test/test_content_client.cc",
179     ]
180   }
181   if (v8_use_external_startup_data) {
182     deps += [ "//gin:gin" ]
183   }
186 source_set("browsertest_support") {
187   testonly = true
189   sources = [
190     "../public/test/content_browser_test.cc",
191     "../public/test/content_browser_test.h",
192     "../public/test/content_browser_test_utils.cc",
193     "../public/test/content_browser_test_utils.h",
194     "../public/test/content_browser_test_utils_mac.mm",
195     "content_browser_test_utils_internal.cc",
196     "content_browser_test_utils_internal.h",
197     "content_test_launcher.cc",
198   ]
200   deps = [
201     "//content/shell:content_shell_lib",
202     "//skia",
203     "//testing/gtest",
204     "//ui/accessibility:ax_gen",
205   ]
207   if (is_android) {
208     deps += [ "//content/public/app:both" ]
209   } else {
210     deps += [ "//content/public/browser" ]
211   }
214 mojom("content_test_mojo_bindings") {
215   sources = [
216     "../public/test/test_mojo_service.mojom",
217   ]
220 mojom("web_ui_test_mojo_bindings") {
221   sources = [
222     "data/web_ui_test_mojo_bindings.mojom",
223   ]
226 if (!is_ios) {
227   # GYP version //content/content_tests.gypi:layouttest_support_content
228   static_library("layouttest_support") {
229     testonly = true
230     sources = rebase_path(
231             content_tests_gypi_values.layouttest_support_content_sources,
232             ".",
233             "//content")
235     deps = [
236       ":test_support",
237       "//cc",
238       "//cc/blink",
239       "//components/test_runner:test_runner",
240       "//content/public/common",
241       "//skia",
242       "//v8",
243       "//ui/accessibility:ax_gen",
244     ]
246     if (is_android) {
247       deps += [ ":jni" ]
248     }
249   }
251   if (is_android) {
252     import("//build/config/android/rules.gni")
254     generate_jni("jni") {
255       sources = [
256         "../public/test/android/javatests/src/org/chromium/content/browser/test/NestedSystemMessageHandler.java",
257       ]
258       jni_package = "content/public/test"
259     }
260   }
261 }  # !is_ios
263 # TODO(GYP) enable content_browsertests on Mac when it links.
264 if (!is_mac) {
265   # TODO(GYP): Delete this after we've converted everything to GN.
266   # The _run targets exist only for compatibility w/ GYP.
267   group("content_browsertests_run") {
268     testonly = true
269     deps = [
270       ":content_browsertests",
271     ]
272   }
274   test("content_browsertests") {
275     sources =
276         rebase_path(content_tests_gypi_values.content_browsertests_sources,
277                     ".",
278                     "//content")
280     if (is_android || is_linux || is_mac || is_win) {
281       data = [
282         "data/",
283         "//net/data/",
284         "//media/test/data/",
285       ]
287       if (is_android) {
288         data += [ "$root_out_dir/content_shell_assets/content_shell.pak" ]
289       } else {
290         data += [
291           "$root_out_dir/content_shell.pak",
292           "//net/tools/testserver/",
293           "//ppapi/tests/test_case.html",
294           "//ppapi/tests/test_page.css",
295           "//third_party/pyftpdlib/",
296           "//third_party/pywebsocket/",
297           "//third_party/tlslite/",
298         ]
300         if (is_mac) {
301           data += [
302             "$root_out_dir/Content Shell.app/",
303             "$root_out_dir/plugins/test_netscape_plugin.plugin/",
304           ]
305         }
306         if (is_win) {
307           data += [ "$root_out_dir/plugins/np_test_netscape_plugin.dll" ]
308         }
309       }
310     }
312     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
314     if (proprietary_codecs && enable_hevc_demuxing) {
315       defines += [ "ENABLE_HEVC_DEMUXING" ]
316     }
318     configs += [
319       "//build/config:precompiled_headers",
320       "//build/config/compiler:no_size_t_to_int_warning",
321     ]
323     deps = [
324       ":browsertest_support",
325       ":web_ui_test_mojo_bindings",
326       "//base/allocator",
327       "//base/test:test_support",
328       "//content/browser/background_sync:background_sync_proto",
329       "//content/common:mojo_bindings",
330       "//content/gpu",
331       "//content/public/common",
332       "//content/public/plugin",
333       "//content/public/renderer",
334       "//content:resources",
335       "//content/shell:content_shell_lib",
336       "//content/shell:pak",
337       "//content/test:test_support",
338       "//device/battery",
339       "//device/battery:mojo_bindings",
340       "//gin",
341       "//gpu",
342       "//ipc:test_support",
343       "//media:test_support",
344       "//media/audio:test_support",
345       "//media/base:test_support",
346       "//media:shared_memory_support",
347       "//mojo/application/public/cpp:cpp_for_chromium",
348       "//mojo/environment:chromium",
349       "//mojo/test:test_support",
350       "//net:test_support",
351       "//ppapi/host",
352       "//ppapi/proxy",
353       "//ppapi/proxy:ipc",
354       "//ppapi/shared_impl",
355       "//third_party/mojo/src/mojo/edk/system",
356       "//third_party/mojo/src/mojo/edk/test:test_support",
357       "//third_party/mojo/src/mojo/public/cpp/bindings",
358       "//third_party/mojo/src/mojo/public/js",
359       "//testing/gmock",
360       "//testing/gtest",
361       "//third_party/WebKit/public:blink",
362       "//third_party/leveldatabase",
363       "//third_party/mesa:osmesa",
364       "//third_party/zlib",
365       "//ui/accessibility",
366       "//ui/accessibility:ax_gen",
367       "//ui/base",
368       "//ui/base/ime",
369       "//ui/gfx",
370       "//ui/gfx/geometry",
371       "//ui/gl",
372       "//ui/gl:test_support",
373       "//ui/resources",
374       "//ui/shell_dialogs",
375       "//ui/snapshot",
376     ]
378     data_deps = [
379       "//ppapi:ppapi_tests",
380       "//third_party/mesa:osmesa",
381     ]
383     if (is_win) {
384       sources += rebase_path(
385               content_tests_gypi_values.content_browsertests_win_sources,
386               ".",
387               "//content")
389       deps += [
390         "//content/app/strings",
391         "//net:net_resources",
392         "//third_party/WebKit/public:resources",
393         "//third_party/iaccessible2",
394         "//third_party/isimpledom",
395       ]
397       libs = [ "oleacc.lib" ]
398     }
400     if (is_linux) {
401       sources -=
402           [ "../browser/accessibility/dump_accessibility_tree_browsertest.cc" ]
403     }
405     if (is_android) {
406       sources += rebase_path(
407               content_tests_gypi_values.content_browsertests_android_sources,
408               ".",
409               "//content")
410       sources -=
411           [ "../browser/battery_status/battery_monitor_impl_browsertest.cc" ]
412       deps -= [ "//device/battery" ]
413       deps += [
414         "//content/shell/android:content_shell_jni_headers",
415         "//content/shell:content_shell_lib",
416         "//testing/android/native_test:native_test_support",
417       ]
419       use_launcher = false
420     }
422     if (is_mac) {
423       sources += [ "../renderer/external_popup_menu_browsertest.cc" ]
424       deps += [
425         # Needed for Content Shell.app's Helper.
426         #"//content/shell:content_shell",  #TODO(GYP) enable for mac
427       ]
428     }
430     if (use_aura && !is_win) {
431       deps += [ "//ui/events:test_support" ]
432     }
434     if (!use_aura && !is_mac) {
435       sources -=
436           [ "../browser/compositor/image_transport_factory_browsertest.cc" ]
437     }
439     if (enable_webrtc) {
440       sources += rebase_path(
441               content_tests_gypi_values.content_browsertests_webrtc_sources,
442               ".",
443               "//content")
444       deps += [ "//testing/perf" ]
445     }
447     if (enable_plugins) {
448       sources += rebase_path(
449               content_tests_gypi_values.content_browsertests_plugins_sources,
450               ".",
451               "//content")
452       data_deps += [ "//ppapi:ppapi_tests" ]
453     }
455     if (enable_web_speech) {
456       sources += rebase_path(
457               content_tests_gypi_values.content_browsertests_speech_sources,
458               ".",
459               "//content")
460     }
462     if (!is_chrome_branded) {
463       sources += rebase_path(
464               content_tests_gypi_values.content_browsertests_unofficial_build_sources,
465               ".",
466               "//content")
467     }
469     if (use_aura) {
470       deps += [
471         "//ui/touch_selection:test_support",
472         "//ui/touch_selection:touch_selection",
473       ]
474     } else {
475       sources -= [
476         "../browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc",
477         "../browser/web_contents/web_contents_view_aura_browsertest.cc",
478       ]
479     }
480   }
483 # TODO(GYP): Delete this after we've converted everything to GN.
484 # The _run targets exist only for compatibility w/ GYP.
485 group("content_unittests_run") {
486   testonly = true
487   deps = [
488     ":content_unittests",
489   ]
492 test("content_unittests") {
493   sources = rebase_path(content_tests_gypi_values.content_unittests_sources,
494                         ".",
495                         "//content")
497   if (is_android || is_linux || is_mac || is_win) {
498     data = [
499       "data/",
500       "//net/data/ssl/certificates/",
501       "//media/test/data/",
502     ]
504     if (is_android) {
505       data += [ "$root_out_dir/content_shell_assets/content_shell.pak" ]
506     } else {
507       data += [ "$root_out_dir/content_shell.pak" ]
508     }
509   }
511   configs += [ "//build/config:precompiled_headers" ]
513   deps = [
514     ":test_support",
515     "//base/allocator",
516     "//base/test:test_support",
517     "//content/browser/background_sync:background_sync_proto",
518     "//content/browser/notifications:notification_proto",
519     "//content/browser/service_worker:service_worker_proto",
520     "//content/browser/speech/proto",
521     "//content/common:mojo_bindings",
522     "//content/public/browser",
523     "//content/public/common",
524     "//content/public/common:mojo_bindings",
525     "//crypto",
526     "//device/battery",
527     "//device/battery:mojo_bindings",
528     "//mojo/environment:chromium",
529     "//net:extras",
530     "//net:test_support",
531     "//skia",
532     "//sql",
533     "//sql:test_support",
534     "//testing/gmock",
535     "//testing/gtest",
536     "//third_party/mojo/src/mojo/edk/test:test_support",
537     "//third_party/mojo/src/mojo/public/cpp/bindings",
538     "//third_party/re2",
539     "//ui/accessibility",
540     "//ui/base",
541     "//ui/events/blink",
542     "//ui/gfx",
543     "//ui/gfx/geometry",
544     "//ui/gfx/ipc",
545   ]
547   if (!is_ios) {
548     deps += [
549       "//base/third_party/dynamic_annotations",
550       "//cc",
551       "//cc:test_support",
552       "//cc/surfaces",
553       "//content:resources",
554       "//content/gpu",
555       "//content/public/browser",
556       "//content/public/child",
557       "//content/public/plugin",
558       "//content/public/renderer",
559       "//gin",
560       "//gpu",
561       "//gpu:test_support",
562       "//ipc:test_support",
563       "//media:test_support",
564       "//media:shared_memory_support",
565       "//media/audio:test_support",
566       "//media/base:test_support",
567       "//media/midi:midi",
568       "//storage/browser",
569       "//storage/common",
570       "//third_party/WebKit/public:blink",
571       "//third_party/icu",
572       "//third_party/leveldatabase",
573       "//third_party/libjingle",
574       "//ui/compositor:test_support",
575       "//ui/gl",
576       "//ui/gl:test_support",
577     ]
578   }
580   data_deps = [ "//third_party/mesa:osmesa" ]
582   if (!is_win) {
583     sources += [ "../browser/file_descriptor_info_impl_unittest.cc" ]
584   }
586   if (enable_plugins) {
587     sources +=
588         rebase_path(content_tests_gypi_values.content_unittests_plugins_sources,
589                     ".",
590                     "//content")
591   }
593   if (enable_webrtc) {
594     sources +=
595         rebase_path(content_tests_gypi_values.content_unittests_webrtc_sources,
596                     ".",
597                     "//content")
598     deps += [
599       "//third_party/libjingle:libjingle_webrtc",
600       "//third_party/libjingle:libpeerconnection",
601       "//third_party/webrtc/modules/video_capture",
602     ]
604     if (is_linux || is_mac || is_win) {
605       sources +=
606           [ "../browser/media/capture/desktop_capture_device_unittest.cc" ]
607       deps += [ "//third_party/webrtc/modules/desktop_capture" ]
608     }
610     if (is_chromeos) {
611       sources +=
612           [ "../browser/media/capture/desktop_capture_device_aura_unittest.cc" ]
613     }
614   } else {
615     if (enable_plugins) {
616       # This file is added only when plugins are enabled, but we don't want it
617       # unless webrtc is also enabled.
618       sources -=
619           [ "../renderer/media/pepper_to_video_track_adapter_unittest.cc" ]
620     }
621   }
623   if (enable_web_speech) {
624     sources +=
625         rebase_path(content_tests_gypi_values.content_unittests_speech_sources,
626                     ".",
627                     "//content")
628   }
630   if (is_linux) {
631     if (use_dbus) {
632       deps += [ "//dbus:test_support" ]
633     } else {
634       sources -=
635           [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
636     }
637   }
638   if (is_win) {
639     deps += [ "//third_party/iaccessible2" ]
640   }
641   if (is_mac) {
642     # These flags are needed to run the test on Mac.
643     # Search for comments about "xcode_settings" in chrome_tests.gypi.
644     ldflags = [ "-Wl,-ObjC" ]
646     deps += [ "//third_party/ocmock" ]
647   }
648   if (is_chromeos) {
649     sources -= [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
650     deps += [ "//chromeos" ]
651   }
652   if (is_android) {
653     sources +=
654         rebase_path(content_tests_gypi_values.content_unittests_android_sources,
655                     ".",
656                     "//content")
657     sources -= [
658       "../browser/geolocation/network_location_provider_unittest.cc",
659       "../browser/geolocation/wifi_data_provider_common_unittest.cc",
660       "../browser/power_usage_monitor_impl_unittest.cc",
661       "../browser/renderer_host/begin_frame_observer_proxy_unittest.cc",
662       "../browser/webui/url_data_manager_backend_unittest.cc",
663     ]
664     deps -= [ "//device/battery" ]
665     deps += [ "//testing/android/native_test:native_test_native_code" ]
666   }
667   if (!is_android && !is_ios) {
668     deps += [ "//third_party/libvpx" ]
669   }
671   if (use_aura) {
672     deps += [
673       "//ui/aura",
674       "//ui/aura_extra",
675       "//ui/wm",
676     ]
677   } else {
678     sources -= [
679       "../browser/renderer_host/render_widget_host_view_aura_unittest.cc",
680       "../browser/renderer_host/web_input_event_aura_unittest.cc",
681       "../browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc",
682       "../browser/web_contents/aura/overscroll_window_animation_unittest.cc",
683       "../browser/web_contents/aura/overscroll_window_delegate_unittest.cc",
684       "../browser/web_contents/web_contents_view_aura_unittest.cc",
685     ]
686   }
687   if (use_aura || toolkit_views) {
688     deps += [ "//ui/events:test_support" ]
689   }
690   if (!use_aura && !is_mac) {
691     sources -= [
692       "../browser/compositor/buffer_queue_unittest.cc",
693       "../browser/compositor/reflector_impl_unittest.cc",
694       "../browser/compositor/software_browser_compositor_output_surface_unittest.cc",
695     ]
696   }
698   if (!is_win && !is_mac) {
699     sources -= [ "../common/plugin_list_unittest.cc" ]
700   }
702   if (use_ozone) {
703     deps += [
704       "//ui/ozone",
705       "//ui/ozone:ozone_base",
706     ]
707   } else {
708     sources -=
709         [ "../browser/compositor/software_output_device_ozone_unittest.cc" ]
710   }
712   if (is_mac && use_openssl) {
713     deps += [ "//third_party/boringssl" ]
714   }
717 if (!is_mac) {  # TODO(GYP) enable on Mac once it links.
718   test("content_perftests") {
719     sources = [
720       "../browser/renderer_host/input/input_router_impl_perftest.cc",
721       "../common/cc_messages_perftest.cc",
722       "../test/run_all_perftests.cc",
723     ]
724     deps = [
725       "//base/allocator",
726       "//base/test:test_support",
727       "//content/public/browser",
728       "//content/public/common",
729       "//content/test:test_support",
730       "//cc",
731       "//skia",
732       "//testing/gtest",
733       "//testing/perf",
734       "//ui/gfx",
735       "//ui/gfx/geometry",
736     ]
738     if (is_android) {
739       deps += [ "//testing/android/native_test:native_test_native_code" ]
740     }
741   }
743   # TODO(GYP): Delete this after we've converted everything to GN.
744   # The _run targets exist only for compatibility w/ GYP.
745   group("content_gl_tests_run") {
746     testonly = true
747     deps = [
748       ":content_gl_tests",
749     ]
750   }
752   test("content_gl_tests") {
753     sources = [
754       "../common/gpu/client/gl_helper_unittest.cc",
755       "../common/gpu/client/gpu_in_process_context_tests.cc",
756     ]
758     deps = [
759       ":test_support",
760       "//base/allocator",
761       "//base/test:test_support",
762       "//content/public/common",
763       "//gpu/blink",
764       "//gpu/command_buffer/common",
765       "//testing/gtest",
766       "//third_party/WebKit/public:blink",
767       "//ui/base",
768       "//ui/gfx",
769       "//ui/gfx:test_support",
770       "//ui/gfx/geometry",
771       "//ui/gl",
772       "//ui/gl:test_support",
773       "//v8",
774     ]
776     if (is_android) {
777       deps += [ "//testing/android/native_test:native_test_native_code" ]
778     } else {
779       data_deps = [
780         "//third_party/ffmpeg",
781         "//third_party/mesa:osmesa",
782       ]
783     }
784   }
786   test("content_gl_benchmark") {
787     sources = [
788       "../common/gpu/client/gl_helper_benchmark.cc",
789     ]
791     deps = [
792       ":test_support",
793       "//base/allocator",
794       "//base/test:test_support",
795       "//content/public/common",
796       "//gpu/blink",
797       "//testing/gtest",
798       "//third_party/WebKit/public:blink",
799       "//ui/base",
800       "//ui/gfx",
801       "//ui/gfx/geometry",
802       "//ui/gl",
803       "//ui/gl:test_support",
804     ]
805   }