chromium/chrome/browser/chromeos/extensions/telemetry/api/routines/BUILD.gn

# Copyright 2023 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")

source_set("routines") {
  sources = [
    "diagnostic_routine.cc",
    "diagnostic_routine.h",
    "diagnostic_routine_converters.cc",
    "diagnostic_routine_converters.h",
    "diagnostic_routine_info.h",
    "diagnostic_routine_observation.cc",
    "diagnostic_routine_observation.h",
    "remote_diagnostic_routines_service_strategy.cc",
    "remote_diagnostic_routines_service_strategy.h",
  ]

  deps = [
    "//base",
    "//chrome/common/chromeos/extensions/api",
    "//chromeos/crosapi/mojom",
    "//content/public/browser",
    "//extensions/common",
    "//mojo/public/cpp/bindings",
  ]

  public_deps = [ "//extensions/browser" ]

  if (is_chromeos_ash) {
    deps += [ "//chromeos/ash/components/telemetry_extension/routines" ]
  }

  if (is_chromeos_lacros) {
    deps += [ "//chromeos/lacros" ]
  }
}

source_set("test_support") {
  testonly = true
  sources = [
    "fake_diagnostic_routine_control.cc",
    "fake_diagnostic_routine_control.h",
    "fake_diagnostic_routines_service.cc",
    "fake_diagnostic_routines_service.h",
  ]

  deps = [ "//base/test:test_support" ]

  public_deps = [
    "//chromeos/crosapi/mojom",
    "//mojo/public/cpp/bindings",
  ]

  if (is_chromeos_ash) {
    sources += [
      "fake_diagnostic_routines_service_factory.cc",
      "fake_diagnostic_routines_service_factory.h",
    ]

    public_deps += [ "//chromeos/ash/components/telemetry_extension/routines" ]
  }
}

source_set("routine_manager") {
  sources = [
    "diagnostic_routine_manager.cc",
    "diagnostic_routine_manager.h",
  ]

  deps = [
    ":routines",
    "//base",
    "//chrome/browser/chromeos/extensions/telemetry/api/common",
    "//chrome/browser/chromeos/extensions/telemetry/api/common:util",
    "//chrome/common/chromeos/extensions/api",
    "//chromeos/crosapi/mojom",
    "//content/public/browser",
  ]

  public_deps = [
    "//extensions/browser",
    "//extensions/common",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "diagnostic_routine_converters_unittest.cc",
    "diagnostic_routine_manager_unittest.cc",
  ]

  deps = [
    ":routine_manager",
    ":routines",
    ":test_support",
    "//chrome/browser/ui",
    "//chrome/browser/ui/tabs:tab_enums",
    "//chrome/common/chromeos/extensions/api",
    "//chrome/test:test_support",
    "//chromeos/crosapi/mojom",
    "//extensions:test_support",
    "//extensions/common",
    "//net:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]

  if (is_chromeos_ash) {
    deps += [
      "//chrome/common/chromeos/extensions",
      "//chromeos/ash/components/telemetry_extension/routines",
    ]
  }

  if (is_chromeos_lacros) {
    deps += [ "//chromeos/lacros" ]
  }
}

source_set("browser_tests") {
  testonly = true
  defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
  sources = [ "diagnostic_routine_observation_browsertest.cc" ]

  deps = [
    ":routines",
    "//base",
    "//chrome/browser/chromeos/extensions/telemetry/api/common:test_support",
    "//chrome/browser/profiles:profile",
    "//chrome/common/chromeos/extensions/api",
    "//chrome/test:test_support_ui",
    "//chromeos/crosapi/mojom",
    "//extensions/common",
    "//mojo/public/cpp/bindings",
    "//testing/gtest",
  ]

  data = [ "//chrome/test/data" ]
}