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