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