summaryrefslogtreecommitdiffstats
path: root/chromecast/BUILD.gn
blob: 2d53f77788c5becac9f7e589d9064e67abcccf3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# 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/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")
}

if (use_playready) {
  config("playready_config") {
    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" ]

    if (use_alsa) {
      tests +=
          [ "//chromecast/media/cma/backend/alsa: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" ]
  }

  if (ozone_platform_egltest) {
    deps += [ "//ui/ozone/platform/egltest:eglplatform_shim_x11" ]
  }
}

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
}

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",
    ]
  }

  # 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",
    ]
  }
}