chromium/chrome/browser/chromeos/mahi/BUILD.gn

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

assert(is_chromeos)

static_library("mahi") {
  sources = [
    "mahi_browser_client_impl.cc",
    "mahi_browser_client_impl.h",
    "mahi_browser_util.cc",
    "mahi_browser_util.h",
    "mahi_content_extraction_delegate.cc",
    "mahi_content_extraction_delegate.h",
    "mahi_tab_helper.cc",
    "mahi_tab_helper.h",
    "mahi_web_contents_manager.cc",
    "mahi_web_contents_manager.h",
  ]

  public_deps = [ "//chrome/browser:browser_public_dependencies" ]

  deps = [
    "//base",
    "//build:chromeos_buildflags",
    "//chrome/browser/favicon",
    "//chrome/browser/screen_ai:screen_ai_service_router_factory",
    "//chromeos/components/mahi/public/cpp",
    "//chromeos/components/mahi/public/mojom",
    "//chromeos/constants",
    "//chromeos/crosapi/mojom",
    "//components/pdf/browser",
    "//components/pdf/common:constants",
    "//components/prefs",
    "//content/public/browser",
    "//mojo/public/cpp/bindings",
    "//pdf:features",
    "//services/metrics/public/cpp:metrics_cpp",
    "//services/screen_ai/public/mojom",
    "//ui/accessibility:ax_base",
    "//ui/aura",
    "//ui/gfx",
    "//url",
  ]

  if (is_chromeos_ash) {
    deps += [
      "//ash",
      "//ash/constants",
      "//chrome/browser/ash/mahi",
    ]
  }

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

source_set("unit_tests") {
  testonly = true

  sources = [ "mahi_tab_helper_unittest.cc" ]

  deps = [
    ":mahi",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//chrome/browser/chromeos/mahi/test:test_support",
    "//chrome/browser/ui",
    "//chrome/test:test_support",
    "//chromeos/constants",
    "//testing/gmock",
    "//testing/gtest",
  ]

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

source_set("browser_tests") {
  testonly = true

  defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]

  sources = [ "mahi_web_contents_manager_browsertest.cc" ]

  deps = [
    ":mahi",
    "//base",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//chrome/browser/chromeos/mahi/test:test_support",
    "//chrome/browser/ui",
    "//chrome/test:test_support_ui",
    "//chromeos/components/mahi/public/cpp",
    "//chromeos/constants",
    "//chromeos/crosapi/mojom",
    "//content/public/browser",
    "//content/test:test_support",
    "//mojo/public/cpp/bindings",
    "//net:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//ui/base",
    "//ui/gfx",
    "//url",
  ]

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