chromium/components/segmentation_platform/embedder/default_model/BUILD.gn

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

import("//components/compose/features.gni")

static_library("default_model") {
  sources = [
    "android_home_module_ranker.cc",
    "android_home_module_ranker.h",
    "contextual_page_actions_model.cc",
    "contextual_page_actions_model.h",
    "cross_device_user_segment.cc",
    "cross_device_user_segment.h",
    "database_api_clients.cc",
    "database_api_clients.h",
    "device_switcher_model.cc",
    "device_switcher_model.h",
    "device_switcher_result_dispatcher.cc",
    "device_switcher_result_dispatcher.h",
    "feed_user_segment.cc",
    "feed_user_segment.h",
    "ios_module_ranker.cc",
    "ios_module_ranker.h",
    "low_user_engagement_model.cc",
    "low_user_engagement_model.h",
    "metrics_clustering.cc",
    "metrics_clustering.h",
    "most_visited_tiles_user.cc",
    "most_visited_tiles_user.h",
    "optimization_target_segmentation_dummy.cc",
    "optimization_target_segmentation_dummy.h",
    "password_manager_user_segment.cc",
    "password_manager_user_segment.h",
    "resume_heavy_user_model.cc",
    "resume_heavy_user_model.h",
    "search_user_model.cc",
    "search_user_model.h",
    "shopping_user_model.cc",
    "shopping_user_model.h",
    "tab_resumption_ranker.cc",
    "tab_resumption_ranker.h",
    "url_visit_resumption_ranker.cc",
    "url_visit_resumption_ranker.h",
  ]
  deps = [
    "//base",
    "//components/compose:buildflags",
    "//components/prefs:prefs",
    "//components/segmentation_platform/embedder",
    "//components/segmentation_platform/internal",
    "//components/segmentation_platform/internal/proto",
    "//components/segmentation_platform/public",
    "//components/sync/service",
    "//components/sync_device_info",
    "//components/visited_url_ranking/public",
    "//services/metrics/public/cpp:ukm_builders",
    "//ui/base",
  ]
  if (is_android) {
    sources += [
      "device_tier_segment.cc",
      "device_tier_segment.h",
      "frequent_feature_user_model.cc",
      "frequent_feature_user_model.h",
      "intentional_user_model.cc",
      "intentional_user_model.h",
      "power_user_segment.cc",
      "power_user_segment.h",
      "tablet_productivity_user_model.cc",
      "tablet_productivity_user_model.h",
    ]
  }
  if (enable_compose) {
    sources += [
      "compose_promotion.cc",
      "compose_promotion.h",
    ]
    deps += [ "//components/compose/core/browser:browser" ]
  }
}

source_set("unit_tests") {
  testonly = true

  # IMPORTANT NOTE: When adding new tests, also remember to update the list of
  # tests in //components/segmentation_platform/components_unittests.filter
  sources = [
    "android_home_module_ranker_unittest.cc",
    "contextual_page_actions_model_unittest.cc",
    "cross_device_user_segment_unittest.cc",
    "database_api_clients_unittest.cc",
    "device_switcher_model_unittest.cc",
    "device_switcher_result_dispatcher_unittest.cc",
    "feed_user_segment_unittest.cc",
    "ios_module_ranker_unittest.cc",
    "low_user_engagement_model_unittest.cc",
    "metrics_clustering_unittest.cc",
    "most_visited_tiles_user_unittest.cc",
    "optimization_target_segmentation_dummy_unittest.cc",
    "password_manager_user_segment_unittest.cc",
    "resume_heavy_user_model_unittest.cc",
    "search_user_model_unittest.cc",
    "shopping_user_model_unittest.cc",
    "tab_resumption_ranker_unittest.cc",
    "url_visit_resumption_ranker_unittest.cc",
  ]

  if (is_android) {
    sources += [
      "device_tier_segment_unittest.cc",
      "frequent_feature_user_model_unittest.cc",
      "intentional_user_model_unittest.cc",
      "power_user_segment_unittest.cc",
      "tablet_productivity_user_model_unittest.cc",
    ]
  }

  deps = [
    ":default_model",
    ":default_model_test_base",
    "//base",
    "//base/test:test_support",
    "//components/prefs:test_support",
    "//components/segmentation_platform/embedder",
    "//components/segmentation_platform/internal",
    "//components/segmentation_platform/internal/proto",
    "//components/segmentation_platform/public:public",
    "//components/segmentation_platform/public:test_support",
    "//components/segmentation_platform/public/proto",
    "//components/sync:test_support",
    "//components/sync_device_info",
    "//components/sync_device_info:test_support",
    "//components/visited_url_ranking/public",
    "//testing/gtest",
  ]

  if (enable_compose) {
    sources += [ "compose_promotion_unittest.cc" ]
    deps += [ "//components/compose/core/browser:browser" ]
  }
}

source_set("default_model_test_base") {
  testonly = true
  sources = [
    "default_model_test_base.cc",
    "default_model_test_base.h",
  ]

  deps = [
    ":default_model",
    "//base",
    "//base/test:test_support",
    "//components/segmentation_platform/internal",
    "//components/segmentation_platform/internal/proto",
    "//components/segmentation_platform/public",
    "//testing/gtest",
  ]
}