Refactors gesture conversion functions to ui/events/blink
[chromium-blink-merge.git] / content / test / BUILD.gn
bloba34cd5c5eeada7c57fba89982d782edc85432f8f
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/host",
69       "//ppapi/proxy",
70       "//ppapi/proxy:test_support",
71       "//ppapi/shared_impl",
72       "//ppapi/shared_impl:test_support",
73       "//storage/browser",
74       "//storage/common",
75       "//ui/surface",
76       "//v8",
77       "//webkit/common/gpu",
78     ]
80     if (enable_plugins) {
81       deps += [ "//content/ppapi_plugin" ]
82     }
84     if (enable_webrtc) {
85       sources += [
86         "../renderer/media/mock_data_channel_impl.cc",
87         "../renderer/media/mock_data_channel_impl.h",
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:libjingle_webrtc",
100         "//third_party/libjingle:libpeerconnection",
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) {
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     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
261     deps = [
262       ":browsertest_support",
263       ":web_ui_test_mojo_bindings",
264       "//base/allocator",
265       "//base/test:test_support",
266       "//content/common:mojo_bindings",
267       "//content/gpu",
268       "//content/public/common",
269       "//content/public/plugin",
270       "//content/public/renderer",
271       "//content:resources",
272       "//content/shell:content_shell_lib",
273       "//content/shell:pak",
274       "//content/test:test_support",
275       "//device/battery",
276       "//device/battery:mojo_bindings",
277       "//gin",
278       "//gpu",
279       "//ipc:test_support",
280       "//media:test_support",
281       "//media/audio:test_support",
282       "//media/base:test_support",
283       "//media:shared_memory_support",
284       "//mojo/environment:chromium",
285       "//net:test_support",
286       "//ppapi/host",
287       "//ppapi/proxy",
288       "//ppapi/proxy:ipc",
289       "//ppapi/shared_impl",
290       "//third_party/mojo/src/mojo/edk/system",
291       "//third_party/mojo/src/mojo/edk/test:test_support",
292       "//third_party/mojo/src/mojo/public/cpp/bindings",
293       "//third_party/mojo/src/mojo/public/js",
295       #"//ppapi:ppapi_tests",  TODO(GYP)
296       #"//ppapi:ppapi_unittest_shared",  TODO(GYP)
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 = []
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       # TODO(GYP) Windows support
328       #       'resource_include_dirs': [
329       #         '<(SHARED_INTERMEDIATE_DIR)/webkit',
330       #       ],
331       #       'sources': [
332       #         'shell/app/resource.h',
333       #         'shell/app/shell.rc',
334       #         # TODO:  It would be nice to have these pulled in
335       #         # automatically from direct_dependent_settings in
336       #         # their various targets (net.gyp:net_resources, etc.),
337       #         # but that causes errors in other targets when
338       #         # resulting .res files get referenced multiple times.
339       #         '<(SHARED_INTERMEDIATE_DIR)/blink/public/resources/blink_resources.rc',
340       #         '<(SHARED_INTERMEDIATE_DIR)/content/app/strings/content_strings_en-US.rc',
341       #         '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc',
342       #       ],
343       deps += [
344         "//content/app/strings",
345         "//net:net_resources",
346         "//third_party/WebKit/public:resources",
347         "//third_party/iaccessible2",
348         "//third_party/isimpledom",
349       ]
351       # TODO(GYP) Windows
352       #         'Debug_Base': {
353       #           'msvs_settings': {
354       #             'VCLinkerTool': {
355       #               'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
356     }
358     if (is_linux) {
359       sources -=
360           [ "../browser/accessibility/dump_accessibility_tree_browsertest.cc" ]
361     }
363     if (is_android) {
364       sources += rebase_path(
365               content_tests_gypi_values.content_browsertests_android_sources,
366               ".",
367               "//content")
368       sources -=
369           [ "../browser/battery_status/battery_monitor_impl_browsertest.cc" ]
370       deps += [
371         "//content/shell/android:content_shell_jni_headers",
372         "//content/shell:content_shell_lib",
373         "//testing/android:native_test_util",
374       ]
376       use_launcher = false
377     }
379     if (is_mac) {
380       sources += [ "../renderer/external_popup_menu_browsertest.cc" ]
381       deps += [
382         # Needed for Content Shell.app's Helper.
383         #"//content/shell:content_shell",  #TODO(GYP) enable for mac
384       ]
385     }
387     if (use_aura && !is_win) {
388       deps += [ "//ui/events:test_support" ]
389     }
391     if (!use_aura && !is_mac) {
392       sources -=
393           [ "../browser/compositor/image_transport_factory_browsertest.cc" ]
394     }
396     if (use_aura && !is_win) {
397       sources -= [ "../browser/plugin_browsertest.cc" ]
398     }
400     if (!is_android && !is_ios && !is_linux) {
401       # Npapi test plugin doesn't build on Android or iOS.
402       #data_deps += [ 'copy_npapi_test_plugin' ]  TODO(GYP)
403     }
405     if (enable_webrtc) {
406       sources += rebase_path(
407               content_tests_gypi_values.content_browsertests_webrtc_sources,
408               ".",
409               "//content")
410       deps += [ "//testing/perf" ]
411     }
413     if (enable_plugins) {
414       sources += rebase_path(
415               content_tests_gypi_values.content_browsertests_plugins_sources,
416               ".",
417               "//content")
418       data_deps += [ "//ppapi:ppapi_tests" ]
419     }
421     if (enable_web_speech) {
422       sources += rebase_path(
423               content_tests_gypi_values.content_browsertests_speech_sources,
424               ".",
425               "//content")
426     }
428     if (!is_chrome_branded) {
429       sources += rebase_path(
430               content_tests_gypi_values.content_browsertests_unofficial_build_sources,
431               ".",
432               "//content")
433     }
435     if (!use_aura) {
436       sources -=
437           [ "../browser/web_contents/web_contents_view_aura_browsertest.cc" ]
438     }
439   }
442 if (!is_mac) {  # TODO(GYP) enable on Mac once it links.
443   test("content_unittests") {
444     sources = rebase_path(content_tests_gypi_values.content_unittests_sources,
445                           ".",
446                           "//content")
447     deps = [
448       ":test_support",
449       "//base/allocator",
450       "//base/test:test_support",
451       "//content/browser/background_sync:background_sync_proto",
452       "//content/browser/notifications:notification_proto",
453       "//content/browser/service_worker:service_worker_proto",
454       "//content/browser/speech/proto",
455       "//content/public/browser",
456       "//content/public/common",
457       "//content/public/common:mojo_bindings",
458       "//crypto",
459       "//device/battery",
460       "//device/battery:mojo_bindings",
461       "//mojo/environment:chromium",
462       "//net:test_support",
463       "//skia",
464       "//sql",
465       "//sql:test_support",
466       "//testing/gmock",
467       "//testing/gtest",
468       "//third_party/mojo/src/mojo/edk/test:test_support",
469       "//third_party/mojo/src/mojo/public/cpp/bindings",
470       "//third_party/re2",
471       "//ui/accessibility",
472       "//ui/base",
473       "//ui/events/blink",
474       "//ui/gfx",
475       "//ui/gfx/geometry",
476       "//ui/gfx/ipc",
477     ]
479     if (!is_ios) {
480       deps += [
481         "//base/third_party/dynamic_annotations",
482         "//cc",
483         "//cc:test_support",
484         "//cc/surfaces",
485         "//content:resources",
486         "//content/gpu",
487         "//content/public/browser",
488         "//content/public/child",
489         "//content/public/plugin",
490         "//content/public/renderer",
491         "//gin",
492         "//gpu",
493         "//gpu:test_support",
494         "//ipc:test_support",
495         "//media:test_support",
496         "//media:shared_memory_support",
497         "//media/audio:test_support",
498         "//media/base:test_support",
499         "//storage/browser",
500         "//storage/common",
501         "//third_party/WebKit/public:blink",
502         "//third_party/icu",
503         "//third_party/leveldatabase",
504         "//third_party/libjingle",
505         "//ui/gl",
506       ]
507     }
509     if (!is_win) {
510       sources += [ "../browser/file_descriptor_info_impl_unittest.cc" ]
511     }
513     if (enable_plugins) {
514       sources += rebase_path(
515               content_tests_gypi_values.content_unittests_plugins_sources,
516               ".",
517               "//content")
518     }
520     if (enable_webrtc) {
521       sources += rebase_path(
522               content_tests_gypi_values.content_unittests_webrtc_sources,
523               ".",
524               "//content")
525       deps += [
526         "//third_party/libjingle:libjingle_webrtc",
527         "//third_party/libjingle:libpeerconnection",
528         "//third_party/webrtc/modules/video_capture",
529       ]
531       if (is_linux || is_mac || is_win) {
532         sources +=
533             [ "../browser/media/capture/desktop_capture_device_unittest.cc" ]
534         deps += [ "//third_party/webrtc/modules/desktop_capture" ]
535       }
537       if (is_chromeos) {
538         sources += [ "../browser/media/capture/desktop_capture_device_aura_unittest.cc" ]
539       }
540     } else {
541       if (enable_plugins) {
542         # This file is added only when plugins are enabled, but we don't want it
543         # unless webrtc is also enabled.
544         sources -=
545             [ "../renderer/media/webrtc/video_destination_handler_unittest.cc" ]
546       }
547     }
549     if (enable_web_speech) {
550       sources += rebase_path(
551               content_tests_gypi_values.content_unittests_speech_sources,
552               ".",
553               "//content")
554     }
556     if (is_linux) {
557       if (use_dbus) {
558         deps += [ "//dbus:test_support" ]
559       } else {
560         sources -=
561             [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
562       }
563     }
564     if (is_win) {
565       deps += [ "//third_party/iaccessible2" ]
566     }
567     if (is_mac) {
568       # These flags are needed to run the test on Mac.
569       # Search for comments about "xcode_settings" in chrome_tests.gypi.
570       ldflags = [ "-Wl,-ObjC" ]
571     }
572     if (is_chromeos) {
573       sources -=
574           [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
575       deps += [ "//chromeos" ]
576     }
577     if (is_android) {
578       sources += rebase_path(
579               content_tests_gypi_values.content_unittests_android_sources,
580               ".",
581               "//content")
582       sources -= [
583         "../browser/geolocation/network_location_provider_unittest.cc",
584         "../browser/geolocation/wifi_data_provider_common_unittest.cc",
585         "../browser/webui/url_data_manager_backend_unittest.cc",
586       ]
587       deps += [ "//testing/android:native_test_native_code" ]
588     }
589     if (!is_android && !is_ios) {
590       deps += [ "//third_party/libvpx" ]
591     }
593     if (use_aura) {
594       deps += [
595         "//ui/aura",
596         "//ui/wm",
597       ]
598     } else {
599       sources -= [
600         "../browser/renderer_host/render_widget_host_view_aura_unittest.cc",
601         "../browser/renderer_host/web_input_event_aura_unittest.cc",
602         "../browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc",
603         "../browser/web_contents/aura/window_slider_unittest.cc",
604       ]
605     }
606     if (use_aura || toolkit_views) {
607       deps += [ "//ui/events:test_support" ]
608     }
609     if (!use_aura && !is_mac) {
610       sources -= [
611         "../browser/compositor/buffer_queue_unittest.cc",
612         "../browser/compositor/reflector_impl_unittest.cc",
613         "../browser/compositor/software_browser_compositor_output_surface_unittest.cc",
614       ]
615     }
617     if (!is_win && !is_mac) {
618       sources -= [ "../common/plugin_list_unittest.cc" ]
619     }
621     if (use_ozone) {
622       deps += [
623         "//ui/ozone",
624         "//ui/ozone:ozone_base",
625       ]
626     } else {
627       sources -=
628           [ "../browser/compositor/software_output_device_ozone_unittest.cc" ]
629     }
631     if (is_mac && use_openssl) {
632       deps += [ "//third_party/boringssl" ]
633     }
634   }
637 if (!is_mac) {  # TODO(GYP) enable on Mac once it links.
638   test("content_perftests") {
639     sources = [
640       "../browser/net/sqlite_persistent_cookie_store_perftest.cc",
641       "../browser/renderer_host/input/input_router_impl_perftest.cc",
642       "../common/cc_messages_perftest.cc",
643       "../test/run_all_perftests.cc",
644     ]
645     deps = [
646       "//base/allocator",
647       "//base/test:test_support",
648       "//content/public/browser",
649       "//content/public/common",
650       "//content/test:test_support",
651       "//cc",
652       "//skia",
653       "//testing/gtest",
654       "//testing/perf",
655       "//ui/gfx",
656       "//ui/gfx/geometry",
657     ]
659     if (is_android) {
660       deps += [ "//testing/android:native_test_native_code" ]
661     }
662   }
664   test("content_gl_tests") {
665     sources = [
666       "../common/gpu/client/gl_helper_unittest.cc",
667       "../common/gpu/client/gpu_in_process_context_tests.cc",
668     ]
670     deps = [
671       ":test_support",
672       "//base/allocator",
673       "//base/test:test_support",
674       "//content/public/common",
675       "//gpu/command_buffer/common",
676       "//testing/gtest",
677       "//third_party/WebKit/public:blink",
678       "//ui/base",
679       "//ui/gfx",
680       "//ui/gfx:test_support",
681       "//ui/gfx/geometry",
682       "//ui/gl",
683       "//v8",
684     ]
686     if (is_android) {
687       deps += [ "//testing/android:native_test_native_code" ]
688     } else {
689       data_deps = [
690         "//third_party/ffmpeg",
691         "//third_party/mesa:osmesa",
692       ]
693     }
694   }
696   test("content_gl_benchmark") {
697     sources = [
698       "../common/gpu/client/gl_helper_benchmark.cc",
699     ]
701     deps = [
702       ":test_support",
703       "//base/allocator",
704       "//base/test:test_support",
705       "//content/public/common",
706       "//testing/gtest",
707       "//third_party/WebKit/public:blink",
708       "//ui/base",
709       "//ui/gfx",
710       "//ui/gfx/geometry",
711       "//ui/gl",
712     ]
713   }