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

media / test / BUILD.gn [blame]

# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//media/media_options.gni")
import("//testing/libfuzzer/fuzzer_test.gni")

if (is_ios) {
  import("//build/config/ios/bundle_data_from_filelist.gni")
}

source_set("run_all_unittests") {
  testonly = true
  sources = [ "run_all_unittests.cc" ]
  configs += [ "//media:media_config" ]
  deps = [
    "//base",
    "//base/test:test_support",
    "//media:test_support",
    "//mojo/core/embedder",
  ]

  if (is_android) {
    deps += [ "//ui/gl" ]
  }
}

source_set("pipeline_integration_test_base") {
  testonly = true

  if (media_use_ffmpeg) {
    sources = [
      "fake_encrypted_media.cc",
      "fake_encrypted_media.h",
      "pipeline_integration_test_base.cc",
      "pipeline_integration_test_base.h",
      "test_media_source.cc",
      "test_media_source.h",
    ]

    configs += [ "//media:media_config" ]

    deps = [
      "//base",
      "//base/test:test_support",
      "//media:media_buildflags",
      "//media:test_support",
      "//testing/gmock",
      "//testing/gtest",
      "//url",
    ]
  }
}

source_set("pipeline_integration_tests") {
  testonly = true

  if (media_use_ffmpeg) {
    sources = [ "pipeline_integration_test.cc" ]

    deps = [
      ":pipeline_integration_test_base",
      "//base",
      "//base/test:test_support",
      "//media:media_buildflags",
      "//media:test_support",
      "//media/mojo/clients",

      # Needed for the opus_config
      "//testing/gmock",
      "//third_party/opus",
      "//url",
    ]
  }
}

source_set("pipeline_integration_perftests") {
  testonly = true

  if (media_use_ffmpeg) {
    sources = [ "pipeline_integration_perftest.cc" ]

    deps = [
      ":pipeline_integration_test_base",
      "//media:test_support",
      "//testing/gmock",
      "//testing/gtest",
      "//testing/perf",
    ]
  }
}

# Keep these aligned with FuzzerVariant in pipeline_integration_fuzzertest.c
pipeline_integration_fuzzer_variants = [
  "SRC",  # A SRC= version (not MSE) pipeline fuzzer test

  # MSE pipeline fuzzer test variants. Note, while it would be nice to have one
  # generic MSE fuzzer, we use distinct fuzzers corresponding 1:1 to a set of
  # mimetype+codec strings for now because:
  # a) the SourceBuffer implementation must be constructed to expect a
  #    particular bytestream type and (set of) codec(s); it does not
  #    auto-detect those from the appended media, and
  # b) maintaining the association of a (mutated) corpus item with the same MSE
  #    SourceBuffer configuration requires associating that item with the same
  #    mimetype+codec string. The benefits are simpler fuzzers and the ability
  #    to slice per-fuzzer coverage stats. The costs include more fuzzers, risk
  #    of new bytestream types or codec fuzzing gaps, and more potential
  #    duplicate bugs from different fuzzers for common issues exposed across
  #    mimetype+codec string variants.
  "WEBM_OPUS",
  "WEBM_VORBIS",
  "WEBM_VP8",
  "WEBM_VP9",
  "WEBM_OPUS_VP9",
  "MP4_FLAC",
  "MP4_OPUS",
  "MP3",

  # See below for additional variants depending on build configuration.
]

if (enable_av1_decoder) {
  pipeline_integration_fuzzer_variants += [ "MP4_AV1" ]
}

if (proprietary_codecs) {
  pipeline_integration_fuzzer_variants += [
    "ADTS",
    "MP4_AACLC",
    "MP4_AACSBR",

    # Though neither StreamParserFactory, MP4StreamParser, nor
    # SourceBufferState::Init differentiate kinds of AVC, we use "AVC1" here to
    # retain corpus associated with this fuzzer target name.
    "MP4_AVC1",
    "MP4_AACLC_AVC",
  ]
  if (enable_mse_mpeg2ts_stream_parser) {
    pipeline_integration_fuzzer_variants += [
      "MP2T_AACLC",
      "MP2T_AACSBR",
      "MP2T_AVC",
      "MP2T_MP3",
      "MP2T_AACLC_AVC",
    ]
  }
}

foreach(variant, pipeline_integration_fuzzer_variants) {
  if (variant == "SRC") {
    test_name = "media_pipeline_integration_fuzzer"
  } else {
    test_name = "mediasource_${variant}_pipeline_integration_fuzzer"
  }

  fuzzer_test(test_name) {
    sources = [ "pipeline_integration_fuzzertest.cc" ]
    deps = [
      ":pipeline_integration_test_base",
      "//base",
      "//base/test:test_support",
      "//media:test_support",
      "//testing/gmock",
      "//testing/gtest",
      "//ui/gfx:test_support",
    ]

    defines = [ "PIPELINE_FUZZER_VARIANT=${variant}" ]

    seed_corpus = "//media/test/data/"
  }
}

if (is_ios) {
  bundle_data_from_filelist("media_bundle_data") {
    testonly = true
    filelist_name = "media_bundle_data.filelist"
  }
}