# Copyright 2017 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")
import("//testing/test.gni")
component("ukm_recorder") {
output_name = "ukm_recorder"
defines = [ "IS_UKM_RECORDER_IMPL" ]
friend = [
":test_support",
":unit_tests",
]
sources = [
"bitset.cc",
"bitset.h",
"scheme_constants.cc",
"scheme_constants.h",
"ukm_consent_state.h",
"ukm_entry_filter.h",
"ukm_recorder_impl.cc",
"ukm_recorder_impl.h",
"ukm_recorder_observer.cc",
"ukm_recorder_observer.h",
]
deps = [
"//base",
"//components/variations",
"//services/metrics/public/cpp:metrics_cpp",
"//services/metrics/public/cpp:ukm_builders",
"//services/metrics/public/mojom",
"//third_party/metrics_proto",
"//url",
]
}
# The Url-Keyed Metrics (UKM) service is responsible for gathering and
# uploading reports that contain fine grained performance metrics including
# URLs for top-level navigations.
static_library("ukm") {
sources = [
"app_source_url_recorder.cc",
"app_source_url_recorder.h",
"field_trials_provider_helper.cc",
"field_trials_provider_helper.h",
"singular_ukm_entry.cc",
"singular_ukm_entry.h",
"ukm_pref_names.cc",
"ukm_pref_names.h",
"ukm_reporting_service.cc",
"ukm_reporting_service.h",
"ukm_rotation_scheduler.cc",
"ukm_rotation_scheduler.h",
"ukm_service.cc",
"ukm_service.h",
"unsent_log_store_metrics_impl.cc",
"unsent_log_store_metrics_impl.h",
]
public_deps = [
":ukm_recorder",
"//components/ukm/debug:resources",
"//services/metrics/public/cpp:metrics_cpp",
"//services/metrics/public/cpp:ukm_builders",
"//services/metrics/public/mojom",
"//third_party/metrics_proto",
]
deps = [
"//base",
"//components/crx_file",
"//components/metrics",
"//components/prefs",
"//components/variations",
"//url",
]
if (is_ios) {
deps += [ "//components/ukm/ios:ukm_reporting_ios_util" ]
}
}
# Helper library for observing signals that we need to clear any local data.
static_library("observers") {
sources = [
"observers/history_delete_observer.cc",
"observers/history_delete_observer.h",
"observers/ukm_consent_state_observer.cc",
"observers/ukm_consent_state_observer.h",
"ukm_consent_state.h",
]
deps = [
"//base",
"//components/history/core/browser",
"//components/metrics",
"//components/sync/base",
"//components/sync/service",
"//google_apis",
"//services/metrics/public/cpp:metrics_cpp",
]
if (is_chromeos) {
deps += [
"//chromeos/components/kiosk",
"//chromeos/components/mgs",
]
}
public_deps = [ "//components/unified_consent" ]
}
static_library("test_support") {
testonly = true
sources = [
"test_ukm_recorder.cc",
"test_ukm_recorder.h",
]
public_deps = [
":ukm",
"//third_party/metrics_proto",
]
deps = [
"//base",
"//components/metrics:test_support",
"//components/prefs:test_support",
"//testing/gtest:gtest",
]
}
source_set("unit_tests") {
testonly = true
sources = [
"app_source_url_recorder_test.cc",
"bitset_unittest.cc",
"observers/ukm_consent_state_observer_unittest.cc",
"singular_ukm_entry_unittest.cc",
"ukm_recorder_impl_unittest.cc",
"ukm_service_unittest.cc",
]
deps = [
":observers",
":test_support",
":ukm",
"//base",
"//base/test:test_support",
"//components/metrics",
"//components/metrics:test_support",
"//components/prefs:test_support",
"//components/sync:test_support",
"//components/sync_preferences:test_support",
"//components/variations",
"//net:test_support",
"//services/metrics",
"//services/metrics/public/cpp:ukm_builders",
"//testing/gtest",
"//third_party/zlib/google:compression_utils",
"//url",
]
if (is_chromeos) {
deps += [
"//chromeos/components/kiosk:test_support",
"//chromeos/components/mgs:test_support",
]
}
if (is_chromeos_ash) {
deps += [ "//components/user_manager:test_support" ]
}
}
# Convenience testing target
test("ukm_unittests") {
deps = [
":unit_tests",
"//base",
"//base/test:test_support",
"//components/test:run_all_unittests",
]
}
static_library("ukm_test_helper") {
testonly = true
sources = [
"ukm_test_helper.cc",
"ukm_test_helper.h",
]
deps = [
":ukm",
"//base",
"//components/metrics",
"//services/metrics/public/cpp:metrics_cpp",
"//third_party/metrics_proto",
]
}