blob: 43030f0478fb4a7b94719a176f63f70eb6893060 [file] [log] [blame]
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/buildflag_header.gni")
import("//build/config/features.gni")
import("//build/config/locales.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//chromecast/build/tests/cast_test.gni")
import("//chromecast/chromecast.gni")
import("//media/media_options.gni")
import("//tools/grit/repack.gni")
import("//ui/ozone/ozone.gni")
import("//v8/gni/v8.gni")
if (is_android) {
import("//build/config/android/rules.gni")
}
config("playready_config") {
if (use_playready) {
defines = [ "PLAYREADY_CDM_AVAILABLE" ]
}
}
# A list of all public test() binaries. This is an organizational target that
# cannot be depended upon or built directly. Build cast_group_test_list instead.
cast_test_group("cast_tests") {
filters = []
tests = [
"//base:base_unittests",
"//chromecast/base:cast_base_unittests",
"//chromecast/base/component:cast_component_unittests",
"//chromecast/crypto:cast_crypto_unittests",
"//chromecast/system/reboot:cast_reboot_unittests",
"//content/test:content_unittests",
"//crypto:crypto_unittests",
"//media:media_unittests",
"//media/midi:midi_unittests",
"//net:net_unittests",
"//ppapi:ppapi_unittests",
"//sandbox/linux:sandbox_linux_unittests",
"//sql:sql_unittests",
"//third_party/cacheinvalidation:cacheinvalidation_unittests",
"//ui/base:ui_base_unittests",
]
if (!is_cast_audio_only) {
tests += [ "//gpu:gpu_unittests" ]
}
if (is_linux) {
tests += [ "//chromecast/crash:cast_crash_unittests" ]
}
if (!is_android && use_alsa) {
tests += [ "//chromecast/media/cma/backend/alsa:cast_alsa_cma_backend_unittests" ]
}
if (!is_android) {
tests += [
"//chromecast/app:cast_shell_unittests",
"//chromecast/browser:cast_shell_browser_test",
"//chromecast/media:cast_media_unittests",
"//ipc:ipc_tests",
"//jingle:jingle_unittests",
"//url:url_unittests",
]
cast_media_unittests_filter = {
test_name = "cast_media_unittests"
# --test-launcher-jobs=1 => so internal code can bind to port
args = [ "--test-launcher-jobs=1" ]
}
filters += [ cast_media_unittests_filter ]
cast_shell_browser_test_filter = {
test_name = "cast_shell_browser_test"
# --enable-local-file-accesses => to load sample media files
# --test-launcher-jobs=1 => so internal code can bind to port
args = [
"--no-sandbox",
"--enable-local-file-accesses",
"--enable-cma-media-pipeline",
"--ozone-platform=cast",
"--test-launcher-jobs=1",
]
if (!is_cast_desktop_build) {
args += [ "--use-gpu-in-tests" ]
}
}
filters += [ cast_shell_browser_test_filter ]
ipc_tests_filter = {
test_name = "ipc_tests"
# --test-launcher-jobs=1 => so internal code can bind to port
args = [ "--test-launcher-jobs=1" ]
}
filters += [ ipc_tests_filter ]
url_unittests_filter = {
test_name = "url_unittests"
if (target_os == "linux" && !is_cast_desktop_build) {
# DoAppendUTF8Invalid fails because of dcheck_always_on flag in Eng builds
gtest_excludes = [ "URLCanonTest.DoAppendUTF8Invalid" ]
}
}
filters += [ url_unittests_filter ]
}
base_unittests_filter = {
test_name = "base_unittests"
if (target_os == "linux" && !is_cast_desktop_build) {
# Disable ProcessMetricsTest.GetNumberOfThreads (b/15610509)
# Disable ProcessUtilTest.* (need to define OS_ANDROID)
# Disable StackContainer.BufferAlignment (don't support 16-byte alignment)
# Disable SystemMetrics2Test.GetSystemMemoryInfo (buffers>0 can't be guaranteed)
gtest_excludes = [
"ProcessMetricsTest.GetNumberOfThreads",
"ProcessUtilTest.*",
"StackContainer.BufferAlignment",
"SystemMetrics2Test.GetSystemMemoryInfo",
]
if (is_cast_audio_only) {
# Also disable TimeFormattingTest on audio-only builds, since we don't
# include the necessary info in icudtl.dat.
gtest_excludes += [ "TimeFormattingTest.*" ]
}
}
}
filters += [ base_unittests_filter ]
content_unittests_filter = {
test_name = "content_unittests"
if (target_os == "linux" && !is_cast_desktop_build) {
# DesktopCaptureDeviceTest.*: No capture device on Eureka
# Disable PepperGamepadHostTest.WaitForReply (pepper not supported on Eureka)
# Disable GpuDataManagerImplPrivateTest.SetGLStrings and
# RenderWidgetHostTest.Background because we disable the blacklist to enable WebGL (b/16142554)
gtest_excludes = [
"DOMStorageDatabaseTest.TestCanOpenAndReadWebCoreDatabase",
"DesktopCaptureDeviceTest.Capture",
"GamepadProviderTest.PollingAccess",
"GpuDataManagerImplPrivateTest.SetGLStrings",
"PepperGamepadHostTest.WaitForReply",
"RenderWidgetHostTest.Background",
]
}
}
filters += [ content_unittests_filter ]
media_unittests_filter = {
test_name = "media_unittests"
if (target_os == "linux" && !is_cast_desktop_build) {
# Disable VP9 related tests (b/18593324)
# PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM
# PipelineIntegrationTest.BasicPlayback_VideoOnly_VP9_WebM
# PipelineIntegrationTest.BasicPlayback_VP9*
# PipelineIntegrationTest.P444_VP9_WebM
# Disable VP8A tests (b/18593324)
# PipelineIntegrationTest.BasicPlayback_VP8A*
# Disable OpusAudioDecoderTest/AudioDecoderTest.ProduceAudioSamples/0 (unit
# test fails when Opus decoder uses fixed-point)
# Due to b/16456550, disable the following four test cases:
# AudioOutputControllerTest.PlayDivertSwitchDeviceRevertClose
# AudioOutputControllerTest.PlaySwitchDeviceClose
# AudioStreamHandlerTest.Play
# SoundsManagerTest.Play
# Disable AudioStreamHandlerTest.ConsecutivePlayRequests (b/16539293)
gtest_excludes = [
"AudioOutputControllerTest.PlayDivertSwitchDeviceRevertClose",
"AudioOutputControllerTest.PlaySwitchDeviceClose",
"AudioStreamHandlerTest.Play",
"AudioStreamHandlerTest.ConsecutivePlayRequests",
"PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM",
"PipelineIntegrationTest.BasicPlayback_VideoOnly_VP9_WebM",
"PipelineIntegrationTest.BasicPlayback_VP9*",
"PipelineIntegrationTest.P444_VP9_WebM",
"PipelineIntegrationTest.BasicPlayback_VP8A*",
"OpusAudioDecoderTest/AudioDecoderTest.ProduceAudioSamples/0",
"SoundsManagerTest.Play",
]
} else if (target_os == "android" || is_cast_desktop_build) {
# Disable PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM (not supported)
gtest_excludes =
[ "PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM" ]
}
}
filters += [ media_unittests_filter ]
net_unittests_filter = {
test_name = "net_unittests"
if (target_os == "linux" && !is_cast_desktop_build) {
# Run net_unittests first to avoid random failures due to slow python startup
# KeygenHandlerTest.SmokeTest and KeygenHandlerTest.ConcurrencyTest fail due to
# readonly certdb (b/8153161)
# URLRequestTestHTTP.GetTest_ManyCookies takes roughly 55s to run. Increase
# timeout to 90s from 45s to allow it to pass (b/19821476)
# ProxyScriptFetcherImplTest.HttpMimeType is flaking (b/19848784)
# Running a batch of net_unittests has high overhead. Run tests in batches of 25 to reduce number of batches (b/23156294).
gtest_excludes = [
"KeygenHandlerTest.SmokeTest",
"KeygenHandlerTest.ConcurrencyTest",
"ProxyScriptFetcherImplTest.HttpMimeType",
]
args = [
"--test-launcher-timeout=90000",
"--test-launcher-batch-limit=25",
]
} else if (is_cast_desktop_build || target_os == "android") {
# URLRequestTestHTTP.GetTest_ManyCookies takes roughly 55s to run. Increase
# timeout to 90s from 45s to allow it to pass (b/19821476) (b/29415636).
# CTLogVerifierTest.VerifiesValidConsistencyProofsFromReferenceGenerator
# times out occasionally, paricularly on the CQ bots; disable to reduce
# CQ flakiness (crbug/598406) (b/29415636).
# Running a batch of net_unittests has high overhead, so
# run tests in batches of 25 to reduce number of batches (b/23156294).
gtest_excludes = [ "CTLogVerifierTest.VerifiesValidConsistencyProofsFromReferenceGenerator" ]
args = [
"--test-launcher-timeout=90000",
"--test-launcher-batch-limit=25",
]
}
}
filters += [ net_unittests_filter ]
# TODO(mbjorge): net_unittests do not complete when run with sanitizers,
# (in particular, TSAN and UBSAN), resulting in build machines getting stuck
# for many hours. Disable them for now, since these are getting run on
# Chromium bots anyway. (internal b/31279943)
if (using_sanitizer) {
tests -= [ "//net:net_unittests" ]
filters -= [ net_unittests_filter ]
}
}
# Creates the build and run lists for all test targets.
cast_test_group_list("cast_test_lists") {
build_list_path = "$root_out_dir/tests/build_test_list.txt"
run_list_path = "$root_out_dir/tests/run_test_list.txt"
additional_options = [ "--ozone-platform=headless --test-launcher-bot-mode" ]
build_tests = true
test_groups = [ ":cast_tests" ]
if (chromecast_branding != "public") {
test_groups += [ "//chromecast/internal:internal_cast_tests" ]
}
}
if (is_android) {
cast_test_group("cast_junit_tests") {
test_type = "junit"
tests = [
"//base:base_junit_tests",
"//content/public/android:content_junit_tests",
"//net/android:net_junit_tests",
"//testing/android/junit:junit_unit_tests",
"//ui/android:ui_junit_tests",
]
}
cast_test_group_list("cast_junit_test_lists") {
test_type = "junit"
build_list_path = "$root_out_dir/junit/build_junit_test_list.txt"
run_list_path = "$root_out_dir/junit/run_junit_test_list.txt"
build_tests = true
test_groups = [ ":cast_junit_tests" ]
}
}
source_set("cast_shell_common") {
deps = [
":cast_shell_pak",
":chromecast_locales_pak",
"//chromecast/app",
"//chromecast/browser",
"//chromecast/common",
"//chromecast/common/media",
"//chromecast/renderer",
]
}
source_set("cast_shell_media") {
deps = [
"//chromecast/browser/media",
"//chromecast/common/media",
"//chromecast/renderer/media",
]
}
executable("cast_shell") {
sources = [
"app/cast_main.cc",
]
deps = [
":cast_shell_common",
":cast_shell_media",
"//build/config/sanitizers:deps",
"//chromecast/app",
"//content/public/app:both",
]
if (chromecast_branding != "public") {
deps += [ "//chromecast/internal:cast_shell_internal" ]
}
}
repack("cast_shell_pak") {
sources = [
"$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak",
"$root_gen_dir/blink/public/resources/blink_resources.pak",
"$root_gen_dir/chromecast/app/shell_resources.pak",
"$root_gen_dir/chromecast/browser/cast_browser_resources.pak",
"$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
"$root_gen_dir/content/app/strings/content_strings_en-US.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
"$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
"$root_gen_dir/ui/strings/ui_strings_en-US.pak",
]
output = "$root_out_dir/assets/cast_shell.pak"
deps = [
"//chromecast/app:resources",
"//chromecast/browser:resources",
"//content:resources",
"//content/app/resources",
"//content/app/strings",
"//net:net_resources",
"//third_party/WebKit/public:image_resources_grit",
"//third_party/WebKit/public:resources",
"//ui/resources",
"//ui/strings",
]
if (chromecast_branding != "public") {
sources += [ "$root_gen_dir/chromecast/internal/cast_shell_internal.pak" ]
deps += [ "//chromecast/internal:cast_shell_internal_pak" ]
}
}
action("chromecast_locales_pak") {
script = "//chromecast/tools/build/chromecast_repack_locales.py"
# .pak resources in |grit_out_dir| with the same suffix are packed into a
# single resource and placed in |locales_dir|. The original .pak resources
# are generated by this target's dependencies.
grit_out_dir = "$root_gen_dir/chromecast_strings"
locales_dir = "$root_out_dir/chromecast_locales"
sources = []
outputs = []
# |locales| is an array of suffixes declared in //build/config/locals.gni.
foreach(locale, locales) {
sources += [ "$grit_out_dir/chromecast_settings_$locale.pak" ]
outputs += [ "$locales_dir/$locale.pak" ]
}
deps = [
"//chromecast/app:chromecast_settings",
]
# Include string and other localized resources for internal builds.
if (chromecast_branding != "public") {
foreach(locale, locales) {
sources += [ "$grit_out_dir/app_strings_$locale.pak" ]
if (enable_chromecast_webui) {
sources += [ "$grit_out_dir/webui_localized_$locale.pak" ]
}
}
deps += [ "//chromecast/internal/webui:chromecast_app_strings" ]
if (enable_chromecast_webui) {
deps += [ "//chromecast/internal/webui:chromecast_webui_localized" ]
}
}
# This script only accepts the following values for branding:
assert(chromecast_branding == "public" || chromecast_branding == "internal" ||
chromecast_branding == "google")
args = [
"-b",
"$chromecast_branding",
"-g",
rebase_path("$root_gen_dir/chromecast_strings"),
"-x",
rebase_path("$root_out_dir/chromecast_locales"),
]
if (enable_chromecast_webui) {
args += [ "-u" ]
}
args += locales
}
buildflag_header("chromecast_features") {
header = "chromecast_features.h"
flags = [ "IS_CAST_AUDIO_ONLY=$is_cast_audio_only" ]
}
if (is_android) {
android_assets("cast_shell_apk_assets") {
assert(v8_use_external_startup_data)
sources = [
"$root_out_dir/assets/cast_shell.pak",
]
deps = [
":cast_shell_pak",
"//third_party/icu:icu_assets",
"//v8:v8_external_startup_data_assets",
]
disable_compression = true
}
android_apk("cast_shell_apk") {
apk_name = "CastShell"
android_manifest = "$root_gen_dir/cast_shell_manifest/AndroidManifest.xml"
android_manifest_dep = "//chromecast/browser/android:cast_shell_manifest"
deps = [
":cast_shell_apk_assets",
"//chromecast/android:libcast_shell_android",
"//chromecast/browser/android:cast_shell_java",
]
}
}