chromium/components/offline_pages/core/BUILD.gn

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

static_library("core") {
  sources = [
    "archive_manager.cc",
    "archive_manager.h",
    "archive_validator.cc",
    "archive_validator.h",
    "auto_fetch.cc",
    "auto_fetch.h",
    "background_snapshot_controller.cc",
    "background_snapshot_controller.h",
    "client_id.cc",
    "client_id.h",
    "client_namespace_constants.cc",
    "client_namespace_constants.h",
    "model/add_page_task.cc",
    "model/add_page_task.h",
    "model/cleanup_visuals_task.cc",
    "model/cleanup_visuals_task.h",
    "model/clear_storage_task.cc",
    "model/clear_storage_task.h",
    "model/delete_page_task.cc",
    "model/delete_page_task.h",
    "model/get_pages_task.cc",
    "model/get_pages_task.h",
    "model/get_visuals_task.cc",
    "model/get_visuals_task.h",
    "model/mark_page_accessed_task.cc",
    "model/mark_page_accessed_task.h",
    "model/offline_page_model_taskified.cc",
    "model/offline_page_model_taskified.h",
    "model/offline_page_model_utils.cc",
    "model/offline_page_model_utils.h",
    "model/offline_page_upgrade_types.cc",
    "model/offline_page_upgrade_types.h",
    "model/persistent_page_consistency_check_task.cc",
    "model/persistent_page_consistency_check_task.h",
    "model/startup_maintenance_task.cc",
    "model/startup_maintenance_task.h",
    "model/store_visuals_task.cc",
    "model/store_visuals_task.h",
    "model/update_publish_id_task.cc",
    "model/update_publish_id_task.h",
    "model/visuals_availability_task.cc",
    "model/visuals_availability_task.h",
    "offline_clock.cc",
    "offline_clock.h",
    "offline_event_logger.cc",
    "offline_event_logger.h",
    "offline_page_archive_publisher.h",
    "offline_page_archiver.cc",
    "offline_page_archiver.h",
    "offline_page_client_policy.cc",
    "offline_page_client_policy.h",
    "offline_page_item.cc",
    "offline_page_item.h",
    "offline_page_item_utils.cc",
    "offline_page_item_utils.h",
    "offline_page_metadata_store.cc",
    "offline_page_metadata_store.h",
    "offline_page_model.cc",
    "offline_page_model.h",
    "offline_page_model_event_logger.cc",
    "offline_page_model_event_logger.h",
    "offline_page_types.h",
    "offline_page_visuals.cc",
    "offline_page_visuals.h",
    "offline_store_types.h",
    "offline_store_utils.cc",
    "offline_store_utils.h",
    "page_criteria.cc",
    "page_criteria.h",
    "snapshot_controller.cc",
    "snapshot_controller.h",
    "visuals_decoder.h",
  ]

  deps = [
    ":switches",
    "//base",
    "//base:i18n",
    "//components/filename_generation",
    "//components/keyed_service/core",
    "//components/offline_items_collection/core/utilities",
    "//components/offline_pages/task",
    "//crypto",
    "//net",
    "//sql:sql",
    "//url",
  ]
}

static_library("test_support") {
  testonly = true
  sources = [
    "model/model_task_test_base.cc",
    "model/model_task_test_base.h",
    "model/offline_page_item_generator.cc",
    "model/offline_page_item_generator.h",
    "model/offline_page_test_utils.cc",
    "model/offline_page_test_utils.h",
    "offline_page_metadata_store_test_util.cc",
    "offline_page_metadata_store_test_util.h",
    "offline_page_test_archive_publisher.cc",
    "offline_page_test_archive_publisher.h",
    "offline_page_test_archiver.cc",
    "offline_page_test_archiver.h",
    "stub_offline_page_model.cc",
    "stub_offline_page_model.h",
    "test_scoped_offline_clock.cc",
    "test_scoped_offline_clock.h",
  ]

  deps = [
    ":core",
    ":switches",
    "//base",
    "//base/test:test_support",
    "//components/keyed_service/core",
    "//components/offline_pages/task:test_support",
    "//sql:sql",
    "//testing/gmock",
    "//testing/gtest",
    "//url",
  ]
}

static_library("switches") {
  sources = [
    "offline_page_feature.cc",
    "offline_page_feature.h",
  ]

  deps = [
    "//base",
    "//components/version_info",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "archive_manager_unittest.cc",
    "archive_validator_unittest.cc",
    "auto_fetch_unittest.cc",
    "background_snapshot_controller_unittest.cc",
    "model/add_page_task_unittest.cc",
    "model/cleanup_visuals_task_unittest.cc",
    "model/clear_storage_task_unittest.cc",
    "model/delete_page_task_unittest.cc",
    "model/get_pages_task_unittest.cc",
    "model/get_visuals_task_unittest.cc",
    "model/mark_page_accessed_task_unittest.cc",
    "model/offline_page_model_taskified_unittest.cc",
    "model/offline_page_model_utils_unittest.cc",
    "model/persistent_page_consistency_check_task_unittest.cc",
    "model/startup_maintenance_task_unittest.cc",
    "model/store_visuals_task_unittest.cc",
    "model/update_publish_id_task_unittest.cc",
    "model/visuals_availability_task_unittest.cc",
    "offline_event_logger_unittest.cc",
    "offline_page_client_policy_unittest.cc",
    "offline_page_item_utils_unittest.cc",
    "offline_page_metadata_store_unittest.cc",
    "offline_page_model_event_logger_unittest.cc",
    "offline_page_visuals_unittest.cc",
    "page_criteria_unittest.cc",
    "snapshot_controller_unittest.cc",
  ]

  deps = [
    ":core",
    ":switches",
    ":test_support",
    "//base",
    "//base/test:test_support",
    "//components/offline_pages/task:test_support",
    "//sql:sql",
    "//testing/gmock",
    "//testing/gtest",
    "//url",
  ]
}

if (is_android) {
  java_cpp_enum("offline_page_model_enums_java") {
    sources = [
      "background/request_notifier.h",
      "background/request_queue_results.h",
      "background/save_page_request.h",
      "offline_page_types.h",
      "offline_store_types.h",
    ]
  }
}