blob: 43030f0478fb4a7b94719a176f63f70eb6893060 [file] [log] [blame]
prashantv4025129e2015-04-21 21:54:221# Copyright 2015 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.
4
slan7d09f9e2016-04-08 15:47:025import("//build/buildflag_header.gni")
slanca520532015-11-05 20:35:336import("//build/config/features.gni")
7import("//build/config/locales.gni")
mbjorge47b1c9b2016-09-20 22:23:038import("//build/config/sanitizers/sanitizers.gni")
slanca520532015-11-05 20:35:339import("//build/config/ui.gni")
slan87db9d12015-10-05 20:37:3810import("//chromecast/build/tests/cast_test.gni")
prashantv4025129e2015-04-21 21:54:2211import("//chromecast/chromecast.gni")
slan25bb71f22016-01-06 21:23:5512import("//media/media_options.gni")
slan0c9838b2015-08-05 18:37:4013import("//tools/grit/repack.gni")
14import("//ui/ozone/ozone.gni")
machenbachd65ec5c2016-07-22 09:05:2315import("//v8/gni/v8.gni")
prashantv4025129e2015-04-21 21:54:2216
slan074ec342016-01-29 23:52:2617if (is_android) {
18 import("//build/config/android/rules.gni")
19}
20
halliwell5240d4d2016-04-22 14:34:3221config("playready_config") {
22 if (use_playready) {
slan62afce42015-11-13 22:53:5823 defines = [ "PLAYREADY_CDM_AVAILABLE" ]
prashantv4025129e2015-04-21 21:54:2224 }
25}
26
slan87db9d12015-10-05 20:37:3827# A list of all public test() binaries. This is an organizational target that
28# cannot be depended upon or built directly. Build cast_group_test_list instead.
29cast_test_group("cast_tests") {
mbjorgeb64c791f2016-09-20 18:04:5630 filters = []
slan87db9d12015-10-05 20:37:3831 tests = [
32 "//base:base_unittests",
slanf48fe872015-06-23 19:41:5233 "//chromecast/base:cast_base_unittests",
kmackayfa656b092016-02-04 23:23:5434 "//chromecast/base/component:cast_component_unittests",
gunsch5ed6d7d2015-08-31 22:56:1935 "//chromecast/crypto:cast_crypto_unittests",
mbjorgec83cce952016-07-27 02:40:3136 "//chromecast/system/reboot:cast_reboot_unittests",
slan87db9d12015-10-05 20:37:3837 "//content/test:content_unittests",
38 "//crypto:crypto_unittests",
slan87db9d12015-10-05 20:37:3839 "//media:media_unittests",
40 "//media/midi:midi_unittests",
41 "//net:net_unittests",
42 "//ppapi:ppapi_unittests",
43 "//sandbox/linux:sandbox_linux_unittests",
44 "//sql:sql_unittests",
slan87db9d12015-10-05 20:37:3845 "//third_party/cacheinvalidation:cacheinvalidation_unittests",
46 "//ui/base:ui_base_unittests",
slanf48fe872015-06-23 19:41:5247 ]
slan87db9d12015-10-05 20:37:3848
mbjorgeb64c791f2016-09-20 18:04:5649 if (!is_cast_audio_only) {
50 tests += [ "//gpu:gpu_unittests" ]
51 }
52
sanfin09990de52015-11-16 19:08:1953 if (is_linux) {
54 tests += [ "//chromecast/crash:cast_crash_unittests" ]
55 }
56
mbjorgeb64c791f2016-09-20 18:04:5657 if (!is_android && use_alsa) {
58 tests += [ "//chromecast/media/cma/backend/alsa:cast_alsa_cma_backend_unittests" ]
59 }
slan87db9d12015-10-05 20:37:3860
mbjorgeb64c791f2016-09-20 18:04:5661 if (!is_android) {
62 tests += [
63 "//chromecast/app:cast_shell_unittests",
64 "//chromecast/browser:cast_shell_browser_test",
65 "//chromecast/media:cast_media_unittests",
66 "//ipc:ipc_tests",
67 "//jingle:jingle_unittests",
68 "//url:url_unittests",
69 ]
slan87db9d12015-10-05 20:37:3870
mbjorgeb64c791f2016-09-20 18:04:5671 cast_media_unittests_filter = {
72 test_name = "cast_media_unittests"
73
74 # --test-launcher-jobs=1 => so internal code can bind to port
75 args = [ "--test-launcher-jobs=1" ]
76 }
77 filters += [ cast_media_unittests_filter ]
78
79 cast_shell_browser_test_filter = {
80 test_name = "cast_shell_browser_test"
81
82 # --enable-local-file-accesses => to load sample media files
83 # --test-launcher-jobs=1 => so internal code can bind to port
84 args = [
85 "--no-sandbox",
86 "--enable-local-file-accesses",
87 "--enable-cma-media-pipeline",
88 "--ozone-platform=cast",
89 "--test-launcher-jobs=1",
90 ]
91 if (!is_cast_desktop_build) {
92 args += [ "--use-gpu-in-tests" ]
93 }
94 }
95 filters += [ cast_shell_browser_test_filter ]
96
97 ipc_tests_filter = {
98 test_name = "ipc_tests"
99
100 # --test-launcher-jobs=1 => so internal code can bind to port
101 args = [ "--test-launcher-jobs=1" ]
102 }
103 filters += [ ipc_tests_filter ]
104
105 url_unittests_filter = {
106 test_name = "url_unittests"
107
108 if (target_os == "linux" && !is_cast_desktop_build) {
109 # DoAppendUTF8Invalid fails because of dcheck_always_on flag in Eng builds
110 gtest_excludes = [ "URLCanonTest.DoAppendUTF8Invalid" ]
111 }
112 }
113 filters += [ url_unittests_filter ]
114 }
115
116 base_unittests_filter = {
117 test_name = "base_unittests"
118 if (target_os == "linux" && !is_cast_desktop_build) {
119 # Disable ProcessMetricsTest.GetNumberOfThreads (b/15610509)
120 # Disable ProcessUtilTest.* (need to define OS_ANDROID)
121 # Disable StackContainer.BufferAlignment (don't support 16-byte alignment)
122 # Disable SystemMetrics2Test.GetSystemMemoryInfo (buffers>0 can't be guaranteed)
123 gtest_excludes = [
124 "ProcessMetricsTest.GetNumberOfThreads",
125 "ProcessUtilTest.*",
126 "StackContainer.BufferAlignment",
127 "SystemMetrics2Test.GetSystemMemoryInfo",
128 ]
129
130 if (is_cast_audio_only) {
131 # Also disable TimeFormattingTest on audio-only builds, since we don't
132 # include the necessary info in icudtl.dat.
133 gtest_excludes += [ "TimeFormattingTest.*" ]
134 }
135 }
136 }
137 filters += [ base_unittests_filter ]
138
139 content_unittests_filter = {
140 test_name = "content_unittests"
141 if (target_os == "linux" && !is_cast_desktop_build) {
slan87db9d12015-10-05 20:37:38142 # DesktopCaptureDeviceTest.*: No capture device on Eureka
143 # Disable PepperGamepadHostTest.WaitForReply (pepper not supported on Eureka)
144 # Disable GpuDataManagerImplPrivateTest.SetGLStrings and
145 # RenderWidgetHostTest.Background because we disable the blacklist to enable WebGL (b/16142554)
mbjorgeb64c791f2016-09-20 18:04:56146 gtest_excludes = [
147 "DOMStorageDatabaseTest.TestCanOpenAndReadWebCoreDatabase",
148 "DesktopCaptureDeviceTest.Capture",
149 "GamepadProviderTest.PollingAccess",
150 "GpuDataManagerImplPrivateTest.SetGLStrings",
151 "PepperGamepadHostTest.WaitForReply",
152 "RenderWidgetHostTest.Background",
153 ]
154 }
155 }
156 filters += [ content_unittests_filter ]
slan87db9d12015-10-05 20:37:38157
mbjorgeb64c791f2016-09-20 18:04:56158 media_unittests_filter = {
159 test_name = "media_unittests"
160 if (target_os == "linux" && !is_cast_desktop_build) {
slan87db9d12015-10-05 20:37:38161 # Disable VP9 related tests (b/18593324)
162 # PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM
163 # PipelineIntegrationTest.BasicPlayback_VideoOnly_VP9_WebM
164 # PipelineIntegrationTest.BasicPlayback_VP9*
165 # PipelineIntegrationTest.P444_VP9_WebM
166 # Disable VP8A tests (b/18593324)
167 # PipelineIntegrationTest.BasicPlayback_VP8A*
168 # Disable OpusAudioDecoderTest/AudioDecoderTest.ProduceAudioSamples/0 (unit
169 # test fails when Opus decoder uses fixed-point)
170 # Due to b/16456550, disable the following four test cases:
171 # AudioOutputControllerTest.PlayDivertSwitchDeviceRevertClose
172 # AudioOutputControllerTest.PlaySwitchDeviceClose
173 # AudioStreamHandlerTest.Play
174 # SoundsManagerTest.Play
175 # Disable AudioStreamHandlerTest.ConsecutivePlayRequests (b/16539293)
mbjorgeb64c791f2016-09-20 18:04:56176 gtest_excludes = [
177 "AudioOutputControllerTest.PlayDivertSwitchDeviceRevertClose",
178 "AudioOutputControllerTest.PlaySwitchDeviceClose",
179 "AudioStreamHandlerTest.Play",
180 "AudioStreamHandlerTest.ConsecutivePlayRequests",
181 "PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM",
182 "PipelineIntegrationTest.BasicPlayback_VideoOnly_VP9_WebM",
183 "PipelineIntegrationTest.BasicPlayback_VP9*",
184 "PipelineIntegrationTest.P444_VP9_WebM",
185 "PipelineIntegrationTest.BasicPlayback_VP8A*",
186 "OpusAudioDecoderTest/AudioDecoderTest.ProduceAudioSamples/0",
187 "SoundsManagerTest.Play",
188 ]
189 } else if (target_os == "android" || is_cast_desktop_build) {
190 # Disable PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM (not supported)
191 gtest_excludes =
192 [ "PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM" ]
almasrymina93bf2752016-06-29 20:40:57193 }
mbjorgeb64c791f2016-09-20 18:04:56194 }
195 filters += [ media_unittests_filter ]
196
197 net_unittests_filter = {
198 test_name = "net_unittests"
199 if (target_os == "linux" && !is_cast_desktop_build) {
200 # Run net_unittests first to avoid random failures due to slow python startup
201 # KeygenHandlerTest.SmokeTest and KeygenHandlerTest.ConcurrencyTest fail due to
202 # readonly certdb (b/8153161)
203 # URLRequestTestHTTP.GetTest_ManyCookies takes roughly 55s to run. Increase
204 # timeout to 90s from 45s to allow it to pass (b/19821476)
205 # ProxyScriptFetcherImplTest.HttpMimeType is flaking (b/19848784)
206 # Running a batch of net_unittests has high overhead. Run tests in batches of 25 to reduce number of batches (b/23156294).
207 gtest_excludes = [
208 "KeygenHandlerTest.SmokeTest",
209 "KeygenHandlerTest.ConcurrencyTest",
210 "ProxyScriptFetcherImplTest.HttpMimeType",
211 ]
212 args = [
213 "--test-launcher-timeout=90000",
214 "--test-launcher-batch-limit=25",
215 ]
216 } else if (is_cast_desktop_build || target_os == "android") {
mbjorge1641c3f2016-06-17 18:39:47217 # URLRequestTestHTTP.GetTest_ManyCookies takes roughly 55s to run. Increase
218 # timeout to 90s from 45s to allow it to pass (b/19821476) (b/29415636).
219 # CTLogVerifierTest.VerifiesValidConsistencyProofsFromReferenceGenerator
220 # times out occasionally, paricularly on the CQ bots; disable to reduce
221 # CQ flakiness (crbug/598406) (b/29415636).
222 # Running a batch of net_unittests has high overhead, so
223 # run tests in batches of 25 to reduce number of batches (b/23156294).
mbjorgeb64c791f2016-09-20 18:04:56224 gtest_excludes = [ "CTLogVerifierTest.VerifiesValidConsistencyProofsFromReferenceGenerator" ]
225 args = [
226 "--test-launcher-timeout=90000",
227 "--test-launcher-batch-limit=25",
228 ]
slan25bb71f22016-01-06 21:23:55229 }
slan87db9d12015-10-05 20:37:38230 }
mbjorgeb64c791f2016-09-20 18:04:56231 filters += [ net_unittests_filter ]
mbjorge47b1c9b2016-09-20 22:23:03232
233 # TODO(mbjorge): net_unittests do not complete when run with sanitizers,
234 # (in particular, TSAN and UBSAN), resulting in build machines getting stuck
235 # for many hours. Disable them for now, since these are getting run on
236 # Chromium bots anyway. (internal b/31279943)
237 if (using_sanitizer) {
238 tests -= [ "//net:net_unittests" ]
239 filters -= [ net_unittests_filter ]
240 }
slan87db9d12015-10-05 20:37:38241}
242
243# Creates the build and run lists for all test targets.
244cast_test_group_list("cast_test_lists") {
245 build_list_path = "$root_out_dir/tests/build_test_list.txt"
246
247 run_list_path = "$root_out_dir/tests/run_test_list.txt"
248
mbjorge697d8ae152016-06-21 03:48:57249 additional_options = [ "--ozone-platform=headless --test-launcher-bot-mode" ]
slan87db9d12015-10-05 20:37:38250
251 build_tests = true
252
253 test_groups = [ ":cast_tests" ]
254
255 if (chromecast_branding != "public") {
256 test_groups += [ "//chromecast/internal:internal_cast_tests" ]
257 }
slanf48fe872015-06-23 19:41:52258}
slan0c9838b2015-08-05 18:37:40259
sanfin23024072016-06-18 01:02:06260if (is_android) {
261 cast_test_group("cast_junit_tests") {
262 test_type = "junit"
263 tests = [
264 "//base:base_junit_tests",
265 "//content/public/android:content_junit_tests",
266 "//net/android:net_junit_tests",
267 "//testing/android/junit:junit_unit_tests",
268 "//ui/android:ui_junit_tests",
269 ]
270 }
271
272 cast_test_group_list("cast_junit_test_lists") {
273 test_type = "junit"
274 build_list_path = "$root_out_dir/junit/build_junit_test_list.txt"
275 run_list_path = "$root_out_dir/junit/run_junit_test_list.txt"
276 build_tests = true
277 test_groups = [ ":cast_junit_tests" ]
278 }
279}
280
slan0c9838b2015-08-05 18:37:40281source_set("cast_shell_common") {
282 deps = [
slan0c9838b2015-08-05 18:37:40283 ":cast_shell_pak",
slanca520532015-11-05 20:35:33284 ":chromecast_locales_pak",
slan0c9838b2015-08-05 18:37:40285 "//chromecast/app",
286 "//chromecast/browser",
287 "//chromecast/common",
288 "//chromecast/common/media",
289 "//chromecast/renderer",
290 ]
291}
292
293source_set("cast_shell_media") {
294 deps = [
295 "//chromecast/browser/media",
296 "//chromecast/common/media",
297 "//chromecast/renderer/media",
298 ]
299}
300
301executable("cast_shell") {
302 sources = [
303 "app/cast_main.cc",
304 ]
305
306 deps = [
307 ":cast_shell_common",
308 ":cast_shell_media",
brettwba7a73d2015-08-31 22:17:39309 "//build/config/sanitizers:deps",
slan0c9838b2015-08-05 18:37:40310 "//chromecast/app",
311 "//content/public/app:both",
312 ]
313
slan9ccf3592015-09-10 19:40:33314 if (chromecast_branding != "public") {
315 deps += [ "//chromecast/internal:cast_shell_internal" ]
316 }
slan0c9838b2015-08-05 18:37:40317}
318
319repack("cast_shell_pak") {
320 sources = [
321 "$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak",
322 "$root_gen_dir/blink/public/resources/blink_resources.pak",
323 "$root_gen_dir/chromecast/app/shell_resources.pak",
rockot97597152016-10-03 06:27:38324 "$root_gen_dir/chromecast/browser/cast_browser_resources.pak",
slan0c9838b2015-08-05 18:37:40325 "$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
326 "$root_gen_dir/content/app/strings/content_strings_en-US.pak",
327 "$root_gen_dir/content/content_resources.pak",
328 "$root_gen_dir/net/net_resources.pak",
329 "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
330 "$root_gen_dir/ui/resources/webui_resources.pak",
331 "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
332 "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
333 ]
334
slan0c9838b2015-08-05 18:37:40335 output = "$root_out_dir/assets/cast_shell.pak"
336
337 deps = [
338 "//chromecast/app:resources",
rockot97597152016-10-03 06:27:38339 "//chromecast/browser:resources",
slan0c9838b2015-08-05 18:37:40340 "//content:resources",
341 "//content/app/resources",
342 "//content/app/strings",
343 "//net:net_resources",
slan0c9838b2015-08-05 18:37:40344 "//third_party/WebKit/public:image_resources_grit",
agrieved7a71c882015-11-20 19:53:28345 "//third_party/WebKit/public:resources",
slan0c9838b2015-08-05 18:37:40346 "//ui/resources",
347 "//ui/strings",
348 ]
349
slan9ccf3592015-09-10 19:40:33350 if (chromecast_branding != "public") {
slan65a12682016-02-10 01:24:39351 sources += [ "$root_gen_dir/chromecast/internal/cast_shell_internal.pak" ]
slan9ccf3592015-09-10 19:40:33352
slan65a12682016-02-10 01:24:39353 deps += [ "//chromecast/internal:cast_shell_internal_pak" ]
slan0c9838b2015-08-05 18:37:40354 }
355}
slanca520532015-11-05 20:35:33356
slanca520532015-11-05 20:35:33357action("chromecast_locales_pak") {
358 script = "//chromecast/tools/build/chromecast_repack_locales.py"
359
360 # .pak resources in |grit_out_dir| with the same suffix are packed into a
361 # single resource and placed in |locales_dir|. The original .pak resources
362 # are generated by this target's dependencies.
363 grit_out_dir = "$root_gen_dir/chromecast_strings"
364 locales_dir = "$root_out_dir/chromecast_locales"
365
366 sources = []
367 outputs = []
368
369 # |locales| is an array of suffixes declared in //build/config/locals.gni.
370 foreach(locale, locales) {
371 sources += [ "$grit_out_dir/chromecast_settings_$locale.pak" ]
372 outputs += [ "$locales_dir/$locale.pak" ]
373 }
374 deps = [
375 "//chromecast/app:chromecast_settings",
376 ]
377
gfhuangb15dff22016-09-07 02:21:59378 # Include string and other localized resources for internal builds.
slanca520532015-11-05 20:35:33379 if (chromecast_branding != "public") {
380 foreach(locale, locales) {
381 sources += [ "$grit_out_dir/app_strings_$locale.pak" ]
gfhuang79ceb4f2016-09-07 06:43:03382 if (enable_chromecast_webui) {
383 sources += [ "$grit_out_dir/webui_localized_$locale.pak" ]
384 }
slanca520532015-11-05 20:35:33385 }
386 deps += [ "//chromecast/internal/webui:chromecast_app_strings" ]
gfhuang79ceb4f2016-09-07 06:43:03387 if (enable_chromecast_webui) {
388 deps += [ "//chromecast/internal/webui:chromecast_webui_localized" ]
389 }
slanca520532015-11-05 20:35:33390 }
391
392 # This script only accepts the following values for branding:
393 assert(chromecast_branding == "public" || chromecast_branding == "internal" ||
394 chromecast_branding == "google")
395 args = [
mbjorgeb64c791f2016-09-20 18:04:56396 "-b",
397 "$chromecast_branding",
398 "-g",
399 rebase_path("$root_gen_dir/chromecast_strings"),
400 "-x",
401 rebase_path("$root_out_dir/chromecast_locales"),
402 ]
gfhuang79ceb4f2016-09-07 06:43:03403 if (enable_chromecast_webui) {
404 args += [ "-u" ]
405 }
406 args += locales
slanca520532015-11-05 20:35:33407}
slan074ec342016-01-29 23:52:26408
slan7d09f9e2016-04-08 15:47:02409buildflag_header("chromecast_features") {
410 header = "chromecast_features.h"
slana0671e42016-09-01 13:40:19411 flags = [ "IS_CAST_AUDIO_ONLY=$is_cast_audio_only" ]
slan7d09f9e2016-04-08 15:47:02412}
413
slan074ec342016-01-29 23:52:26414if (is_android) {
slan074ec342016-01-29 23:52:26415 android_assets("cast_shell_apk_assets") {
416 assert(v8_use_external_startup_data)
417
418 sources = [
419 "$root_out_dir/assets/cast_shell.pak",
420 ]
421
422 deps = [
423 ":cast_shell_pak",
424 "//third_party/icu:icu_assets",
425 "//v8:v8_external_startup_data_assets",
426 ]
sanfin52f72e82016-04-13 22:36:05427 disable_compression = true
slan074ec342016-01-29 23:52:26428 }
429
slan074ec342016-01-29 23:52:26430 android_apk("cast_shell_apk") {
431 apk_name = "CastShell"
432 android_manifest = "$root_gen_dir/cast_shell_manifest/AndroidManifest.xml"
433 android_manifest_dep = "//chromecast/browser/android:cast_shell_manifest"
434 deps = [
435 ":cast_shell_apk_assets",
436 "//chromecast/android:libcast_shell_android",
437 "//chromecast/browser/android:cast_shell_java",
438 ]
439 }
440}