chromium/chromeos/services/tts/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("//tools/generate_library_loader/generate_library_loader.gni")

source_set("tts") {
  sources = [
    "constants.cc",
    "constants.h",
    "google_tts_stream.cc",
    "google_tts_stream.h",
    "playback_tts_stream.cc",
    "playback_tts_stream.h",
    "tts_player.cc",
    "tts_player.h",
    "tts_service.cc",
    "tts_service.h",
  ]

  deps = [
    ":libchrometts",
    "//base",
    "//chromeos/services/tts/public/mojom",
    "//services/audio/public/cpp:cpp",
  ]
}

source_set("sandbox_hook") {
  sources = [
    "tts_sandbox_hook.cc",
    "tts_sandbox_hook.h",
  ]

  deps = [
    ":libchrometts",
    ":tts",
    "//base",
    "//sandbox/linux:sandbox_services",
    "//sandbox/policy",
  ]
}

generate_library_loader("libchrometts") {
  name = "LibChromeTtsLoader"
  output_h = "libchrometts.h"
  output_cc = "libchrometts_loader.cc"
  header = "<chrome_tts.h>"
  bundled_header = "\"chromeos/services/tts/chrome_tts.h\""

  functions = [
    "GoogleTtsSetLogger",
    "GoogleTtsPreSandboxInit",
    "GoogleTtsInit",
    "GoogleTtsShutdown",
    "GoogleTtsInstallVoice",
    "GoogleTtsInitBuffered",
    "GoogleTtsReadBuffered",
    "GoogleTtsGetTimepointsCount",
    "GoogleTtsGetTimepointsTimeInSecsAtIndex",
    "GoogleTtsGetTimepointsCharIndexAtIndex",
    "GoogleTtsGetFramesInAudioBuffer",
  ]
}

source_set("services_unittests") {
  testonly = true
  deps = [
    ":tts",
    "//base",
    "//base/test:test_support",
    "//chromeos/services/tts/public/mojom",
    "//mojo/public/cpp/bindings",
    "//testing/gtest",
  ]
  sources = [
    "tts_player_unittest.cc",
    "tts_service_unittest.cc",
    "tts_test_utils.cc",
    "tts_test_utils.h",
  ]
}