Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / content / test / BUILD.gn
blob45bd97ca7e94c50c97856aead22b40801b1b4158
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/crypto.gni")
6 import("//build/config/features.gni")
7 import("//build/config/ui.gni")
8 import("//build/module_args/v8.gni")
9 import("//testing/test.gni")
10 import("//third_party/mojo/src/mojo/public/tools/bindings/mojom.gni")
12 content_tests_gypi_values =
13     exec_script("//build/gypi_to_gn.py",
14                 [
15                   rebase_path("../content_tests.gypi"),
16                   "--replace=<(SHARED_INTERMEDIATE_DIR)=$root_gen_dir",
17                 ],
18                 "scope",
19                 [ "../content_tests.gypi" ])
21 # GYP version //content/content_tests.gypi:test_support_content
22 static_library("test_support") {
23   testonly = true
24   public_deps = []
25   deps = [
26     "//cc/blink",
27     "//content/public/app:both",
28     "//content/public/browser:browser_sources",
29     "//content/public/common:common_sources",
30     "//net:test_support",
31     "//skia",
32     "//storage/common",
33     "//testing/gmock",
34     "//testing/gtest",
35     "//ui/accessibility:ax_gen",
36     "//ui/base",
37     "//ui/base:test_support",
38     "//ui/events:dom4_keycode_converter",
39     "//ui/events:events_base",
40     "//ui/events:test_support",
41     "//ui/events:gesture_detection",
42     "//ui/gfx:test_support",
43     "//ui/gl",
44     "//ui/resources",
45     "//url",
46   ]
48   if (!is_ios) {
49     sources =
50         rebase_path(content_tests_gypi_values.test_support_content_sources,
51                     ".",
52                     "//content")
54     public_deps += [ "//third_party/WebKit/public:blink" ]
55     deps += [
56       "//content/browser/speech/proto",
57       "//content/public/child:child_sources",
58       "//content/gpu",
59       "//content/public/renderer:renderer_sources",
60       "//content/public/utility:utility_sources",
61       "//content/shell:pak",
62       "//cc",
63       "//cc:test_support",
64       "//ipc/mojo",
65       "//media",
66       "//ppapi:ppapi_host",
67       "//ppapi:ppapi_proxy",
68       "//ppapi:ppapi_shared",
69       "//ppapi:ppapi_unittest_shared",
70       "//storage/browser",
71       "//storage/common",
72       "//ui/surface",
73       "//v8",
74       "//webkit/common/gpu",
75     ]
77     if (enable_plugins) {
78       deps += [ "//content/ppapi_plugin" ]
79     }
81     if (enable_webrtc) {
82       # TODO(GYP) remove this when libjingle is converted.
83       configs += [ "//third_party/libjingle:jingle_direct_dependent_configs" ]
85       sources += [
86         "../renderer/media/mock_media_stream_dispatcher.cc",
87         "../renderer/media/mock_media_stream_dispatcher.h",
88         "../renderer/media/mock_peer_connection_impl.cc",
89         "../renderer/media/mock_peer_connection_impl.h",
90         "../renderer/media/mock_web_rtc_peer_connection_handler_client.cc",
91         "../renderer/media/mock_web_rtc_peer_connection_handler_client.h",
92         "../renderer/media/webrtc/mock_peer_connection_dependency_factory.cc",
93         "../renderer/media/webrtc/mock_peer_connection_dependency_factory.h",
94       ]
96       deps += [
97         #"//third_party/libjingle:webrtc",  TODO(GYP)
98         #"//third_party/libjingle:peerconnection",  TODO(GYP)
99         "//third_party/webrtc/modules/video_capture",
100       ]
101     }
102     if (!enable_plugins) {
103       sources -= [ "ppapi_unittest.cc" ]
104     }
106     if (use_glib) {
107       configs += [ "//build/config/linux:glib" ]
108     }
110     if (use_aura) {
111       deps += [
112         "//ui/aura:test_support",
113         "//ui/resources:ui_test_pak",
114         "//ui/wm",
115       ]
116     }
118     if (use_aura || is_mac) {
119       deps += [ "//ui/compositor" ]
120     }
122     if (use_ozone) {
123       deps += [ "//ui/ozone" ]
124     }
126     if (is_win) {
127       deps += [ "//third_party/iaccessible2" ]
128     }
130     if (!is_android && !is_ios) {
131       sources += [
132         "../browser/compositor/test/no_transport_image_transport_factory.cc",
133         "../browser/compositor/test/no_transport_image_transport_factory.h",
134       ]
135       deps += [
136         "//ui/compositor",
137         "//third_party/libvpx",
138       ]
139     }
141     if (is_android) {
142       deps += [
143         "//ui/android",
144         "//ui/shell_dialogs",
145       ]
146     }
148     if (is_win) {
149       deps += [ "//sandbox" ]
150     }
151   } else {  # is_ios
152     sources = [
153       "public/test/content_test_suite_base.cc",
154       "public/test/mock_notification_observer.cc",
155       "public/test/mock_resource_context.cc",
156       "public/test/test_browser_thread.cc",
157       "public/test/test_content_client_initializer.cc",
158       "public/test/test_notification_tracker.cc",
159       "public/test/test_utils.cc",
160       "public/test/unittest_test_suite.cc",
161       "test/content_test_suite.cc",
162       "test/test_content_browser_client.cc",
163       "test/test_content_client.cc",
164     ]
165   }
166   if (v8_use_external_startup_data) {
167     deps += [ "//gin:gin" ]
168   }
171 source_set("browsertest_support") {
172   testonly = true
174   sources = [
175     "../public/test/content_browser_test.cc",
176     "../public/test/content_browser_test.h",
177     "../public/test/content_browser_test_utils.cc",
178     "../public/test/content_browser_test_utils.h",
179     "../public/test/content_browser_test_utils_mac.mm",
180     "content_test_launcher.cc",
181   ]
183   deps = [
184     "//content/shell:content_shell_lib",
185     "//skia",
186     "//testing/gtest",
187     "//ui/accessibility:ax_gen",
188   ]
190   if (is_android) {
191     deps += [ "//content/public/app:both" ]
192   } else {
193     deps += [ "//content/public/browser" ]
194   }
197 mojom("web_ui_test_mojo_bindings") {
198   sources = [
199     "data/web_ui_test_mojo_bindings.mojom",
200   ]
203 if (!is_ios) {
204   # GYP version //content/content_tests.gypi:layouttest_support_content
205   static_library("layouttest_support") {
206     testonly = true
207     sources = rebase_path(
208             content_tests_gypi_values.layouttest_support_content_sources,
209             ".",
210             "//content")
212     deps = [
213       ":test_support",
214       "//cc",
215       "//cc/blink",
216       "//content/public/common",
217       "//skia",
218       "//v8",
219       "//ui/accessibility:ax_gen",
220     ]
222     if (is_android) {
223       deps += [ ":jni" ]
224     }
226     if (!enable_webrtc) {
227       sources -= [
228         "test_media_stream_renderer_factory.cc",
229         "test_media_stream_renderer_factory.h",
230       ]
231     }
232   }
234   if (is_android) {
235     import("//build/config/android/rules.gni")
237     generate_jni("jni") {
238       sources = [
239         "../public/test/android/javatests/src/org/chromium/content/browser/test/NestedSystemMessageHandler.java",
240       ]
241       jni_package = "content/public/test"
242     }
243   }
244 }  # !is_ios
246 # TODO(GYP) enable content_browsertests on Mac when it links.
247 if (!is_mac) {
248   test("content_browsertests") {
249     sources =
250         rebase_path(content_tests_gypi_values.content_browsertests_sources,
251                     ".",
252                     "//content")
254     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
256     deps = [
257       ":browsertest_support",
258       ":web_ui_test_mojo_bindings",
259       "//base/allocator",
260       "//base/test:test_support",
261       "//content/common:mojo_bindings",
262       "//content/gpu",
263       "//content/public/common",
264       "//content/public/plugin",
265       "//content/public/renderer",
266       "//content:resources",
267       "//content/shell:content_shell_lib",
268       "//content/shell:pak",
269       "//content/test:test_support",
270       "//device/battery",
271       "//device/battery:mojo_bindings",
272       "//gin",
273       "//gpu",
274       "//ipc:test_support",
275       "//media:test_support",
276       "//media/audio:test_support",
277       "//media/base:test_support",
278       "//media:shared_memory_support",
279       "//mojo/environment:chromium",
280       "//net:test_support",
281       "//ppapi:ppapi_host",
282       "//ppapi:ppapi_ipc",
283       "//ppapi:ppapi_proxy",
284       "//ppapi:ppapi_shared",
285       "//third_party/mojo/src/mojo/edk/system",
286       "//third_party/mojo/src/mojo/edk/test:test_support",
287       "//third_party/mojo/src/mojo/public/cpp/bindings",
288       "//third_party/mojo/src/mojo/public/js",
290       #"//ppapi:ppapi_tests",  TODO(GYP)
291       #"//ppapi:ppapi_unittest_shared",  TODO(GYP)
292       "//testing/gmock",
293       "//testing/gtest",
294       "//third_party/WebKit/public:blink",
295       "//third_party/leveldatabase",
296       "//third_party/mesa:osmesa",
297       "//ui/accessibility",
298       "//ui/accessibility:ax_gen",
299       "//ui/base",
300       "//ui/gfx",
301       "//ui/gfx/geometry",
302       "//ui/gl",
303       "//ui/resources",
304       "//ui/shell_dialogs",
305       "//ui/snapshot",
306     ]
308     if (!is_chromeos) {
309       sources -=
310           [ "../browser/web_contents/touch_editable_impl_aura_browsertest.cc" ]
311     }
313     if (is_win) {
314       sources += rebase_path(
315               content_tests_gypi_values.content_browsertests_win_sources,
316               ".",
317               "//content")
319       # TODO(GYP) Windows support
320       #       'resource_include_dirs': [
321       #         '<(SHARED_INTERMEDIATE_DIR)/webkit',
322       #       ],
323       #       'sources': [
324       #         'shell/app/resource.h',
325       #         'shell/app/shell.rc',
326       #         # TODO:  It would be nice to have these pulled in
327       #         # automatically from direct_dependent_settings in
328       #         # their various targets (net.gyp:net_resources, etc.),
329       #         # but that causes errors in other targets when
330       #         # resulting .res files get referenced multiple times.
331       #         '<(SHARED_INTERMEDIATE_DIR)/blink/public/resources/blink_resources.rc',
332       #         '<(SHARED_INTERMEDIATE_DIR)/content/app/strings/content_strings_en-US.rc',
333       #         '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc',
334       #       ],
335       deps += [
336         "//content/app/strings",
337         "//net:net_resources",
338         "//third_party/WebKit/public:resources",
339         "//third_party/iaccessible2",
340         "//third_party/isimpledom",
341       ]
343       # TODO(GYP) Windows
344       #         'Debug_Base': {
345       #           'msvs_settings': {
346       #             'VCLinkerTool': {
347       #               'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
348     }
350     if (is_linux) {
351       sources -=
352           [ "../browser/accessibility/dump_accessibility_tree_browsertest.cc" ]
353     }
355     if (is_android) {
356       sources += rebase_path(
357               content_tests_gypi_values.content_browsertests_android_sources,
358               ".",
359               "//content")
360       sources -=
361           [ "../browser/battery_status/battery_monitor_impl_browsertest.cc" ]
362       deps += [
363         "//content/shell/android:content_shell_jni_headers",
364         "//content/shell:content_shell_lib",
365         "//testing/android:native_test_util",
366       ]
368       use_launcher = false
369     }
371     if (is_mac) {
372       sources += [ "../renderer/external_popup_menu_browsertest.cc" ]
373       deps += [
374         # Needed for Content Shell.app's Helper.
375         #"//content/shell:content_shell",  #TODO(GYP) enable for mac
376       ]
377     }
379     if (use_aura && !is_win) {
380       deps += [ "//ui/events:test_support" ]
381     }
383     if (!use_aura && !is_mac) {
384       sources -=
385           [ "../browser/compositor/image_transport_factory_browsertest.cc" ]
386     }
388     if (!is_android && !is_ios && !is_linux) {
389       # Npapi test plugin doesn't build on Android or iOS.
390       #data_deps += [ 'copy_npapi_test_plugin' ]  TODO(GYP)
391     }
393     if (enable_webrtc) {
394       sources += rebase_path(
395               content_tests_gypi_values.content_browsertests_webrtc_sources,
396               ".",
397               "//content")
398       deps += [ "//testing/perf" ]
399     }
401     if (enable_plugins) {
402       sources += rebase_path(
403               content_tests_gypi_values.content_browsertests_plugins_sources,
404               ".",
405               "//content")
406       #deps += [ "//ppapi:ppapi_tests" ]  # TODO(GYP)
407     }
409     if (enable_web_speech) {
410       sources += rebase_path(
411               content_tests_gypi_values.content_browsertests_speech_sources,
412               ".",
413               "//content")
414     }
416     if (!is_chrome_branded) {
417       sources += rebase_path(
418               content_tests_gypi_values.content_browsertests_unofficial_build_sources,
419               ".",
420               "//content")
421     }
423     if (!use_aura) {
424       sources -=
425           [ "../browser/web_contents/web_contents_view_aura_browsertest.cc" ]
426     }
427   }
430 if (!is_mac) {  # TODO(GYP) enable on Mac once it links.
431   test("content_unittests") {
432     sources = rebase_path(content_tests_gypi_values.content_unittests_sources,
433                           ".",
434                           "//content")
435     deps = [
436       ":test_support",
437       "//base/allocator",
438       "//base/test:test_support",
439       "//content/browser/service_worker:proto",
440       "//content/browser/speech/proto",
441       "//content/public/browser",
442       "//content/public/common",
443       "//content/public/common:mojo_bindings",
444       "//crypto",
445       "//device/battery",
446       "//device/battery:mojo_bindings",
447       "//mojo/environment:chromium",
448       "//net:test_support",
449       "//skia",
450       "//sql",
451       "//sql:test_support",
452       "//testing/gmock",
453       "//testing/gtest",
454       "//third_party/mojo/src/mojo/edk/test:test_support",
455       "//third_party/mojo/src/mojo/public/cpp/bindings",
456       "//third_party/re2",
457       "//ui/accessibility",
458       "//ui/base",
459       "//ui/base",
460       "//ui/gfx",
461       "//ui/gfx/geometry",
462       "//ui/gfx/ipc",
463     ]
465     if (!is_ios) {
466       deps += [
467         "//base/third_party/dynamic_annotations",
468         "//cc",
469         "//cc:test_support",
470         "//cc/surfaces",
471         "//content:resources",
472         "//content/gpu",
473         "//content/public/browser",
474         "//content/public/child",
475         "//content/public/plugin",
476         "//content/public/renderer",
477         "//gin",
478         "//gpu",
479         "//gpu:test_support",
480         "//ipc:test_support",
481         "//media:test_support",
482         "//media:shared_memory_support",
483         "//media/audio:test_support",
484         "//media/base:test_support",
485         "//storage/browser",
486         "//storage/common",
487         "//third_party/WebKit/public:blink",
488         "//third_party/icu",
489         "//third_party/leveldatabase",
490         "//third_party/libjingle",
491         "//ui/gl",
492       ]
493     }
495     if (!is_win) {
496       sources += [ "../browser/file_descriptor_info_impl_unittest.cc" ]
497     }
499     if (enable_plugins) {
500       sources += rebase_path(
501               content_tests_gypi_values.content_unittests_plugins_sources,
502               ".",
503               "//content")
504     }
506     if (enable_webrtc) {
507       sources += rebase_path(
508               content_tests_gypi_values.content_unittests_webrtc_sources,
509               ".",
510               "//content")
511       deps += [
512         "//third_party/libjingle:libjingle_webrtc",
513         "//third_party/libjingle:libpeerconnection",
514         "//third_party/webrtc/modules/video_capture",
515       ]
517       if (is_linux || is_mac || is_win) {
518         sources +=
519             [ "../browser/media/capture/desktop_capture_device_unittest.cc" ]
520         deps += [ "//third_party/webrtc/modules/desktop_capture" ]
521       }
523       if (is_chromeos) {
524         sources +=
525             [ "browser/media/capture/desktop_capture_device_aura_unittest.cc" ]
526       }
527     } else {
528       if (enable_plugins) {
529         # This file is added only when plugins are enabled, but we don't want it
530         # unless webrtc is also enabled.
531         sources -=
532             [ "../renderer/media/webrtc/video_destination_handler_unittest.cc" ]
533       }
534     }
536     if (enable_web_speech) {
537       sources += rebase_path(
538               content_tests_gypi_values.content_unittests_speech_sources,
539               ".",
540               "//content")
541     }
543     if (is_linux) {
544       deps += [ "//dbus:test_support" ]
545       if (!use_dbus) {
546         sources -=
547             [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
548       }
549     }
550     if (is_win) {
551       deps += [ "//third_party/iaccessible2" ]
552     }
553     if (is_mac) {
554       # These flags are needed to run the test on Mac.
555       # Search for comments about "xcode_settings" in chrome_tests.gypi.
556       ldflags = [ "-Wl,-ObjC" ]
557     }
558     if (is_chromeos) {
559       sources -=
560           [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
561       deps += [ "//chromeos" ]
562     }
563     if (is_android) {
564       sources += rebase_path(
565               content_tests_gypi_values.content_unittests_android_sources,
566               ".",
567               "//content")
568       sources -= [
569         "../browser/geolocation/network_location_provider_unittest.cc",
570         "../browser/geolocation/wifi_data_provider_common_unittest.cc",
571         "../browser/webui/url_data_manager_backend_unittest.cc",
572       ]
573       deps += [ "//testing/android:native_test_native_code" ]
574     }
575     if (!is_android && !is_ios) {
576       deps += [ "//third_party/libvpx" ]
577     }
579     if (use_aura) {
580       deps += [
581         "//ui/aura",
582         "//ui/wm",
583       ]
584     } else {
585       sources -= [
586         "../browser/renderer_host/render_widget_host_view_aura_unittest.cc",
587         "../browser/renderer_host/web_input_event_aura_unittest.cc",
588         "../browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc",
589         "../browser/web_contents/aura/window_slider_unittest.cc",
590       ]
591     }
592     if (use_aura || toolkit_views) {
593       deps += [ "//ui/events:test_support" ]
594     }
595     if (!use_aura && !is_mac) {
596       sources -= [
597         "../browser/compositor/buffer_queue_unittest.cc",
598         "../browser/compositor/software_browser_compositor_output_surface_unittest.cc",
599       ]
600     }
602     if (!is_win && !is_mac) {
603       sources -= [ "../common/plugin_list_unittest.cc" ]
604     }
606     if (use_ozone) {
607       deps += [
608         "//ui/ozone",
609         "//ui/ozone:ozone_base",
610       ]
611     } else {
612       sources -=
613           [ "../browser/compositor/software_output_device_ozone_unittest.cc" ]
614     }
616     if (is_mac && use_openssl) {
617       deps += [ "//third_party/boringssl" ]
618     }
619   }
622 if (!is_mac) {  # TODO(GYP) enable on Mac once it links.
623   test("content_perftests") {
624     sources = [
625       "../browser/renderer_host/input/input_router_impl_perftest.cc",
626       "../common/cc_messages_perftest.cc",
627       "../test/run_all_perftests.cc",
628     ]
629     deps = [
630       "//base/allocator",
631       "//base/test:test_support",
632       "//content/public/browser",
633       "//content/public/common",
634       "//content/test:test_support",
635       "//cc",
636       "//skia",
637       "//testing/gtest",
638       "//testing/perf",
639       "//ui/gfx",
640       "//ui/gfx/geometry",
641     ]
643     if (is_android) {
644       deps += [ "//testing/android:native_test_native_code" ]
645     }
646   }
648   test("content_gl_tests") {
649     sources = [
650       "../common/gpu/client/gl_helper_unittest.cc",
651       "../common/gpu/client/gpu_in_process_context_tests.cc",
652     ]
654     deps = [
655       ":test_support",
656       "//base/allocator",
657       "//base/test:test_support",
658       "//content/public/common",
659       "//gpu/command_buffer/common",
660       "//testing/gtest",
661       "//third_party/WebKit/public:blink",
662       "//ui/base",
663       "//ui/gfx",
664       "//ui/gfx:test_support",
665       "//ui/gfx/geometry",
666       "//ui/gl",
667       "//v8",
668     ]
670     if (is_android) {
671       deps += [ "//testing/android:native_test_native_code" ]
672     } else {
673       data_deps = [
674         "//third_party/ffmpeg",
675         "//third_party/mesa:osmesa",
676       ]
677     }
678   }
680   test("content_gl_benchmark") {
681     sources = [
682       "../common/gpu/client/gl_helper_benchmark.cc",
683     ]
685     deps = [
686       ":test_support",
687       "//base/allocator",
688       "//base/test:test_support",
689       "//content/public/common",
690       "//testing/gtest",
691       "//third_party/WebKit/public:blink",
692       "//ui/base",
693       "//ui/gfx",
694       "//ui/gfx/geometry",
695       "//ui/gl",
696     ]
697   }