[Smart Lock] Smart Lock branding in save password infobar should available only for...
[chromium-blink-merge.git] / content / test / BUILD.gn
blob1b55eb5d4c777f3f020085a427cf5f2a91ee4ee2
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   public_deps = []
26   deps = [
27     "//cc/blink",
28     "//content/public/app:both",
29     "//content/public/browser",
30     "//content/public/common",
31     "//net:test_support",
32     "//skia",
33     "//storage/common",
34     "//testing/gmock",
35     "//testing/gtest",
36     "//ui/accessibility:ax_gen",
37     "//ui/base",
38     "//ui/base/ime",
39     "//ui/base:test_support",
40     "//ui/events:dom_keycode_converter",
41     "//ui/events:events_base",
42     "//ui/events:test_support",
43     "//ui/events:gesture_detection",
44     "//ui/gfx:test_support",
45     "//ui/gl",
46     "//ui/resources",
47     "//url",
48   ]
50   if (!is_ios) {
51     sources =
52         rebase_path(content_tests_gypi_values.test_support_content_sources,
53                     ".",
54                     "//content")
56     public_deps += [ "//third_party/WebKit/public:blink" ]
57     deps += [
58       "//components/scheduler:scheduler",
59       "//content/browser/speech/proto",
60       "//content/public/child",
61       "//content/gpu",
62       "//content/public/plugin",
63       "//content/public/renderer",
64       "//content/public/utility",
65       "//content/shell:pak",
66       "//cc",
67       "//cc:test_support",
68       "//ipc/mojo",
69       "//media",
70       "//ppapi/host",
71       "//ppapi/proxy",
72       "//ppapi/proxy:test_support",
73       "//ppapi/shared_impl",
74       "//ppapi/shared_impl:test_support",
75       "//storage/browser",
76       "//storage/common",
77       "//ui/surface",
78       "//v8",
79     ]
81     if (enable_plugins) {
82       deps += [ "//content/ppapi_plugin" ]
83     }
85     if (enable_webrtc) {
86       sources += [
87         "../renderer/media/mock_data_channel_impl.cc",
88         "../renderer/media/mock_data_channel_impl.h",
89         "../renderer/media/mock_media_stream_dispatcher.cc",
90         "../renderer/media/mock_media_stream_dispatcher.h",
91         "../renderer/media/mock_peer_connection_impl.cc",
92         "../renderer/media/mock_peer_connection_impl.h",
93         "../renderer/media/mock_web_rtc_peer_connection_handler_client.cc",
94         "../renderer/media/mock_web_rtc_peer_connection_handler_client.h",
95         "../renderer/media/webrtc/mock_peer_connection_dependency_factory.cc",
96         "../renderer/media/webrtc/mock_peer_connection_dependency_factory.h",
97       ]
99       deps += [
100         "//third_party/libjingle:libjingle_webrtc",
101         "//third_party/libjingle:libpeerconnection",
102         "//third_party/webrtc/modules/video_capture",
103       ]
104     }
105     if (!enable_plugins) {
106       sources -= [ "ppapi_unittest.cc" ]
107     }
109     if (use_glib) {
110       configs += [ "//build/config/linux:glib" ]
111     }
113     if (use_aura) {
114       deps += [
115         "//ui/aura:test_support",
116         "//ui/resources:ui_test_pak",
117         "//ui/wm",
118       ]
119     }
121     if (use_aura || is_mac) {
122       deps += [ "//ui/compositor" ]
123     }
125     if (use_ozone) {
126       deps += [ "//ui/ozone" ]
127     }
129     if (is_win) {
130       deps += [
131         "//content:startup_helper_win",
132         "//third_party/iaccessible2",
133       ]
134     }
136     if (!is_android && !is_ios) {
137       sources += [
138         "../browser/compositor/test/no_transport_image_transport_factory.cc",
139         "../browser/compositor/test/no_transport_image_transport_factory.h",
140       ]
141       deps += [
142         "//ui/compositor",
143         "//third_party/libvpx",
144       ]
145     }
147     if (is_android) {
148       deps += [
149         "//ui/android",
150         "//ui/shell_dialogs",
151       ]
152     }
154     if (is_win) {
155       deps += [ "//sandbox" ]
156     }
157   } else {  # is_ios
158     sources = [
159       "public/test/content_test_suite_base.cc",
160       "public/test/mock_notification_observer.cc",
161       "public/test/mock_resource_context.cc",
162       "public/test/test_browser_thread.cc",
163       "public/test/test_content_client_initializer.cc",
164       "public/test/test_notification_tracker.cc",
165       "public/test/test_utils.cc",
166       "public/test/unittest_test_suite.cc",
167       "test/content_test_suite.cc",
168       "test/test_content_browser_client.cc",
169       "test/test_content_client.cc",
170     ]
171   }
172   if (v8_use_external_startup_data) {
173     deps += [ "//gin:gin" ]
174   }
177 source_set("browsertest_support") {
178   testonly = true
180   sources = [
181     "../public/test/content_browser_test.cc",
182     "../public/test/content_browser_test.h",
183     "../public/test/content_browser_test_utils.cc",
184     "../public/test/content_browser_test_utils.h",
185     "../public/test/content_browser_test_utils_mac.mm",
186     "content_test_launcher.cc",
187   ]
189   deps = [
190     "//content/shell:content_shell_lib",
191     "//skia",
192     "//testing/gtest",
193     "//ui/accessibility:ax_gen",
194   ]
196   if (is_android) {
197     deps += [ "//content/public/app:both" ]
198   } else {
199     deps += [ "//content/public/browser" ]
200   }
203 mojom("web_ui_test_mojo_bindings") {
204   sources = [
205     "data/web_ui_test_mojo_bindings.mojom",
206   ]
209 if (!is_ios) {
210   # GYP version //content/content_tests.gypi:layouttest_support_content
211   static_library("layouttest_support") {
212     testonly = true
213     sources = rebase_path(
214             content_tests_gypi_values.layouttest_support_content_sources,
215             ".",
216             "//content")
218     deps = [
219       ":test_support",
220       "//cc",
221       "//cc/blink",
222       "//content/public/common",
223       "//skia",
224       "//v8",
225       "//ui/accessibility:ax_gen",
226     ]
228     if (is_android) {
229       deps += [ ":jni" ]
230     }
232     if (!enable_webrtc) {
233       sources -= [
234         "test_media_stream_renderer_factory.cc",
235         "test_media_stream_renderer_factory.h",
236       ]
237     }
238   }
240   if (is_android) {
241     import("//build/config/android/rules.gni")
243     generate_jni("jni") {
244       sources = [
245         "../public/test/android/javatests/src/org/chromium/content/browser/test/NestedSystemMessageHandler.java",
246       ]
247       jni_package = "content/public/test"
248     }
249   }
250 }  # !is_ios
252 # TODO(GYP) enable content_browsertests on Mac when it links.
253 if (!is_mac) {
254   test("content_browsertests") {
255     sources =
256         rebase_path(content_tests_gypi_values.content_browsertests_sources,
257                     ".",
258                     "//content")
260     defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
262     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
264     deps = [
265       ":browsertest_support",
266       ":web_ui_test_mojo_bindings",
267       "//base/allocator",
268       "//base/test:test_support",
269       "//content/common:mojo_bindings",
270       "//content/gpu",
271       "//content/public/common",
272       "//content/public/plugin",
273       "//content/public/renderer",
274       "//content:resources",
275       "//content/shell:content_shell_lib",
276       "//content/shell:pak",
277       "//content/test:test_support",
278       "//device/battery",
279       "//device/battery:mojo_bindings",
280       "//gin",
281       "//gpu",
282       "//ipc:test_support",
283       "//media:test_support",
284       "//media/audio:test_support",
285       "//media/base:test_support",
286       "//media:shared_memory_support",
287       "//mojo/environment:chromium",
288       "//net:test_support",
289       "//ppapi/host",
290       "//ppapi/proxy",
291       "//ppapi/proxy:ipc",
292       "//ppapi/shared_impl",
293       "//third_party/mojo/src/mojo/edk/system",
294       "//third_party/mojo/src/mojo/edk/test:test_support",
295       "//third_party/mojo/src/mojo/public/cpp/bindings",
296       "//third_party/mojo/src/mojo/public/js",
297       "//testing/gmock",
298       "//testing/gtest",
299       "//third_party/WebKit/public:blink",
300       "//third_party/leveldatabase",
301       "//third_party/mesa:osmesa",
302       "//ui/accessibility",
303       "//ui/accessibility:ax_gen",
304       "//ui/base",
305       "//ui/base/ime",
306       "//ui/gfx",
307       "//ui/gfx/geometry",
308       "//ui/gl",
309       "//ui/resources",
310       "//ui/shell_dialogs",
311       "//ui/snapshot",
312     ]
314     data_deps = [ "//ppapi:ppapi_tests" ]  # Loaded at runtime.
316     if (!is_chromeos) {
317       sources -=
318           [ "../browser/web_contents/touch_editable_impl_aura_browsertest.cc" ]
319     }
321     if (is_win) {
322       sources += rebase_path(
323               content_tests_gypi_values.content_browsertests_win_sources,
324               ".",
325               "//content")
327       deps += [
328         "//content/app/strings",
329         "//net:net_resources",
330         "//third_party/WebKit/public:resources",
331         "//third_party/iaccessible2",
332         "//third_party/isimpledom",
333       ]
335       libs = [ "oleacc.lib" ]
336     }
338     if (is_linux) {
339       sources -=
340           [ "../browser/accessibility/dump_accessibility_tree_browsertest.cc" ]
341     }
343     if (is_android) {
344       sources += rebase_path(
345               content_tests_gypi_values.content_browsertests_android_sources,
346               ".",
347               "//content")
348       sources -=
349           [ "../browser/battery_status/battery_monitor_impl_browsertest.cc" ]
350       deps += [
351         "//content/shell/android:content_shell_jni_headers",
352         "//content/shell:content_shell_lib",
353         "//testing/android/native_test:native_test_util",
354       ]
356       use_launcher = false
357     }
359     if (is_mac) {
360       sources += [ "../renderer/external_popup_menu_browsertest.cc" ]
361       deps += [
362         # Needed for Content Shell.app's Helper.
363         #"//content/shell:content_shell",  #TODO(GYP) enable for mac
364       ]
365     }
367     if (use_aura && !is_win) {
368       deps += [ "//ui/events:test_support" ]
369     }
371     if (!use_aura && !is_mac) {
372       sources -=
373           [ "../browser/compositor/image_transport_factory_browsertest.cc" ]
374     }
376     if (use_aura && !is_win) {
377       sources -= [ "../browser/plugin_browsertest.cc" ]
378     }
380     if (!is_android && !is_ios && !is_linux) {
381       # Npapi test plugin doesn't build on Android or iOS.
382       #data_deps += [ 'copy_npapi_test_plugin' ]  TODO(GYP)
383     }
385     if (enable_webrtc) {
386       sources += rebase_path(
387               content_tests_gypi_values.content_browsertests_webrtc_sources,
388               ".",
389               "//content")
390       deps += [ "//testing/perf" ]
391     }
393     if (enable_plugins) {
394       sources += rebase_path(
395               content_tests_gypi_values.content_browsertests_plugins_sources,
396               ".",
397               "//content")
398       data_deps += [ "//ppapi:ppapi_tests" ]
399     }
401     if (enable_web_speech) {
402       sources += rebase_path(
403               content_tests_gypi_values.content_browsertests_speech_sources,
404               ".",
405               "//content")
406     }
408     if (!is_chrome_branded) {
409       sources += rebase_path(
410               content_tests_gypi_values.content_browsertests_unofficial_build_sources,
411               ".",
412               "//content")
413     }
415     if (!use_aura) {
416       sources -=
417           [ "../browser/web_contents/web_contents_view_aura_browsertest.cc" ]
418     }
419   }
422 test("content_unittests") {
423   sources = rebase_path(content_tests_gypi_values.content_unittests_sources,
424                         ".",
425                         "//content")
426   deps = [
427     ":test_support",
428     "//base/allocator",
429     "//base/test:test_support",
430     "//content/browser/background_sync:background_sync_proto",
431     "//content/browser/notifications:notification_proto",
432     "//content/browser/service_worker:service_worker_proto",
433     "//content/browser/speech/proto",
434     "//content/common:mojo_bindings",
435     "//content/public/browser",
436     "//content/public/common",
437     "//content/public/common:mojo_bindings",
438     "//crypto",
439     "//device/battery",
440     "//device/battery:mojo_bindings",
441     "//mojo/environment:chromium",
442     "//net:test_support",
443     "//skia",
444     "//sql",
445     "//sql:test_support",
446     "//testing/gmock",
447     "//testing/gtest",
448     "//third_party/mojo/src/mojo/edk/test:test_support",
449     "//third_party/mojo/src/mojo/public/cpp/bindings",
450     "//third_party/re2",
451     "//ui/accessibility",
452     "//ui/base",
453     "//ui/events/blink",
454     "//ui/gfx",
455     "//ui/gfx/geometry",
456     "//ui/gfx/ipc",
457   ]
459   if (!is_ios) {
460     deps += [
461       "//base/third_party/dynamic_annotations",
462       "//cc",
463       "//cc:test_support",
464       "//cc/surfaces",
465       "//content:resources",
466       "//content/gpu",
467       "//content/public/browser",
468       "//content/public/child",
469       "//content/public/plugin",
470       "//content/public/renderer",
471       "//gin",
472       "//gpu",
473       "//gpu:test_support",
474       "//ipc:test_support",
475       "//media:test_support",
476       "//media:shared_memory_support",
477       "//media/audio:test_support",
478       "//media/base:test_support",
479       "//media/midi:midi",
480       "//storage/browser",
481       "//storage/common",
482       "//third_party/WebKit/public:blink",
483       "//third_party/icu",
484       "//third_party/leveldatabase",
485       "//third_party/libjingle",
486       "//ui/gl",
487     ]
488   }
490   if (!is_win) {
491     sources += [ "../browser/file_descriptor_info_impl_unittest.cc" ]
492   }
494   if (enable_plugins) {
495     sources +=
496         rebase_path(content_tests_gypi_values.content_unittests_plugins_sources,
497                     ".",
498                     "//content")
499   }
501   if (enable_webrtc) {
502     sources +=
503         rebase_path(content_tests_gypi_values.content_unittests_webrtc_sources,
504                     ".",
505                     "//content")
506     deps += [
507       "//third_party/libjingle:libjingle_webrtc",
508       "//third_party/libjingle:libpeerconnection",
509       "//third_party/webrtc/modules/video_capture",
510     ]
512     if (is_linux || is_mac || is_win) {
513       sources +=
514           [ "../browser/media/capture/desktop_capture_device_unittest.cc" ]
515       deps += [ "//third_party/webrtc/modules/desktop_capture" ]
516     }
518     if (is_chromeos) {
519       sources +=
520           [ "../browser/media/capture/desktop_capture_device_aura_unittest.cc" ]
521     }
522   } else {
523     if (enable_plugins) {
524       # This file is added only when plugins are enabled, but we don't want it
525       # unless webrtc is also enabled.
526       sources -=
527           [ "../renderer/media/webrtc/video_destination_handler_unittest.cc" ]
528     }
529   }
531   if (enable_web_speech) {
532     sources +=
533         rebase_path(content_tests_gypi_values.content_unittests_speech_sources,
534                     ".",
535                     "//content")
536   }
538   if (is_linux) {
539     if (use_dbus) {
540       deps += [ "//dbus:test_support" ]
541     } else {
542       sources -=
543           [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
544     }
545   }
546   if (is_win) {
547     deps += [ "//third_party/iaccessible2" ]
548   }
549   if (is_mac) {
550     # These flags are needed to run the test on Mac.
551     # Search for comments about "xcode_settings" in chrome_tests.gypi.
552     ldflags = [ "-Wl,-ObjC" ]
554     deps += [ "//third_party/ocmock" ]
555   }
556   if (is_chromeos) {
557     sources -= [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
558     deps += [ "//chromeos" ]
559   }
560   if (is_android) {
561     sources +=
562         rebase_path(content_tests_gypi_values.content_unittests_android_sources,
563                     ".",
564                     "//content")
565     sources -= [
566       "../browser/geolocation/network_location_provider_unittest.cc",
567       "../browser/geolocation/wifi_data_provider_common_unittest.cc",
568       "../browser/renderer_host/begin_frame_observer_proxy_unittest.cc",
569       "../browser/webui/url_data_manager_backend_unittest.cc",
570     ]
571     deps += [ "//testing/android/native_test:native_test_native_code" ]
572   }
573   if (!is_android && !is_ios) {
574     deps += [ "//third_party/libvpx" ]
575   }
577   if (use_aura) {
578     deps += [
579       "//ui/aura",
580       "//ui/aura_extra",
581       "//ui/wm",
582     ]
583   } else {
584     sources -= [
585       "../browser/renderer_host/render_widget_host_view_aura_unittest.cc",
586       "../browser/renderer_host/web_input_event_aura_unittest.cc",
587       "../browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc",
588       "../browser/web_contents/aura/overscroll_window_animation_unittest.cc",
589       "../browser/web_contents/aura/overscroll_window_delegate_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/reflector_impl_unittest.cc",
599       "../browser/compositor/software_browser_compositor_output_surface_unittest.cc",
600     ]
601   }
603   if (!is_win && !is_mac) {
604     sources -= [ "../common/plugin_list_unittest.cc" ]
605   }
607   if (use_ozone) {
608     deps += [
609       "//ui/ozone",
610       "//ui/ozone:ozone_base",
611     ]
612   } else {
613     sources -=
614         [ "../browser/compositor/software_output_device_ozone_unittest.cc" ]
615   }
617   if (is_mac && use_openssl) {
618     deps += [ "//third_party/boringssl" ]
619   }
622 if (!is_mac) {  # TODO(GYP) enable on Mac once it links.
623   test("content_perftests") {
624     sources = [
625       "../browser/net/sqlite_persistent_cookie_store_perftest.cc",
626       "../browser/renderer_host/input/input_router_impl_perftest.cc",
627       "../common/cc_messages_perftest.cc",
628       "../test/run_all_perftests.cc",
629     ]
630     deps = [
631       "//base/allocator",
632       "//base/test:test_support",
633       "//content/public/browser",
634       "//content/public/common",
635       "//content/test:test_support",
636       "//cc",
637       "//skia",
638       "//testing/gtest",
639       "//testing/perf",
640       "//ui/gfx",
641       "//ui/gfx/geometry",
642     ]
644     if (is_android) {
645       deps += [ "//testing/android/native_test:native_test_native_code" ]
646     }
647   }
649   test("content_gl_tests") {
650     sources = [
651       "../common/gpu/client/gl_helper_unittest.cc",
652       "../common/gpu/client/gpu_in_process_context_tests.cc",
653     ]
655     deps = [
656       ":test_support",
657       "//base/allocator",
658       "//base/test:test_support",
659       "//content/public/common",
660       "//gpu/blink",
661       "//gpu/command_buffer/common",
662       "//testing/gtest",
663       "//third_party/WebKit/public:blink",
664       "//ui/base",
665       "//ui/gfx",
666       "//ui/gfx:test_support",
667       "//ui/gfx/geometry",
668       "//ui/gl",
669       "//v8",
670     ]
672     if (is_android) {
673       deps += [ "//testing/android/native_test:native_test_native_code" ]
674     } else {
675       data_deps = [
676         "//third_party/ffmpeg",
677         "//third_party/mesa:osmesa",
678       ]
679     }
680   }
682   test("content_gl_benchmark") {
683     sources = [
684       "../common/gpu/client/gl_helper_benchmark.cc",
685     ]
687     deps = [
688       ":test_support",
689       "//base/allocator",
690       "//base/test:test_support",
691       "//content/public/common",
692       "//gpu/blink",
693       "//testing/gtest",
694       "//third_party/WebKit/public:blink",
695       "//ui/base",
696       "//ui/gfx",
697       "//ui/gfx/geometry",
698       "//ui/gl",
699     ]
700   }