blob: e8152618f0750c26f228623d76ca76e5944192e8 [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/ui.gni")
import("//build_overrides/v8.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")
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") {
tests = [
"//base:base_unittests",
"//chromecast/base:cast_base_unittests",
"//chromecast/base/component:cast_component_unittests",
"//chromecast/crypto:cast_crypto_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",
"//sync:sync_unit_tests",
"//third_party/cacheinvalidation:cacheinvalidation_unittests",
"//ui/base:ui_base_unittests",
]
if (is_linux) {
tests += [ "//chromecast/crash:cast_crash_unittests" ]
}
filters = []
# Apply filters to embedded linux devices.
if (target_os == "linux" && !is_cast_desktop_build) {
filters += [
# 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).
"net_unittests --gtest_filter=-KeygenHandlerTest.SmokeTest:KeygenHandlerTest.ConcurrencyTest:ProxyScriptFetcherImplTest.HttpMimeType --test-launcher-timeout=90000 --test-launcher-batch-limit=25",
# 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)
"base_unittests --gtest_filter=-ProcessMetricsTest.GetNumberOfThreads:ProcessUtilTest.*:StackContainer.BufferAlignment:SystemMetrics2Test.GetSystemMemoryInfo",
# 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)
"content_unittests --gtest_filter=-DOMStorageDatabaseTest.TestCanOpenAndReadWebCoreDatabase:DesktopCaptureDeviceTest.Capture:GamepadProviderTest.PollingAccess:GpuDataManagerImplPrivateTest.SetGLStrings:PepperGamepadHostTest.WaitForReply:RenderWidgetHostTest.Background",
# 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)
"media_unittests --gtest_filter=-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",
"sync_unit_tests --gtest_filter=-SyncHttpBridgeTest.*",
# DoAppendUTF8Invalid fails because of dcheck_always_on flag in Eng builds
"url_unittests --gtest_filter=-URLCanonTest.DoAppendUTF8Invalid",
]
} else if (is_cast_desktop_build || target_os == "android") {
filters += [
# Disable PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM (not supported)
"media_unittests --gtest_filter=-PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM",
]
}
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",
]
# --enable-local-file-accesses => to load sample media files
# --test-launcher-jobs=1 => so internal code can bind to port
filters += [
"cast_shell_browser_test --no-sandbox --enable-local-file-accesses --enable-cma-media-pipeline --ozone-platform=cast --test-launcher-jobs=1",
"cast_media_unittests --test-launcher-jobs=1",
"ipc_tests --test-launcher-jobs=1",
]
if (use_alsa) {
tests += [ "//chromecast/media/cma/backend/alsa:cast_alsa_cma_backend_unittests" ]
}
}
if (!disable_display) {
tests += [ "//gpu:gpu_unittests" ]
}
}
# 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" ]
build_tests = true
test_groups = [ ":cast_tests" ]
if (chromecast_branding != "public") {
test_groups += [ "//chromecast/internal:internal_cast_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/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",
"//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" ]
}
}
# GYP target: chromecast_locales.gyp:chromecast_locales_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 resources for internal builds.
if (chromecast_branding != "public") {
foreach(locale, locales) {
sources += [ "$grit_out_dir/app_strings_$locale.pak" ]
}
deps += [ "//chromecast/internal/webui:chromecast_app_strings" ]
}
# 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"),
] + locales
}
buildflag_header("chromecast_features") {
header = "chromecast_features.h"
flags = [ "DISABLE_DISPLAY=$disable_display" ]
}
if (is_android) {
# GYP target: chromecast.gyp:cast_shell_icudata
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
}
# GYP target: chromecast.gyp:cast_shell_apk
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",
]
}
}