blob: 9a454506d96b78ce609ef4b29825f6ec98cfc7d4 [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",
pwnall1e6964dbe2016-10-11 18:15:4745 "//storage/browser:storage_unittests",
slan87db9d12015-10-05 20:37:3846 "//third_party/cacheinvalidation:cacheinvalidation_unittests",
47 "//ui/base:ui_base_unittests",
slanf48fe872015-06-23 19:41:5248 ]
slan87db9d12015-10-05 20:37:3849
mbjorgeb64c791f2016-09-20 18:04:5650 if (!is_cast_audio_only) {
51 tests += [ "//gpu:gpu_unittests" ]
52 }
53
sanfin09990de52015-11-16 19:08:1954 if (is_linux) {
55 tests += [ "//chromecast/crash:cast_crash_unittests" ]
56 }
57
mbjorgeb64c791f2016-09-20 18:04:5658 if (!is_android && use_alsa) {
59 tests += [ "//chromecast/media/cma/backend/alsa:cast_alsa_cma_backend_unittests" ]
60 }
slan87db9d12015-10-05 20:37:3861
mbjorgeb64c791f2016-09-20 18:04:5662 if (!is_android) {
63 tests += [
alokpe3bd5ed2016-11-16 15:57:1064 ":cast_shell_browsertests",
65 ":cast_shell_unittests",
mbjorgeb64c791f2016-09-20 18:04:5666 "//chromecast/media:cast_media_unittests",
67 "//ipc:ipc_tests",
68 "//jingle:jingle_unittests",
69 "//url:url_unittests",
70 ]
slan87db9d12015-10-05 20:37:3871
mbjorgeb64c791f2016-09-20 18:04:5672 cast_media_unittests_filter = {
73 test_name = "cast_media_unittests"
74
75 # --test-launcher-jobs=1 => so internal code can bind to port
76 args = [ "--test-launcher-jobs=1" ]
77 }
78 filters += [ cast_media_unittests_filter ]
79
alokpe3bd5ed2016-11-16 15:57:1080 cast_shell_browsertests_filter = {
81 test_name = "cast_shell_browsertests"
mbjorgeb64c791f2016-09-20 18:04:5682
83 # --enable-local-file-accesses => to load sample media files
84 # --test-launcher-jobs=1 => so internal code can bind to port
85 args = [
86 "--no-sandbox",
87 "--enable-local-file-accesses",
88 "--enable-cma-media-pipeline",
89 "--ozone-platform=cast",
90 "--test-launcher-jobs=1",
91 ]
92 if (!is_cast_desktop_build) {
93 args += [ "--use-gpu-in-tests" ]
94 }
95 }
alokpe3bd5ed2016-11-16 15:57:1096 filters += [ cast_shell_browsertests_filter ]
mbjorgeb64c791f2016-09-20 18:04:5697
98 ipc_tests_filter = {
99 test_name = "ipc_tests"
100
101 # --test-launcher-jobs=1 => so internal code can bind to port
102 args = [ "--test-launcher-jobs=1" ]
103 }
104 filters += [ ipc_tests_filter ]
105
106 url_unittests_filter = {
107 test_name = "url_unittests"
108
109 if (target_os == "linux" && !is_cast_desktop_build) {
110 # DoAppendUTF8Invalid fails because of dcheck_always_on flag in Eng builds
111 gtest_excludes = [ "URLCanonTest.DoAppendUTF8Invalid" ]
112 }
113 }
114 filters += [ url_unittests_filter ]
115 }
116
117 base_unittests_filter = {
118 test_name = "base_unittests"
119 if (target_os == "linux" && !is_cast_desktop_build) {
120 # Disable ProcessMetricsTest.GetNumberOfThreads (b/15610509)
121 # Disable ProcessUtilTest.* (need to define OS_ANDROID)
122 # Disable StackContainer.BufferAlignment (don't support 16-byte alignment)
123 # Disable SystemMetrics2Test.GetSystemMemoryInfo (buffers>0 can't be guaranteed)
124 gtest_excludes = [
125 "ProcessMetricsTest.GetNumberOfThreads",
126 "ProcessUtilTest.*",
127 "StackContainer.BufferAlignment",
128 "SystemMetrics2Test.GetSystemMemoryInfo",
129 ]
130
131 if (is_cast_audio_only) {
132 # Also disable TimeFormattingTest on audio-only builds, since we don't
133 # include the necessary info in icudtl.dat.
134 gtest_excludes += [ "TimeFormattingTest.*" ]
135 }
136 }
137 }
138 filters += [ base_unittests_filter ]
139
140 content_unittests_filter = {
141 test_name = "content_unittests"
142 if (target_os == "linux" && !is_cast_desktop_build) {
slan87db9d12015-10-05 20:37:38143 # DesktopCaptureDeviceTest.*: No capture device on Eureka
144 # Disable PepperGamepadHostTest.WaitForReply (pepper not supported on Eureka)
145 # Disable GpuDataManagerImplPrivateTest.SetGLStrings and
146 # RenderWidgetHostTest.Background because we disable the blacklist to enable WebGL (b/16142554)
mbjorgeb64c791f2016-09-20 18:04:56147 gtest_excludes = [
148 "DOMStorageDatabaseTest.TestCanOpenAndReadWebCoreDatabase",
149 "DesktopCaptureDeviceTest.Capture",
150 "GamepadProviderTest.PollingAccess",
151 "GpuDataManagerImplPrivateTest.SetGLStrings",
152 "PepperGamepadHostTest.WaitForReply",
153 "RenderWidgetHostTest.Background",
154 ]
155 }
156 }
157 filters += [ content_unittests_filter ]
slan87db9d12015-10-05 20:37:38158
mbjorgeb64c791f2016-09-20 18:04:56159 media_unittests_filter = {
160 test_name = "media_unittests"
161 if (target_os == "linux" && !is_cast_desktop_build) {
slan87db9d12015-10-05 20:37:38162 # Disable VP9 related tests (b/18593324)
163 # PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM
164 # PipelineIntegrationTest.BasicPlayback_VideoOnly_VP9_WebM
165 # PipelineIntegrationTest.BasicPlayback_VP9*
166 # PipelineIntegrationTest.P444_VP9_WebM
167 # Disable VP8A tests (b/18593324)
168 # PipelineIntegrationTest.BasicPlayback_VP8A*
169 # Disable OpusAudioDecoderTest/AudioDecoderTest.ProduceAudioSamples/0 (unit
170 # test fails when Opus decoder uses fixed-point)
171 # Due to b/16456550, disable the following four test cases:
172 # AudioOutputControllerTest.PlayDivertSwitchDeviceRevertClose
173 # AudioOutputControllerTest.PlaySwitchDeviceClose
174 # AudioStreamHandlerTest.Play
175 # SoundsManagerTest.Play
176 # Disable AudioStreamHandlerTest.ConsecutivePlayRequests (b/16539293)
mbjorgeb64c791f2016-09-20 18:04:56177 gtest_excludes = [
178 "AudioOutputControllerTest.PlayDivertSwitchDeviceRevertClose",
179 "AudioOutputControllerTest.PlaySwitchDeviceClose",
180 "AudioStreamHandlerTest.Play",
181 "AudioStreamHandlerTest.ConsecutivePlayRequests",
182 "PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM",
183 "PipelineIntegrationTest.BasicPlayback_VideoOnly_VP9_WebM",
184 "PipelineIntegrationTest.BasicPlayback_VP9*",
185 "PipelineIntegrationTest.P444_VP9_WebM",
186 "PipelineIntegrationTest.BasicPlayback_VP8A*",
187 "OpusAudioDecoderTest/AudioDecoderTest.ProduceAudioSamples/0",
188 "SoundsManagerTest.Play",
189 ]
190 } else if (target_os == "android" || is_cast_desktop_build) {
191 # Disable PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM (not supported)
192 gtest_excludes =
193 [ "PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM" ]
almasrymina93bf2752016-06-29 20:40:57194 }
mbjorgeb64c791f2016-09-20 18:04:56195 }
196 filters += [ media_unittests_filter ]
197
198 net_unittests_filter = {
199 test_name = "net_unittests"
mbjorgef3f79af2016-10-14 00:13:04200 if (using_sanitizer) {
201 # TODO(mbjorge): net_unittests do not complete when run with sanitizers,
202 # (in particular, TSAN and UBSAN), resulting in build machines getting stuck
203 # for many hours. Disable them for now, since these are getting run on
204 # Chromium bots anyway. (internal b/31279943)
205 gtest_excludes = [ "*" ]
206 } else if (target_os == "linux" && !is_cast_desktop_build) {
mbjorgeb64c791f2016-09-20 18:04:56207 # Run net_unittests first to avoid random failures due to slow python startup
208 # KeygenHandlerTest.SmokeTest and KeygenHandlerTest.ConcurrencyTest fail due to
209 # readonly certdb (b/8153161)
210 # URLRequestTestHTTP.GetTest_ManyCookies takes roughly 55s to run. Increase
211 # timeout to 90s from 45s to allow it to pass (b/19821476)
212 # ProxyScriptFetcherImplTest.HttpMimeType is flaking (b/19848784)
213 # Running a batch of net_unittests has high overhead. Run tests in batches of 25 to reduce number of batches (b/23156294).
214 gtest_excludes = [
215 "KeygenHandlerTest.SmokeTest",
216 "KeygenHandlerTest.ConcurrencyTest",
217 "ProxyScriptFetcherImplTest.HttpMimeType",
218 ]
219 args = [
220 "--test-launcher-timeout=90000",
221 "--test-launcher-batch-limit=25",
222 ]
223 } else if (is_cast_desktop_build || target_os == "android") {
mbjorge1641c3f2016-06-17 18:39:47224 # URLRequestTestHTTP.GetTest_ManyCookies takes roughly 55s to run. Increase
225 # timeout to 90s from 45s to allow it to pass (b/19821476) (b/29415636).
226 # CTLogVerifierTest.VerifiesValidConsistencyProofsFromReferenceGenerator
227 # times out occasionally, paricularly on the CQ bots; disable to reduce
228 # CQ flakiness (crbug/598406) (b/29415636).
229 # Running a batch of net_unittests has high overhead, so
230 # run tests in batches of 25 to reduce number of batches (b/23156294).
mbjorgeb64c791f2016-09-20 18:04:56231 gtest_excludes = [ "CTLogVerifierTest.VerifiesValidConsistencyProofsFromReferenceGenerator" ]
232 args = [
233 "--test-launcher-timeout=90000",
234 "--test-launcher-batch-limit=25",
235 ]
slan25bb71f22016-01-06 21:23:55236 }
slan87db9d12015-10-05 20:37:38237 }
mbjorgeb64c791f2016-09-20 18:04:56238 filters += [ net_unittests_filter ]
slan87db9d12015-10-05 20:37:38239}
240
241# Creates the build and run lists for all test targets.
242cast_test_group_list("cast_test_lists") {
243 build_list_path = "$root_out_dir/tests/build_test_list.txt"
244
245 run_list_path = "$root_out_dir/tests/run_test_list.txt"
246
mbjorge697d8ae152016-06-21 03:48:57247 additional_options = [ "--ozone-platform=headless --test-launcher-bot-mode" ]
slan87db9d12015-10-05 20:37:38248
249 build_tests = true
250
251 test_groups = [ ":cast_tests" ]
252
253 if (chromecast_branding != "public") {
254 test_groups += [ "//chromecast/internal:internal_cast_tests" ]
255 }
slanf48fe872015-06-23 19:41:52256}
slan0c9838b2015-08-05 18:37:40257
sanfin23024072016-06-18 01:02:06258if (is_android) {
259 cast_test_group("cast_junit_tests") {
260 test_type = "junit"
261 tests = [
262 "//base:base_junit_tests",
263 "//content/public/android:content_junit_tests",
264 "//net/android:net_junit_tests",
265 "//testing/android/junit:junit_unit_tests",
266 "//ui/android:ui_junit_tests",
267 ]
268 }
269
270 cast_test_group_list("cast_junit_test_lists") {
271 test_type = "junit"
272 build_list_path = "$root_out_dir/junit/build_junit_test_list.txt"
273 run_list_path = "$root_out_dir/junit/run_junit_test_list.txt"
274 build_tests = true
275 test_groups = [ ":cast_junit_tests" ]
276 }
277}
278
alokpe3bd5ed2016-11-16 15:57:10279test("cast_shell_unittests") {
280 deps = [
281 ":cast_shell_lib",
282 "//chromecast/app:test_support",
283 "//chromecast/app:unittests",
284 "//chromecast/browser:unittests",
285 ]
286}
287
288test("cast_shell_browsertests") {
289 deps = [
290 ":cast_shell_lib",
291 "//chromecast/app:test_support",
292 "//chromecast/browser:browsertests",
293 ]
294
295 if (chromecast_branding == "public") {
296 # Link default libcast_media_1.0 statically not to link dummy one
297 # dynamically for public unittests.
298 deps += [ "//chromecast/media/base:libcast_media_1.0_default_core" ]
299 }
300}
301
alokpcd91e6032016-11-10 22:13:07302group("cast_shell_lib") {
mbjorge095af3442016-11-16 02:41:46303 data_deps = [
304 ":cast_shell_pak",
305 ]
306
slan0c9838b2015-08-05 18:37:40307 deps = [
slan0c9838b2015-08-05 18:37:40308 "//chromecast/app",
309 "//chromecast/browser",
310 "//chromecast/common",
slan0c9838b2015-08-05 18:37:40311 "//chromecast/renderer",
312 ]
slan0c9838b2015-08-05 18:37:40313
alokpcd91e6032016-11-10 22:13:07314 if (chromecast_branding != "public") {
315 deps += [ "//chromecast/internal/shell" ]
316 }
slan0c9838b2015-08-05 18:37:40317}
318
319executable("cast_shell") {
320 sources = [
321 "app/cast_main.cc",
322 ]
323
324 deps = [
alokpcd91e6032016-11-10 22:13:07325 ":cast_shell_lib",
alokpcd91e6032016-11-10 22:13:07326 ":chromecast_locales_pak",
brettwba7a73d2015-08-31 22:17:39327 "//build/config/sanitizers:deps",
slan0c9838b2015-08-05 18:37:40328 "//chromecast/app",
329 "//content/public/app:both",
330 ]
slan0c9838b2015-08-05 18:37:40331}
332
333repack("cast_shell_pak") {
334 sources = [
335 "$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak",
336 "$root_gen_dir/blink/public/resources/blink_resources.pak",
337 "$root_gen_dir/chromecast/app/shell_resources.pak",
rockot97597152016-10-03 06:27:38338 "$root_gen_dir/chromecast/browser/cast_browser_resources.pak",
slan0c9838b2015-08-05 18:37:40339 "$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
340 "$root_gen_dir/content/app/strings/content_strings_en-US.pak",
341 "$root_gen_dir/content/content_resources.pak",
342 "$root_gen_dir/net/net_resources.pak",
343 "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
344 "$root_gen_dir/ui/resources/webui_resources.pak",
345 "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
346 "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
347 ]
348
slan0c9838b2015-08-05 18:37:40349 output = "$root_out_dir/assets/cast_shell.pak"
350
351 deps = [
352 "//chromecast/app:resources",
rockot97597152016-10-03 06:27:38353 "//chromecast/browser:resources",
slan0c9838b2015-08-05 18:37:40354 "//content:resources",
355 "//content/app/resources",
356 "//content/app/strings",
357 "//net:net_resources",
slan0c9838b2015-08-05 18:37:40358 "//third_party/WebKit/public:image_resources_grit",
agrieved7a71c882015-11-20 19:53:28359 "//third_party/WebKit/public:resources",
slan0c9838b2015-08-05 18:37:40360 "//ui/resources",
361 "//ui/strings",
362 ]
363
slan9ccf3592015-09-10 19:40:33364 if (chromecast_branding != "public") {
slan65a12682016-02-10 01:24:39365 sources += [ "$root_gen_dir/chromecast/internal/cast_shell_internal.pak" ]
slan9ccf3592015-09-10 19:40:33366
slan65a12682016-02-10 01:24:39367 deps += [ "//chromecast/internal:cast_shell_internal_pak" ]
slan0c9838b2015-08-05 18:37:40368 }
369}
slanca520532015-11-05 20:35:33370
slanca520532015-11-05 20:35:33371action("chromecast_locales_pak") {
372 script = "//chromecast/tools/build/chromecast_repack_locales.py"
373
374 # .pak resources in |grit_out_dir| with the same suffix are packed into a
375 # single resource and placed in |locales_dir|. The original .pak resources
376 # are generated by this target's dependencies.
377 grit_out_dir = "$root_gen_dir/chromecast_strings"
378 locales_dir = "$root_out_dir/chromecast_locales"
379
380 sources = []
381 outputs = []
382
383 # |locales| is an array of suffixes declared in //build/config/locals.gni.
384 foreach(locale, locales) {
385 sources += [ "$grit_out_dir/chromecast_settings_$locale.pak" ]
386 outputs += [ "$locales_dir/$locale.pak" ]
387 }
388 deps = [
389 "//chromecast/app:chromecast_settings",
390 ]
391
gfhuangb15dff22016-09-07 02:21:59392 # Include string and other localized resources for internal builds.
slanca520532015-11-05 20:35:33393 if (chromecast_branding != "public") {
394 foreach(locale, locales) {
395 sources += [ "$grit_out_dir/app_strings_$locale.pak" ]
gfhuang79ceb4f2016-09-07 06:43:03396 if (enable_chromecast_webui) {
397 sources += [ "$grit_out_dir/webui_localized_$locale.pak" ]
398 }
slanca520532015-11-05 20:35:33399 }
400 deps += [ "//chromecast/internal/webui:chromecast_app_strings" ]
gfhuang79ceb4f2016-09-07 06:43:03401 if (enable_chromecast_webui) {
402 deps += [ "//chromecast/internal/webui:chromecast_webui_localized" ]
403 }
slanca520532015-11-05 20:35:33404 }
405
406 # This script only accepts the following values for branding:
407 assert(chromecast_branding == "public" || chromecast_branding == "internal" ||
408 chromecast_branding == "google")
409 args = [
mbjorgeb64c791f2016-09-20 18:04:56410 "-b",
411 "$chromecast_branding",
412 "-g",
413 rebase_path("$root_gen_dir/chromecast_strings"),
414 "-x",
415 rebase_path("$root_out_dir/chromecast_locales"),
416 ]
gfhuang79ceb4f2016-09-07 06:43:03417 if (enable_chromecast_webui) {
418 args += [ "-u" ]
419 }
420 args += locales
slanca520532015-11-05 20:35:33421}
slan074ec342016-01-29 23:52:26422
slan7d09f9e2016-04-08 15:47:02423buildflag_header("chromecast_features") {
424 header = "chromecast_features.h"
slana0671e42016-09-01 13:40:19425 flags = [ "IS_CAST_AUDIO_ONLY=$is_cast_audio_only" ]
slan7d09f9e2016-04-08 15:47:02426}
427
slan074ec342016-01-29 23:52:26428if (is_android) {
slan074ec342016-01-29 23:52:26429 android_assets("cast_shell_apk_assets") {
430 assert(v8_use_external_startup_data)
431
432 sources = [
433 "$root_out_dir/assets/cast_shell.pak",
434 ]
435
436 deps = [
437 ":cast_shell_pak",
438 "//third_party/icu:icu_assets",
439 "//v8:v8_external_startup_data_assets",
440 ]
sanfin52f72e82016-04-13 22:36:05441 disable_compression = true
slan074ec342016-01-29 23:52:26442 }
443
slan074ec342016-01-29 23:52:26444 android_apk("cast_shell_apk") {
445 apk_name = "CastShell"
446 android_manifest = "$root_gen_dir/cast_shell_manifest/AndroidManifest.xml"
447 android_manifest_dep = "//chromecast/browser/android:cast_shell_manifest"
448 deps = [
449 ":cast_shell_apk_assets",
450 "//chromecast/android:libcast_shell_android",
451 "//chromecast/browser/android:cast_shell_java",
452 ]
453 }
454}