[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / test / BUILD.gn
bloba2d7a2332a50a9e9fa4c14f0ed2ce4ffe5a750db
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_new",
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   }
616   if (enable_web_speech) {
617     sources +=
618         rebase_path(content_tests_gypi_values.content_unittests_speech_sources,
619                     ".",
620                     "//content")
621   }
623   if (is_linux) {
624     if (use_dbus) {
625       deps += [ "//dbus:test_support" ]
626     } else {
627       sources -=
628           [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
629     }
630   }
631   if (is_win) {
632     deps += [ "//third_party/iaccessible2" ]
633   }
634   if (is_mac) {
635     # These flags are needed to run the test on Mac.
636     # Search for comments about "xcode_settings" in chrome_tests.gypi.
637     ldflags = [ "-Wl,-ObjC" ]
639     deps += [ "//third_party/ocmock" ]
640   }
641   if (is_chromeos) {
642     sources -= [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
643     deps += [ "//chromeos" ]
644   }
645   if (is_android) {
646     sources +=
647         rebase_path(content_tests_gypi_values.content_unittests_android_sources,
648                     ".",
649                     "//content")
650     sources -= [
651       "../browser/geolocation/network_location_provider_unittest.cc",
652       "../browser/geolocation/wifi_data_provider_common_unittest.cc",
653       "../browser/power_usage_monitor_impl_unittest.cc",
654       "../browser/renderer_host/begin_frame_observer_proxy_unittest.cc",
655       "../browser/webui/url_data_manager_backend_unittest.cc",
656     ]
657     deps -= [ "//device/battery" ]
658     deps += [ "//testing/android/native_test:native_test_native_code" ]
659   }
660   if (!is_android && !is_ios) {
661     deps += [ "//third_party/libvpx_new" ]
662   }
664   if (use_aura) {
665     deps += [
666       "//ui/aura",
667       "//ui/aura_extra",
668       "//ui/wm",
669     ]
670   } else {
671     sources -= [
672       "../browser/renderer_host/render_widget_host_view_aura_unittest.cc",
673       "../browser/renderer_host/web_input_event_aura_unittest.cc",
674       "../browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc",
675       "../browser/web_contents/aura/overscroll_window_animation_unittest.cc",
676       "../browser/web_contents/aura/overscroll_window_delegate_unittest.cc",
677       "../browser/web_contents/web_contents_view_aura_unittest.cc",
678     ]
679   }
680   if (use_aura || toolkit_views) {
681     deps += [ "//ui/events:test_support" ]
682   }
683   if (!use_aura && !is_mac) {
684     sources -= [
685       "../browser/compositor/buffer_queue_unittest.cc",
686       "../browser/compositor/reflector_impl_unittest.cc",
687       "../browser/compositor/software_browser_compositor_output_surface_unittest.cc",
688     ]
689   }
691   if (!is_win && !is_mac) {
692     sources -= [ "../common/plugin_list_unittest.cc" ]
693   }
695   if (use_ozone) {
696     deps += [
697       "//ui/ozone",
698       "//ui/ozone:ozone_base",
699     ]
700   } else {
701     sources -=
702         [ "../browser/compositor/software_output_device_ozone_unittest.cc" ]
703   }
705   if (is_mac && use_openssl) {
706     deps += [ "//third_party/boringssl" ]
707   }
710 if (!is_mac) {  # TODO(GYP) enable on Mac once it links.
711   test("content_perftests") {
712     sources = [
713       "../browser/renderer_host/input/input_router_impl_perftest.cc",
714       "../common/cc_messages_perftest.cc",
715       "../test/run_all_perftests.cc",
716     ]
717     deps = [
718       "//base/allocator",
719       "//base/test:test_support",
720       "//content/public/browser",
721       "//content/public/common",
722       "//content/test:test_support",
723       "//cc",
724       "//skia",
725       "//testing/gtest",
726       "//testing/perf",
727       "//ui/gfx",
728       "//ui/gfx/geometry",
729     ]
731     if (is_android) {
732       deps += [ "//testing/android/native_test:native_test_native_code" ]
733     }
734   }
736   # TODO(GYP): Delete this after we've converted everything to GN.
737   # The _run targets exist only for compatibility w/ GYP.
738   group("content_gl_tests_run") {
739     testonly = true
740     deps = [
741       ":content_gl_tests",
742     ]
743   }
745   test("content_gl_tests") {
746     sources = [
747       "../common/gpu/client/gl_helper_unittest.cc",
748       "../common/gpu/client/gpu_in_process_context_tests.cc",
749     ]
751     deps = [
752       ":test_support",
753       "//base/allocator",
754       "//base/test:test_support",
755       "//content/public/common",
756       "//gpu/blink",
757       "//gpu/command_buffer/common",
758       "//testing/gtest",
759       "//third_party/WebKit/public:blink",
760       "//ui/base",
761       "//ui/gfx",
762       "//ui/gfx:test_support",
763       "//ui/gfx/geometry",
764       "//ui/gl",
765       "//ui/gl:test_support",
766       "//v8",
767     ]
769     if (is_android) {
770       deps += [ "//testing/android/native_test:native_test_native_code" ]
771     } else {
772       data_deps = [
773         "//third_party/ffmpeg",
774         "//third_party/mesa:osmesa",
775       ]
776     }
777   }
779   test("content_gl_benchmark") {
780     sources = [
781       "../common/gpu/client/gl_helper_benchmark.cc",
782     ]
784     deps = [
785       ":test_support",
786       "//base/allocator",
787       "//base/test:test_support",
788       "//content/public/common",
789       "//gpu/blink",
790       "//testing/gtest",
791       "//third_party/WebKit/public:blink",
792       "//ui/base",
793       "//ui/gfx",
794       "//ui/gfx/geometry",
795       "//ui/gl",
796       "//ui/gl:test_support",
797     ]
798   }