Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / base / test / BUILD.gn
blob75a77d22f7753be107f1b93d769306e6061b7435
1 # Copyright (c) 2013 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/ui.gni")
7 if (is_android) {
8   import("//build/config/android/rules.gni")
11 source_set("test_config") {
12   # TODO http://crbug.com/412064 enable this flag all the time.
13   testonly = !is_component_build
14   sources = [
15     "test_switches.cc",
16     "test_switches.h",
17     "test_timeouts.cc",
18     "test_timeouts.h",
19   ]
20   deps = [
21     "//base",
22   ]
25 # GYP: //base/base.gyp:test_support_base
26 source_set("test_support") {
27   # TODO http://crbug.com/412064 enable this flag all the time.
28   testonly = !is_component_build
29   sources = [
30     "gtest_util.cc",
31     "gtest_util.h",
32     "gtest_xml_unittest_result_printer.cc",
33     "gtest_xml_unittest_result_printer.h",
34     "gtest_xml_util.cc",
35     "gtest_xml_util.h",
36     "histogram_tester.cc",
37     "histogram_tester.h",
38     "ios/wait_util.h",
39     "ios/wait_util.mm",
40     "launcher/test_result.cc",
41     "launcher/test_result.h",
42     "launcher/test_results_tracker.h",
43     "launcher/unit_test_launcher.h",
44     "mock_chrome_application_mac.h",
45     "mock_chrome_application_mac.mm",
46     "mock_devices_changed_observer.cc",
47     "mock_devices_changed_observer.h",
48     "mock_entropy_provider.cc",
49     "mock_entropy_provider.h",
50     "mock_log.cc",
51     "mock_log.h",
52     "multiprocess_test.h",
53     "null_task_runner.cc",
54     "null_task_runner.h",
55     "opaque_ref_counted.cc",
56     "opaque_ref_counted.h",
57     "perf_log.cc",
58     "perf_log.h",
59     "perf_test_suite.cc",
60     "perf_test_suite.h",
61     "perf_time_logger.cc",
62     "perf_time_logger.h",
63     "power_monitor_test_base.cc",
64     "power_monitor_test_base.h",
65     "scoped_locale.cc",
66     "scoped_locale.h",
67     "scoped_path_override.cc",
68     "scoped_path_override.h",
69     "sequenced_task_runner_test_template.cc",
70     "sequenced_task_runner_test_template.h",
71     "sequenced_worker_pool_owner.cc",
72     "sequenced_worker_pool_owner.h",
73     "simple_test_clock.cc",
74     "simple_test_clock.h",
75     "simple_test_tick_clock.cc",
76     "simple_test_tick_clock.h",
77     "task_runner_test_template.cc",
78     "task_runner_test_template.h",
79     "test_discardable_memory_allocator.cc",
80     "test_discardable_memory_allocator.h",
81     "test_file_util.cc",
82     "test_file_util.h",
83     "test_file_util_android.cc",
84     "test_file_util_linux.cc",
85     "test_file_util_mac.cc",
86     "test_file_util_posix.cc",
87     "test_file_util_win.cc",
88     "test_io_thread.cc",
89     "test_io_thread.h",
90     "test_listener_ios.h",
91     "test_listener_ios.mm",
92     "test_mock_time_task_runner.cc",
93     "test_mock_time_task_runner.h",
94     "test_pending_task.cc",
95     "test_pending_task.h",
96     "test_reg_util_win.cc",
97     "test_reg_util_win.h",
98     "test_shortcut_win.cc",
99     "test_shortcut_win.h",
100     "test_simple_task_runner.cc",
101     "test_simple_task_runner.h",
102     "test_suite.cc",
103     "test_suite.h",
104     "test_support_android.cc",
105     "test_support_android.h",
106     "test_support_ios.h",
107     "test_support_ios.mm",
108     "test_ui_thread_android.cc",
109     "test_ui_thread_android.h",
110     "thread_test_helper.cc",
111     "thread_test_helper.h",
112     "trace_event_analyzer.cc",
113     "trace_event_analyzer.h",
114     "trace_to_file.cc",
115     "trace_to_file.h",
116     "user_action_tester.cc",
117     "user_action_tester.h",
118     "values_test_util.cc",
119     "values_test_util.h",
120   ]
122   if (is_ios) {
123     sources += [ "launcher/unit_test_launcher_ios.cc" ]
124   } else {
125     sources += [
126       "launcher/test_launcher.cc",
127       "launcher/test_launcher.h",
128       "launcher/test_results_tracker.cc",
129       "launcher/unit_test_launcher.cc",
130       "multiprocess_test.cc",
131       "multiprocess_test_android.cc",
132     ]
133   }
135   configs += [ "//build/config:precompiled_headers" ]
137   data = [
138     # The isolate needs this script for setting up the test. It's not actually
139     # needed to run this target locally.
140     "//testing/test_env.py",
141   ]
143   public_deps = [
144     ":test_config",
145     "//base",
146     "//base:i18n",
147     "//base:base_static",
148   ]
149   deps = [
150     "//base/third_party/dynamic_annotations",
151     "//testing/gmock",
152     "//testing/gtest",
153     "//third_party/libxml",
154     "//third_party/icu:icuuc",
155   ]
157   if (!is_posix) {
158     sources -= [
159       "scoped_locale.cc",
160       "scoped_locale.h",
161     ]
162   }
164   if (is_ios) {
165     set_sources_assignment_filter([])
166     sources += [ "test_file_util_mac.cc" ]
167     set_sources_assignment_filter(sources_assignment_filter)
168   }
170   if (is_android) {
171     deps += [ ":base_unittests_jni_headers" ]
172   }
175 config("perf_test_config") {
176   defines = [ "PERF_TEST" ]
179 source_set("test_support_perf") {
180   testonly = true
181   sources = [
182     "run_all_perftests.cc",
183   ]
184   deps = [
185     ":test_support",
186     "//base",
187     "//testing/gtest",
188   ]
190   public_configs = [ ":perf_test_config" ]
193 source_set("run_all_unittests") {
194   testonly = true
195   sources = [
196     "run_all_unittests.cc",
197   ]
198   deps = [
199     ":test_support",
200   ]
203 if (is_linux) {
204   shared_library("malloc_wrapper") {
205     testonly = true
206     sources = [
207       "malloc_wrapper.cc",
208     ]
209     deps = [
210       "//base",
211       "//build/config/sanitizers:deps",
212     ]
213   }
216 if (is_android) {
217   generate_jni("base_unittests_jni_headers") {
218     sources = [
219       "android/java/src/org/chromium/base/ContentUriTestUtils.java",
220       "android/java/src/org/chromium/base/TestUiThread.java",
221     ]
222     jni_package = "base"
223   }