1# Copyright 2017 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//testing/test.gni")
6
7component("ukm_recorder") {
8  output_name = "ukm_recorder"
9
10  defines = [ "IS_UKM_RECORDER_IMPL" ]
11
12  friend = [
13    ":test_support",
14    ":unit_tests",
15  ]
16
17  sources = [
18    "scheme_constants.cc",
19    "scheme_constants.h",
20    "ukm_entry_filter.h",
21    "ukm_recorder_impl.cc",
22    "ukm_recorder_impl.h",
23  ]
24
25  deps = [
26    "//base",
27    "//components/variations",
28    "//services/metrics/public/cpp:metrics_cpp",
29    "//services/metrics/public/cpp:ukm_builders",
30    "//services/metrics/public/mojom",
31    "//third_party/metrics_proto",
32    "//url",
33  ]
34}
35
36# The Url-Keyed Metrics (UKM) service is responsible for gathering and
37# uploading reports that contain fine grained performance metrics including
38# URLs for top-level navigations.
39static_library("ukm") {
40  sources = [
41    "app_source_url_recorder.cc",
42    "app_source_url_recorder.h",
43    "field_trials_provider_helper.cc",
44    "field_trials_provider_helper.h",
45    "ukm_pref_names.cc",
46    "ukm_pref_names.h",
47    "ukm_reporting_service.cc",
48    "ukm_reporting_service.h",
49    "ukm_rotation_scheduler.cc",
50    "ukm_rotation_scheduler.h",
51    "ukm_service.cc",
52    "ukm_service.h",
53    "unsent_log_store_metrics_impl.cc",
54    "unsent_log_store_metrics_impl.h",
55  ]
56
57  public_deps = [
58    ":ukm_recorder",
59    "//services/metrics/public/cpp:metrics_cpp",
60    "//services/metrics/public/cpp:ukm_builders",
61    "//services/metrics/public/mojom",
62    "//third_party/metrics_proto",
63  ]
64
65  deps = [
66    "//base",
67    "//components/crx_file",
68    "//components/metrics",
69    "//components/prefs",
70    "//components/variations",
71    "//url",
72  ]
73}
74
75# Helper library for observing signals that we need to clear any local data.
76static_library("observers") {
77  sources = [
78    "observers/history_delete_observer.cc",
79    "observers/history_delete_observer.h",
80    "observers/ukm_consent_state_observer.cc",
81    "observers/ukm_consent_state_observer.h",
82  ]
83
84  deps = [
85    "//base",
86    "//components/history/core/browser",
87    "//components/sync",
88    "//google_apis",
89  ]
90
91  public_deps = [ "//components/unified_consent" ]
92}
93
94static_library("test_support") {
95  testonly = true
96  sources = [
97    "test_ukm_recorder.cc",
98    "test_ukm_recorder.h",
99  ]
100
101  public_deps = [
102    ":ukm",
103    "//third_party/metrics_proto",
104  ]
105  deps = [
106    "//base",
107    "//components/metrics:test_support",
108    "//components/prefs:test_support",
109    "//testing/gtest:gtest",
110  ]
111}
112
113source_set("unit_tests") {
114  testonly = true
115  sources = [
116    "app_source_url_recorder_test.cc",
117    "observers/ukm_consent_state_observer_unittest.cc",
118    "ukm_recorder_impl_unittest.cc",
119    "ukm_service_unittest.cc",
120  ]
121
122  deps = [
123    ":observers",
124    ":test_support",
125    ":ukm",
126    "//base",
127    "//base/test:test_support",
128    "//components/metrics",
129    "//components/metrics:test_support",
130    "//components/prefs:test_support",
131    "//components/sync:test_support",
132    "//components/sync_preferences:test_support",
133    "//components/variations",
134    "//net:test_support",
135    "//services/metrics/public/cpp:ukm_builders",
136    "//testing/gtest",
137    "//third_party/zlib/google:compression_utils",
138    "//url",
139  ]
140}
141
142# Convenience testing target
143test("ukm_unittests") {
144  deps = [
145    ":unit_tests",
146    "//base",
147    "//base/test:test_support",
148    "//components/test:run_all_unittests",
149  ]
150}
151
152static_library("ukm_test_helper") {
153  testonly = true
154  sources = [
155    "ukm_test_helper.cc",
156    "ukm_test_helper.h",
157  ]
158  deps = [
159    ":ukm",
160    "//base",
161    "//components/metrics",
162    "//services/metrics/public/cpp:metrics_cpp",
163    "//third_party/metrics_proto",
164  ]
165}
166