chromium/components/optimization_guide/content/browser/BUILD.gn

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

if (is_android) {
  import("//build/config/android/rules.gni")
}
import("//components/optimization_guide/features.gni")

static_library("browser") {
  sources = [
    "page_text_dump_result.cc",
    "page_text_dump_result.h",
    "page_text_observer.cc",
    "page_text_observer.h",
  ]

  public_deps = [
    "//base",
    "//components/optimization_guide:machine_learning_tflite_buildflags",
    "//components/optimization_guide:optimization_guide_buildflags",
    "//components/optimization_guide/content/mojom:mojo_interfaces",
    "//components/optimization_guide/core",
    "//components/optimization_guide/proto:optimization_guide_proto",
    "//content/public/browser",
    "//services/metrics/public/cpp:metrics_cpp",
    "//services/network/public/cpp",
  ]
  if (build_with_tflite_lib) {
    public_deps += [
      "//components/optimization_guide/core:machine_learning",
      "//third_party/tflite",
      "//third_party/tflite:tflite_public_headers",
      "//third_party/tflite_support",
      "//third_party/tflite_support:tflite_support_proto",
    ]
  }
  configs += [ "//build/config/compiler:wexit_time_destructors" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "page_text_dump_result_unittest.cc",
    "page_text_observer_unittest.cc",
  ]

  deps = [
    ":browser",
    "//components/optimization_guide/core:test_support",
    "//content/test:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]
  if (build_with_tflite_lib) {
    deps += [
      "//third_party/tflite",
      "//third_party/tflite:tflite_public_headers",
      "//third_party/tflite_support",
      "//third_party/tflite_support:tflite_support_proto",
    ]
  }
}