BUILD.gn 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. # Copyright 2014 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. import("//media/media_options.gni")
  5. import("//testing/libfuzzer/fuzzer_test.gni")
  6. source_set("run_all_unittests") {
  7. testonly = true
  8. sources = [ "run_all_unittests.cc" ]
  9. configs += [ "//media:media_config" ]
  10. deps = [
  11. "//base",
  12. "//base/test:test_support",
  13. "//media:test_support",
  14. "//mojo/core/embedder",
  15. ]
  16. if (is_android) {
  17. deps += [ "//ui/gl" ]
  18. }
  19. }
  20. source_set("pipeline_integration_test_base") {
  21. testonly = true
  22. if (media_use_ffmpeg) {
  23. sources = [
  24. "fake_encrypted_media.cc",
  25. "fake_encrypted_media.h",
  26. "pipeline_integration_test_base.cc",
  27. "pipeline_integration_test_base.h",
  28. "test_media_source.cc",
  29. "test_media_source.h",
  30. ]
  31. configs += [ "//media:media_config" ]
  32. deps = [
  33. "//base",
  34. "//base/test:test_support",
  35. "//media:media_buildflags",
  36. "//media:test_support",
  37. "//testing/gmock",
  38. "//testing/gtest",
  39. "//url",
  40. ]
  41. }
  42. }
  43. source_set("pipeline_integration_tests") {
  44. testonly = true
  45. # Even if FFmpeg is enabled on Android we don't want these.
  46. # TODO(watk): Refactor tests that could be made to run on Android. See
  47. # http://crbug.com/570762
  48. if (media_use_ffmpeg && !is_android) {
  49. sources = [ "pipeline_integration_test.cc" ]
  50. deps = [
  51. ":pipeline_integration_test_base",
  52. "//base",
  53. "//base/test:test_support",
  54. "//media:media_buildflags",
  55. "//media:test_support",
  56. "//media/mojo/clients",
  57. # Needed for the opus_config
  58. "//third_party/opus",
  59. "//url",
  60. # TODO(dalecurtis): Required since the gmock header is included in the
  61. # header for pipeline_integration_test_base.h. This should be moved
  62. # into the .cc file to avoid the extra dependency here.
  63. "//testing/gmock",
  64. ]
  65. }
  66. }
  67. source_set("pipeline_integration_perftests") {
  68. testonly = true
  69. if (media_use_ffmpeg) {
  70. sources = [ "pipeline_integration_perftest.cc" ]
  71. deps = [
  72. ":pipeline_integration_test_base",
  73. "//media:test_support",
  74. "//testing/gtest",
  75. "//testing/perf",
  76. # TODO(dalecurtis): Required since the gmock header is included in the
  77. # header for pipeline_integration_test_base.h. This should be moved into
  78. # the .cc file to avoid the extra dependency here.
  79. "//testing/gmock",
  80. ]
  81. }
  82. }
  83. # Keep these aligned with FuzzerVariant in pipeline_integration_fuzzertest.c
  84. pipeline_integration_fuzzer_variants = [
  85. "SRC", # A SRC= version (not MSE) pipeline fuzzer test
  86. # MSE pipeline fuzzer test variants. Note, while it would be nice to have one
  87. # generic MSE fuzzer, we use distinct fuzzers corresponding 1:1 to a set of
  88. # mimetype+codec strings for now because:
  89. # a) the SourceBuffer implementation must be constructed to expect a
  90. # particular bytestream type and (set of) codec(s); it does not
  91. # auto-detect those from the appended media, and
  92. # b) maintaining the association of a (mutated) corpus item with the same MSE
  93. # SourceBuffer configuration requires associating that item with the same
  94. # mimetype+codec string. The benefits are simpler fuzzers and the ability
  95. # to slice per-fuzzer coverage stats. The costs include more fuzzers, risk
  96. # of new bytestream types or codec fuzzing gaps, and more potential
  97. # duplicate bugs from different fuzzers for common issues exposed across
  98. # mimetype+codec string variants.
  99. "WEBM_OPUS",
  100. "WEBM_VORBIS",
  101. "WEBM_VP8",
  102. "WEBM_VP9",
  103. "WEBM_OPUS_VP9",
  104. "MP4_FLAC",
  105. "MP4_OPUS",
  106. "MP3",
  107. # See below for additional variants depending on build configuration.
  108. ]
  109. if (enable_av1_decoder) {
  110. pipeline_integration_fuzzer_variants += [ "MP4_AV1" ]
  111. }
  112. if (proprietary_codecs) {
  113. pipeline_integration_fuzzer_variants += [
  114. "ADTS",
  115. "MP4_AACLC",
  116. "MP4_AACSBR",
  117. # Though neither StreamParserFactory, MP4StreamParser, nor
  118. # SourceBufferState::Init differentiate kinds of AVC, we use "AVC1" here to
  119. # retain corpus associated with this fuzzer target name.
  120. "MP4_AVC1",
  121. "MP4_AACLC_AVC",
  122. ]
  123. if (enable_mse_mpeg2ts_stream_parser) {
  124. pipeline_integration_fuzzer_variants += [
  125. "MP2T_AACLC",
  126. "MP2T_AACSBR",
  127. "MP2T_AVC",
  128. "MP2T_MP3",
  129. "MP2T_AACLC_AVC",
  130. ]
  131. }
  132. }
  133. foreach(variant, pipeline_integration_fuzzer_variants) {
  134. if (variant == "SRC") {
  135. test_name = "media_pipeline_integration_fuzzer"
  136. } else {
  137. test_name = "mediasource_${variant}_pipeline_integration_fuzzer"
  138. }
  139. fuzzer_test(test_name) {
  140. sources = [ "pipeline_integration_fuzzertest.cc" ]
  141. deps = [
  142. ":pipeline_integration_test_base",
  143. "//base",
  144. "//base/test:test_support",
  145. "//media",
  146. # TODO(dalecurtis): Required since the gmock header is included in the
  147. # header for pipeline_integration_test_base.h. This should be
  148. # moved into the .cc file to avoid the extra dependency here.
  149. "//testing/gmock",
  150. # TODO(https://crbug.com/1039559): Required for inclusion of
  151. # gtest-internal-inl.h.
  152. "//testing/gtest",
  153. "//ui/gfx:test_support",
  154. ]
  155. defines = [ "PIPELINE_FUZZER_VARIANT=${variant}" ]
  156. seed_corpus = "//media/test/data/"
  157. }
  158. }