blob: 56cec5d94303bb1b832dfd16ffd5e9de6c183e95 [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",
mbjorgeb64c791f2016-09-20 18:04:5688 "--ozone-platform=cast",
89 "--test-launcher-jobs=1",
90 ]
91 if (!is_cast_desktop_build) {
92 args += [ "--use-gpu-in-tests" ]
mbjorgee37679292016-12-13 23:53:0693
94 # TODO(derekjchow): Make these tests pass on Chromecast devices.
95 # Once all of the CastMediaBlockerTest.* have been un-DISABLEd and
96 # are running successfully, revisit these tests and see if they pass
97 # on devices. (crbug/665118, internal b/32023194)
98 gtest_excludes = [
99 "CastMediaBlockerBrowserTest.Video_BlockUnblock",
100 "CastMediaBlockerBrowserTest.Audio_BlockUnblock",
101 ]
mbjorgeb64c791f2016-09-20 18:04:56102 }
103 }
alokpe3bd5ed2016-11-16 15:57:10104 filters += [ cast_shell_browsertests_filter ]
mbjorgeb64c791f2016-09-20 18:04:56105
106 ipc_tests_filter = {
107 test_name = "ipc_tests"
108
109 # --test-launcher-jobs=1 => so internal code can bind to port
110 args = [ "--test-launcher-jobs=1" ]
111 }
112 filters += [ ipc_tests_filter ]
113
114 url_unittests_filter = {
115 test_name = "url_unittests"
116
117 if (target_os == "linux" && !is_cast_desktop_build) {
118 # DoAppendUTF8Invalid fails because of dcheck_always_on flag in Eng builds
119 gtest_excludes = [ "URLCanonTest.DoAppendUTF8Invalid" ]
120 }
121 }
122 filters += [ url_unittests_filter ]
123 }
124
125 base_unittests_filter = {
126 test_name = "base_unittests"
127 if (target_os == "linux" && !is_cast_desktop_build) {
128 # Disable ProcessMetricsTest.GetNumberOfThreads (b/15610509)
129 # Disable ProcessUtilTest.* (need to define OS_ANDROID)
130 # Disable StackContainer.BufferAlignment (don't support 16-byte alignment)
131 # Disable SystemMetrics2Test.GetSystemMemoryInfo (buffers>0 can't be guaranteed)
132 gtest_excludes = [
133 "ProcessMetricsTest.GetNumberOfThreads",
134 "ProcessUtilTest.*",
135 "StackContainer.BufferAlignment",
136 "SystemMetrics2Test.GetSystemMemoryInfo",
137 ]
138
139 if (is_cast_audio_only) {
140 # Also disable TimeFormattingTest on audio-only builds, since we don't
141 # include the necessary info in icudtl.dat.
142 gtest_excludes += [ "TimeFormattingTest.*" ]
143 }
144 }
145 }
146 filters += [ base_unittests_filter ]
147
148 content_unittests_filter = {
149 test_name = "content_unittests"
bshaya27e79282016-12-09 23:41:16150 gtest_excludes = []
mbjorgeb64c791f2016-09-20 18:04:56151 if (target_os == "linux" && !is_cast_desktop_build) {
slan87db9d12015-10-05 20:37:38152 # DesktopCaptureDeviceTest.*: No capture device on Eureka
153 # Disable PepperGamepadHostTest.WaitForReply (pepper not supported on Eureka)
154 # Disable GpuDataManagerImplPrivateTest.SetGLStrings and
155 # RenderWidgetHostTest.Background because we disable the blacklist to enable WebGL (b/16142554)
bshaya27e79282016-12-09 23:41:16156 gtest_excludes += [
mbjorgeb64c791f2016-09-20 18:04:56157 "DOMStorageDatabaseTest.TestCanOpenAndReadWebCoreDatabase",
158 "DesktopCaptureDeviceTest.Capture",
159 "GamepadProviderTest.PollingAccess",
160 "GpuDataManagerImplPrivateTest.SetGLStrings",
161 "PepperGamepadHostTest.WaitForReply",
162 "RenderWidgetHostTest.Background",
163 ]
164 }
bshaya27e79282016-12-09 23:41:16165 if (is_cast_audio_only) {
166 # No way to display URL's on audio only cast devices.
167 gtest_excludes += [ "NavigationEntryTest.NavigationEntryURLs" ]
168 }
mbjorgeb64c791f2016-09-20 18:04:56169 }
170 filters += [ content_unittests_filter ]
slan87db9d12015-10-05 20:37:38171
mbjorgeb64c791f2016-09-20 18:04:56172 media_unittests_filter = {
173 test_name = "media_unittests"
174 if (target_os == "linux" && !is_cast_desktop_build) {
slan87db9d12015-10-05 20:37:38175 # Disable VP9 related tests (b/18593324)
176 # PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM
177 # PipelineIntegrationTest.BasicPlayback_VideoOnly_VP9_WebM
178 # PipelineIntegrationTest.BasicPlayback_VP9*
179 # PipelineIntegrationTest.P444_VP9_WebM
180 # Disable VP8A tests (b/18593324)
181 # PipelineIntegrationTest.BasicPlayback_VP8A*
182 # Disable OpusAudioDecoderTest/AudioDecoderTest.ProduceAudioSamples/0 (unit
183 # test fails when Opus decoder uses fixed-point)
184 # Due to b/16456550, disable the following four test cases:
185 # AudioOutputControllerTest.PlayDivertSwitchDeviceRevertClose
186 # AudioOutputControllerTest.PlaySwitchDeviceClose
187 # AudioStreamHandlerTest.Play
188 # SoundsManagerTest.Play
189 # Disable AudioStreamHandlerTest.ConsecutivePlayRequests (b/16539293)
mbjorgeb64c791f2016-09-20 18:04:56190 gtest_excludes = [
191 "AudioOutputControllerTest.PlayDivertSwitchDeviceRevertClose",
192 "AudioOutputControllerTest.PlaySwitchDeviceClose",
193 "AudioStreamHandlerTest.Play",
194 "AudioStreamHandlerTest.ConsecutivePlayRequests",
195 "PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM",
196 "PipelineIntegrationTest.BasicPlayback_VideoOnly_VP9_WebM",
197 "PipelineIntegrationTest.BasicPlayback_VP9*",
198 "PipelineIntegrationTest.P444_VP9_WebM",
199 "PipelineIntegrationTest.BasicPlayback_VP8A*",
200 "OpusAudioDecoderTest/AudioDecoderTest.ProduceAudioSamples/0",
201 "SoundsManagerTest.Play",
202 ]
203 } else if (target_os == "android" || is_cast_desktop_build) {
204 # Disable PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM (not supported)
205 gtest_excludes =
206 [ "PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM" ]
almasrymina93bf2752016-06-29 20:40:57207 }
mbjorgeb64c791f2016-09-20 18:04:56208 }
209 filters += [ media_unittests_filter ]
210
211 net_unittests_filter = {
212 test_name = "net_unittests"
mbjorgef3f79af2016-10-14 00:13:04213 if (using_sanitizer) {
214 # TODO(mbjorge): net_unittests do not complete when run with sanitizers,
215 # (in particular, TSAN and UBSAN), resulting in build machines getting stuck
216 # for many hours. Disable them for now, since these are getting run on
217 # Chromium bots anyway. (internal b/31279943)
218 gtest_excludes = [ "*" ]
219 } else if (target_os == "linux" && !is_cast_desktop_build) {
mbjorgeb64c791f2016-09-20 18:04:56220 # Run net_unittests first to avoid random failures due to slow python startup
mbjorgeb64c791f2016-09-20 18:04:56221 # URLRequestTestHTTP.GetTest_ManyCookies takes roughly 55s to run. Increase
222 # timeout to 90s from 45s to allow it to pass (b/19821476)
223 # ProxyScriptFetcherImplTest.HttpMimeType is flaking (b/19848784)
derekjchowac29ce32016-12-06 17:11:59224 # Running a batch of net_unittests has high overhead. Run tests in batches of 50 to reduce number of batches (b/23156294).
rsleevi5d916f6c2016-12-21 22:39:41225 gtest_excludes = [ "ProxyScriptFetcherImplTest.HttpMimeType" ]
mbjorgeb64c791f2016-09-20 18:04:56226 args = [
227 "--test-launcher-timeout=90000",
derekjchowac29ce32016-12-06 17:11:59228 "--test-launcher-batch-limit=50",
mbjorgeb64c791f2016-09-20 18:04:56229 ]
230 } else if (is_cast_desktop_build || target_os == "android") {
mbjorge1641c3f2016-06-17 18:39:47231 # URLRequestTestHTTP.GetTest_ManyCookies takes roughly 55s to run. Increase
232 # timeout to 90s from 45s to allow it to pass (b/19821476) (b/29415636).
233 # CTLogVerifierTest.VerifiesValidConsistencyProofsFromReferenceGenerator
234 # times out occasionally, paricularly on the CQ bots; disable to reduce
235 # CQ flakiness (crbug/598406) (b/29415636).
236 # Running a batch of net_unittests has high overhead, so
237 # run tests in batches of 25 to reduce number of batches (b/23156294).
mbjorgeb64c791f2016-09-20 18:04:56238 gtest_excludes = [ "CTLogVerifierTest.VerifiesValidConsistencyProofsFromReferenceGenerator" ]
239 args = [
240 "--test-launcher-timeout=90000",
241 "--test-launcher-batch-limit=25",
242 ]
slan25bb71f22016-01-06 21:23:55243 }
slan87db9d12015-10-05 20:37:38244 }
mbjorgeb64c791f2016-09-20 18:04:56245 filters += [ net_unittests_filter ]
slan87db9d12015-10-05 20:37:38246}
247
248# Creates the build and run lists for all test targets.
249cast_test_group_list("cast_test_lists") {
250 build_list_path = "$root_out_dir/tests/build_test_list.txt"
251
252 run_list_path = "$root_out_dir/tests/run_test_list.txt"
253
mbjorge697d8ae152016-06-21 03:48:57254 additional_options = [ "--ozone-platform=headless --test-launcher-bot-mode" ]
slan87db9d12015-10-05 20:37:38255
256 build_tests = true
257
258 test_groups = [ ":cast_tests" ]
259
260 if (chromecast_branding != "public") {
261 test_groups += [ "//chromecast/internal:internal_cast_tests" ]
262 }
slanf48fe872015-06-23 19:41:52263}
slan0c9838b2015-08-05 18:37:40264
sanfin23024072016-06-18 01:02:06265if (is_android) {
266 cast_test_group("cast_junit_tests") {
267 test_type = "junit"
268 tests = [
269 "//base:base_junit_tests",
270 "//content/public/android:content_junit_tests",
271 "//net/android:net_junit_tests",
272 "//testing/android/junit:junit_unit_tests",
273 "//ui/android:ui_junit_tests",
274 ]
275 }
276
277 cast_test_group_list("cast_junit_test_lists") {
278 test_type = "junit"
279 build_list_path = "$root_out_dir/junit/build_junit_test_list.txt"
280 run_list_path = "$root_out_dir/junit/run_junit_test_list.txt"
281 build_tests = true
282 test_groups = [ ":cast_junit_tests" ]
283 }
284}
285
alokpe3bd5ed2016-11-16 15:57:10286test("cast_shell_unittests") {
287 deps = [
288 ":cast_shell_lib",
289 "//chromecast/app:test_support",
290 "//chromecast/app:unittests",
291 "//chromecast/browser:unittests",
292 ]
293}
294
295test("cast_shell_browsertests") {
296 deps = [
297 ":cast_shell_lib",
298 "//chromecast/app:test_support",
299 "//chromecast/browser:browsertests",
300 ]
alokpe3bd5ed2016-11-16 15:57:10301}
302
alokpcd91e6032016-11-10 22:13:07303group("cast_shell_lib") {
mbjorge095af3442016-11-16 02:41:46304 data_deps = [
305 ":cast_shell_pak",
306 ]
307
slan0c9838b2015-08-05 18:37:40308 deps = [
slan0c9838b2015-08-05 18:37:40309 "//chromecast/app",
310 "//chromecast/browser",
311 "//chromecast/common",
slan0c9838b2015-08-05 18:37:40312 "//chromecast/renderer",
313 ]
slan0c9838b2015-08-05 18:37:40314
alokpcd91e6032016-11-10 22:13:07315 if (chromecast_branding != "public") {
316 deps += [ "//chromecast/internal/shell" ]
317 }
slan0c9838b2015-08-05 18:37:40318}
319
320executable("cast_shell") {
321 sources = [
322 "app/cast_main.cc",
323 ]
324
325 deps = [
alokpcd91e6032016-11-10 22:13:07326 ":cast_shell_lib",
alokpcd91e6032016-11-10 22:13:07327 ":chromecast_locales_pak",
brettwba7a73d2015-08-31 22:17:39328 "//build/config/sanitizers:deps",
slan0c9838b2015-08-05 18:37:40329 "//chromecast/app",
330 "//content/public/app:both",
331 ]
slan0c9838b2015-08-05 18:37:40332}
333
334repack("cast_shell_pak") {
335 sources = [
336 "$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak",
337 "$root_gen_dir/blink/public/resources/blink_resources.pak",
338 "$root_gen_dir/chromecast/app/shell_resources.pak",
rockot97597152016-10-03 06:27:38339 "$root_gen_dir/chromecast/browser/cast_browser_resources.pak",
slan0c9838b2015-08-05 18:37:40340 "$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
341 "$root_gen_dir/content/app/strings/content_strings_en-US.pak",
342 "$root_gen_dir/content/content_resources.pak",
343 "$root_gen_dir/net/net_resources.pak",
344 "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
345 "$root_gen_dir/ui/resources/webui_resources.pak",
346 "$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
347 "$root_gen_dir/ui/strings/ui_strings_en-US.pak",
348 ]
349
slan0c9838b2015-08-05 18:37:40350 output = "$root_out_dir/assets/cast_shell.pak"
351
352 deps = [
353 "//chromecast/app:resources",
rockot97597152016-10-03 06:27:38354 "//chromecast/browser:resources",
slan0c9838b2015-08-05 18:37:40355 "//content:resources",
356 "//content/app/resources",
357 "//content/app/strings",
358 "//net:net_resources",
slan0c9838b2015-08-05 18:37:40359 "//third_party/WebKit/public:image_resources_grit",
agrieved7a71c882015-11-20 19:53:28360 "//third_party/WebKit/public:resources",
slan0c9838b2015-08-05 18:37:40361 "//ui/resources",
362 "//ui/strings",
363 ]
364
slan9ccf3592015-09-10 19:40:33365 if (chromecast_branding != "public") {
slan65a12682016-02-10 01:24:39366 sources += [ "$root_gen_dir/chromecast/internal/cast_shell_internal.pak" ]
slan9ccf3592015-09-10 19:40:33367
slan65a12682016-02-10 01:24:39368 deps += [ "//chromecast/internal:cast_shell_internal_pak" ]
slan0c9838b2015-08-05 18:37:40369 }
370}
slanca520532015-11-05 20:35:33371
slanca520532015-11-05 20:35:33372action("chromecast_locales_pak") {
373 script = "//chromecast/tools/build/chromecast_repack_locales.py"
374
375 # .pak resources in |grit_out_dir| with the same suffix are packed into a
376 # single resource and placed in |locales_dir|. The original .pak resources
377 # are generated by this target's dependencies.
378 grit_out_dir = "$root_gen_dir/chromecast_strings"
379 locales_dir = "$root_out_dir/chromecast_locales"
380
381 sources = []
382 outputs = []
383
384 # |locales| is an array of suffixes declared in //build/config/locals.gni.
385 foreach(locale, locales) {
386 sources += [ "$grit_out_dir/chromecast_settings_$locale.pak" ]
387 outputs += [ "$locales_dir/$locale.pak" ]
388 }
389 deps = [
390 "//chromecast/app:chromecast_settings",
391 ]
392
gfhuangb15dff22016-09-07 02:21:59393 # Include string and other localized resources for internal builds.
slanca520532015-11-05 20:35:33394 if (chromecast_branding != "public") {
395 foreach(locale, locales) {
396 sources += [ "$grit_out_dir/app_strings_$locale.pak" ]
gfhuang79ceb4f2016-09-07 06:43:03397 if (enable_chromecast_webui) {
398 sources += [ "$grit_out_dir/webui_localized_$locale.pak" ]
399 }
slanca520532015-11-05 20:35:33400 }
401 deps += [ "//chromecast/internal/webui:chromecast_app_strings" ]
gfhuang79ceb4f2016-09-07 06:43:03402 if (enable_chromecast_webui) {
403 deps += [ "//chromecast/internal/webui:chromecast_webui_localized" ]
404 }
slanca520532015-11-05 20:35:33405 }
406
407 # This script only accepts the following values for branding:
408 assert(chromecast_branding == "public" || chromecast_branding == "internal" ||
409 chromecast_branding == "google")
410 args = [
mbjorgeb64c791f2016-09-20 18:04:56411 "-b",
412 "$chromecast_branding",
413 "-g",
414 rebase_path("$root_gen_dir/chromecast_strings"),
415 "-x",
416 rebase_path("$root_out_dir/chromecast_locales"),
417 ]
gfhuang79ceb4f2016-09-07 06:43:03418 if (enable_chromecast_webui) {
419 args += [ "-u" ]
420 }
421 args += locales
slanca520532015-11-05 20:35:33422}
slan074ec342016-01-29 23:52:26423
slan7d09f9e2016-04-08 15:47:02424buildflag_header("chromecast_features") {
425 header = "chromecast_features.h"
slana0671e42016-09-01 13:40:19426 flags = [ "IS_CAST_AUDIO_ONLY=$is_cast_audio_only" ]
slan7d09f9e2016-04-08 15:47:02427}
428
slan074ec342016-01-29 23:52:26429if (is_android) {
slan074ec342016-01-29 23:52:26430 android_assets("cast_shell_apk_assets") {
431 assert(v8_use_external_startup_data)
432
433 sources = [
434 "$root_out_dir/assets/cast_shell.pak",
435 ]
436
437 deps = [
438 ":cast_shell_pak",
439 "//third_party/icu:icu_assets",
440 "//v8:v8_external_startup_data_assets",
441 ]
sanfin52f72e82016-04-13 22:36:05442 disable_compression = true
slan074ec342016-01-29 23:52:26443 }
444
slan074ec342016-01-29 23:52:26445 android_apk("cast_shell_apk") {
446 apk_name = "CastShell"
447 android_manifest = "$root_gen_dir/cast_shell_manifest/AndroidManifest.xml"
448 android_manifest_dep = "//chromecast/browser/android:cast_shell_manifest"
yucliu5c1cc482016-12-01 20:35:10449
450 shared_libraries = [ "//chromecast/android:libcast_shell_android" ]
451
slan074ec342016-01-29 23:52:26452 deps = [
453 ":cast_shell_apk_assets",
yucliu5c1cc482016-12-01 20:35:10454 "//base:base_java",
slan074ec342016-01-29 23:52:26455 "//chromecast/android:libcast_shell_android",
456 "//chromecast/browser/android:cast_shell_java",
457 ]
458 }
459}