chromium/chrome/services/speech/BUILD.gn

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

import("//build/config/chromeos/ui_mode.gni")
import("//chrome/services/speech/buildflags/buildflags.gni")

assert(enable_speech_service)

source_set("lib") {
  sources = [
    "audio_source_consumer.h",
    "audio_source_fetcher_impl.cc",
    "audio_source_fetcher_impl.h",
    "soda_speech_recognizer_impl.cc",
    "soda_speech_recognizer_impl.h",
    "speech_recognition_recognizer_impl.cc",
    "speech_recognition_recognizer_impl.h",
    "speech_recognition_service_impl.cc",
    "speech_recognition_service_impl.h",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  public_deps = [
    "//media/mojo/mojom",
    "//mojo/public/cpp/bindings",
    "//mojo/public/mojom/base",
  ]

  deps = [
    "//base",
    "//build:chromeos_buildflags",
    "//chrome/services/speech/soda",
    "//chrome/services/speech/soda:soda_api_proto",
    "//components/soda:constants",
    "//components/speech",
    "//content/public/browser:proto",
    "//google_apis",
    "//media/mojo/common",
    "//mojo/public/cpp/bindings",
    "//net",
    "//services/audio/public/cpp",
  ]

  if (is_chromeos_ash) {
    sources += [
      "cros_speech_recognition_recognizer_impl.cc",
      "cros_speech_recognition_recognizer_impl.h",
    ]
    deps += [
      "//chromeos/services/machine_learning/public/mojom",
      "//components/soda:soda",
    ]
  }
}

source_set("unit_tests") {
  testonly = true

  sources = [ "soda_speech_recognizer_impl_unittest.cc" ]
  deps = [
    ":lib",
    "//base",
    "//base/test:test_support",
    "//media/mojo/common",
    "//media/mojo/mojom:web_speech_recognition",
    "//mojo/public/cpp/bindings",
    "//testing/gtest",
  ]

  if (is_chromeos_ash) {
    sources += [
      "audio_source_fetcher_unittest.cc",
      "cros_speech_recognition_recognizer_impl_test.cc",
    ]

    deps += [
      "//chromeos/services/machine_learning/public/mojom",
      "//services/audio/public/cpp:test_support",
    ]
  }
}