ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / content / test / BUILD.gn
blob18048efa95dd03a01dc4fccc918a960cb99a4bc9
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/service_worker:service_worker_proto",
452       "//content/browser/speech/proto",
453       "//content/public/browser",
454       "//content/public/common",
455       "//content/public/common:mojo_bindings",
456       "//crypto",
457       "//device/battery",
458       "//device/battery:mojo_bindings",
459       "//mojo/environment:chromium",
460       "//net:test_support",
461       "//skia",
462       "//sql",
463       "//sql:test_support",
464       "//testing/gmock",
465       "//testing/gtest",
466       "//third_party/mojo/src/mojo/edk/test:test_support",
467       "//third_party/mojo/src/mojo/public/cpp/bindings",
468       "//third_party/re2",
469       "//ui/accessibility",
470       "//ui/base",
471       "//ui/base",
472       "//ui/gfx",
473       "//ui/gfx/geometry",
474       "//ui/gfx/ipc",
475     ]
477     if (!is_ios) {
478       deps += [
479         "//base/third_party/dynamic_annotations",
480         "//cc",
481         "//cc:test_support",
482         "//cc/surfaces",
483         "//content:resources",
484         "//content/gpu",
485         "//content/public/browser",
486         "//content/public/child",
487         "//content/public/plugin",
488         "//content/public/renderer",
489         "//gin",
490         "//gpu",
491         "//gpu:test_support",
492         "//ipc:test_support",
493         "//media:test_support",
494         "//media:shared_memory_support",
495         "//media/audio:test_support",
496         "//media/base:test_support",
497         "//storage/browser",
498         "//storage/common",
499         "//third_party/WebKit/public:blink",
500         "//third_party/icu",
501         "//third_party/leveldatabase",
502         "//third_party/libjingle",
503         "//ui/gl",
504       ]
505     }
507     if (!is_win) {
508       sources += [ "../browser/file_descriptor_info_impl_unittest.cc" ]
509     }
511     if (enable_plugins) {
512       sources += rebase_path(
513               content_tests_gypi_values.content_unittests_plugins_sources,
514               ".",
515               "//content")
516     }
518     if (enable_webrtc) {
519       sources += rebase_path(
520               content_tests_gypi_values.content_unittests_webrtc_sources,
521               ".",
522               "//content")
523       deps += [
524         "//third_party/libjingle:libjingle_webrtc",
525         "//third_party/libjingle:libpeerconnection",
526         "//third_party/webrtc/modules/video_capture",
527       ]
529       if (is_linux || is_mac || is_win) {
530         sources +=
531             [ "../browser/media/capture/desktop_capture_device_unittest.cc" ]
532         deps += [ "//third_party/webrtc/modules/desktop_capture" ]
533       }
535       if (is_chromeos) {
536         sources += [ "../browser/media/capture/desktop_capture_device_aura_unittest.cc" ]
537       }
538     } else {
539       if (enable_plugins) {
540         # This file is added only when plugins are enabled, but we don't want it
541         # unless webrtc is also enabled.
542         sources -=
543             [ "../renderer/media/webrtc/video_destination_handler_unittest.cc" ]
544       }
545     }
547     if (enable_web_speech) {
548       sources += rebase_path(
549               content_tests_gypi_values.content_unittests_speech_sources,
550               ".",
551               "//content")
552     }
554     if (is_linux) {
555       deps += [ "//dbus:test_support" ]
556       if (!use_dbus) {
557         sources -=
558             [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
559       }
560     }
561     if (is_win) {
562       deps += [ "//third_party/iaccessible2" ]
563     }
564     if (is_mac) {
565       # These flags are needed to run the test on Mac.
566       # Search for comments about "xcode_settings" in chrome_tests.gypi.
567       ldflags = [ "-Wl,-ObjC" ]
568     }
569     if (is_chromeos) {
570       sources -=
571           [ "../browser/geolocation/wifi_data_provider_linux_unittest.cc" ]
572       deps += [ "//chromeos" ]
573     }
574     if (is_android) {
575       sources += rebase_path(
576               content_tests_gypi_values.content_unittests_android_sources,
577               ".",
578               "//content")
579       sources -= [
580         "../browser/geolocation/network_location_provider_unittest.cc",
581         "../browser/geolocation/wifi_data_provider_common_unittest.cc",
582         "../browser/webui/url_data_manager_backend_unittest.cc",
583       ]
584       deps += [ "//testing/android:native_test_native_code" ]
585     }
586     if (!is_android && !is_ios) {
587       deps += [ "//third_party/libvpx" ]
588     }
590     if (use_aura) {
591       deps += [
592         "//ui/aura",
593         "//ui/wm",
594       ]
595     } else {
596       sources -= [
597         "../browser/renderer_host/render_widget_host_view_aura_unittest.cc",
598         "../browser/renderer_host/web_input_event_aura_unittest.cc",
599         "../browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc",
600         "../browser/web_contents/aura/window_slider_unittest.cc",
601       ]
602     }
603     if (use_aura || toolkit_views) {
604       deps += [ "//ui/events:test_support" ]
605     }
606     if (!use_aura && !is_mac) {
607       sources -= [
608         "../browser/compositor/buffer_queue_unittest.cc",
609         "../browser/compositor/reflector_impl_unittest.cc",
610         "../browser/compositor/software_browser_compositor_output_surface_unittest.cc",
611       ]
612     }
614     if (!is_win && !is_mac) {
615       sources -= [ "../common/plugin_list_unittest.cc" ]
616     }
618     if (use_ozone) {
619       deps += [
620         "//ui/ozone",
621         "//ui/ozone:ozone_base",
622       ]
623     } else {
624       sources -=
625           [ "../browser/compositor/software_output_device_ozone_unittest.cc" ]
626     }
628     if (is_mac && use_openssl) {
629       deps += [ "//third_party/boringssl" ]
630     }
631   }
634 if (!is_mac) {  # TODO(GYP) enable on Mac once it links.
635   test("content_perftests") {
636     sources = [
637       "../browser/net/sqlite_persistent_cookie_store_perftest.cc",
638       "../browser/renderer_host/input/input_router_impl_perftest.cc",
639       "../common/cc_messages_perftest.cc",
640       "../test/run_all_perftests.cc",
641     ]
642     deps = [
643       "//base/allocator",
644       "//base/test:test_support",
645       "//content/public/browser",
646       "//content/public/common",
647       "//content/test:test_support",
648       "//cc",
649       "//skia",
650       "//testing/gtest",
651       "//testing/perf",
652       "//ui/gfx",
653       "//ui/gfx/geometry",
654     ]
656     if (is_android) {
657       deps += [ "//testing/android:native_test_native_code" ]
658     }
659   }
661   test("content_gl_tests") {
662     sources = [
663       "../common/gpu/client/gl_helper_unittest.cc",
664       "../common/gpu/client/gpu_in_process_context_tests.cc",
665     ]
667     deps = [
668       ":test_support",
669       "//base/allocator",
670       "//base/test:test_support",
671       "//content/public/common",
672       "//gpu/command_buffer/common",
673       "//testing/gtest",
674       "//third_party/WebKit/public:blink",
675       "//ui/base",
676       "//ui/gfx",
677       "//ui/gfx:test_support",
678       "//ui/gfx/geometry",
679       "//ui/gl",
680       "//v8",
681     ]
683     if (is_android) {
684       deps += [ "//testing/android:native_test_native_code" ]
685     } else {
686       data_deps = [
687         "//third_party/ffmpeg",
688         "//third_party/mesa:osmesa",
689       ]
690     }
691   }
693   test("content_gl_benchmark") {
694     sources = [
695       "../common/gpu/client/gl_helper_benchmark.cc",
696     ]
698     deps = [
699       ":test_support",
700       "//base/allocator",
701       "//base/test:test_support",
702       "//content/public/common",
703       "//testing/gtest",
704       "//third_party/WebKit/public:blink",
705       "//ui/base",
706       "//ui/gfx",
707       "//ui/gfx/geometry",
708       "//ui/gl",
709     ]
710   }