chromium/ios/chrome/browser/metrics/model/BUILD.gn

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

source_set("demographics_client") {
  sources = [
    "demographics_client.h",
    "demographics_client.mm",
  ]
  deps = [
    "//base",
    "//components/metrics/demographics",
    "//components/network_time",
    "//ios/chrome/browser/shared/model/application_context",
    "//ios/chrome/browser/shared/model/browser_state",
    "//ios/chrome/browser/shared/model/profile",
    "//ios/chrome/browser/sync/model",
  ]
}

source_set("accessor") {
  sources = [
    "ios_chrome_metrics_service_accessor.h",
    "ios_chrome_metrics_service_accessor.mm",
  ]
  deps = [
    "//base",
    "//components/metrics",
    "//components/prefs",
    "//components/variations",
    "//ios/chrome/browser/shared/model/application_context",
  ]
}

source_set("constants") {
  sources = [
    "constants.h",
    "constants.mm",
  ]
}

source_set("google_groups_updater") {
  sources = [
    "google_groups_manager_factory.h",
    "google_groups_manager_factory.mm",
  ]
  deps = [
    "//base",
    "//components/keyed_service/ios",
    "//components/variations/service",
    "//ios/chrome/browser/shared/model/application_context",
    "//ios/chrome/browser/shared/model/browser_state",
    "//ios/chrome/browser/shared/model/profile",
  ]
}

source_set("model") {
  sources = [
    "incognito_usage_app_state_agent.h",
    "incognito_usage_app_state_agent.mm",
    "ios_chrome_default_browser_metrics_provider.h",
    "ios_chrome_default_browser_metrics_provider.mm",
    "ios_chrome_metrics_service_client.h",
    "ios_chrome_metrics_service_client.mm",
    "ios_chrome_metrics_services_manager_client.h",
    "ios_chrome_metrics_services_manager_client.mm",
    "ios_chrome_signin_and_sync_status_metrics_provider.h",
    "ios_chrome_signin_and_sync_status_metrics_provider.mm",
    "ios_chrome_stability_metrics_provider.h",
    "ios_chrome_stability_metrics_provider.mm",
    "ios_family_link_user_metrics_provider.h",
    "ios_family_link_user_metrics_provider.mm",
    "ios_feed_activity_metrics_provider.h",
    "ios_feed_activity_metrics_provider.mm",
    "ios_feed_enabled_metrics_provider.h",
    "ios_feed_enabled_metrics_provider.mm",
    "ios_profile_session_durations_service.h",
    "ios_profile_session_durations_service.mm",
    "ios_profile_session_durations_service_factory.h",
    "ios_profile_session_durations_service_factory.mm",
    "ios_profile_session_metrics_provider.h",
    "ios_profile_session_metrics_provider.mm",
    "ios_push_notifications_metrics_provider.h",
    "ios_push_notifications_metrics_provider.mm",
    "mobile_session_shutdown_metrics_provider.h",
    "mobile_session_shutdown_metrics_provider.mm",
    "pageload_foreground_duration_tab_helper.h",
    "pageload_foreground_duration_tab_helper.mm",
    "web_state_list_metrics_browser_agent.h",
    "web_state_list_metrics_browser_agent.mm",
    "window_configuration_recorder.h",
    "window_configuration_recorder.mm",
  ]
  public_deps = [ "//components/ukm/ios:ukm_url_recorder" ]
  deps = [
    ":accessor",
    ":constants",
    ":demographics_client",
    "//base",
    "//components/browser_sync",
    "//components/crash/core/common",
    "//components/feed/core/shared_prefs:feed_shared_prefs",
    "//components/keyed_service/core",
    "//components/keyed_service/ios",
    "//components/metrics",
    "//components/metrics:net",
    "//components/metrics:ui",
    "//components/metrics/demographics",
    "//components/metrics_services_manager",
    "//components/navigation_metrics",
    "//components/omnibox/browser",
    "//components/password_manager/core/browser",
    "//components/prefs",
    "//components/previous_session_info",
    "//components/profile_metrics",
    "//components/signin/core/browser",
    "//components/supervised_user/core/browser",
    "//components/supervised_user/core/common",
    "//components/sync",
    "//components/sync_device_info",
    "//components/ukm",
    "//components/ukm:observers",
    "//components/variations",
    "//components/variations/service",
    "//components/version_info",
    "//ios/chrome/app/application_delegate:app_state_header",
    "//ios/chrome/browser/content_settings/model",
    "//ios/chrome/browser/crash_report/model",
    "//ios/chrome/browser/default_browser/model:utils",
    "//ios/chrome/browser/history/model",
    "//ios/chrome/browser/ntp/shared/metrics:constants",
    "//ios/chrome/browser/ntp/ui_bundled:feature_flags",
    "//ios/chrome/browser/push_notification/model:push_notification_client",
    "//ios/chrome/browser/push_notification/model:push_notification_service",
    "//ios/chrome/browser/sessions/model:restoration_observer",
    "//ios/chrome/browser/sessions/model:session_restoration_service",
    "//ios/chrome/browser/sessions/model:session_restoration_service_factory",
    "//ios/chrome/browser/shared/coordinator/scene:scene_state_header",
    "//ios/chrome/browser/shared/model/application_context",
    "//ios/chrome/browser/shared/model/browser_state:incognito_session_tracker",
    "//ios/chrome/browser/shared/model/paths",
    "//ios/chrome/browser/shared/model/prefs:pref_names",
    "//ios/chrome/browser/shared/model/profile",
    "//ios/chrome/browser/shared/model/url:constants",
    "//ios/chrome/browser/shared/model/web_state_list",
    "//ios/chrome/browser/shared/public/features",
    "//ios/chrome/browser/shared/ui/util",
    "//ios/chrome/browser/signin/model",
    "//ios/chrome/browser/supervised_user/model",
    "//ios/chrome/browser/sync/model",
    "//ios/chrome/browser/sync/model:device_info_sync_service_factory",
    "//ios/chrome/browser/tabs/model",
    "//ios/chrome/browser/translate/model",
    "//ios/chrome/browser/variations/model",
    "//ios/chrome/browser/variations/model:ios_chrome_ui_string_overrider_factory",
    "//ios/chrome/browser/web_state_list/model:session_metrics",
    "//ios/chrome/common",
    "//ios/components/webui:url_constants",
    "//ios/public/provider/chrome/browser/app_distribution:app_distribution_api",
    "//ios/web/common",
    "//ios/web/public",
    "//ios/web/public:web_state_observer",
    "//ios/web/public/deprecated",
    "//ios/web/public/navigation",
    "//url",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "demographics_client_unittest.mm",
    "incognito_usage_app_state_agent_unittest.mm",
    "ios_chrome_default_browser_metrics_provider_unittest.mm",
    "ios_chrome_metrics_service_accessor_unittest.mm",
    "ios_chrome_metrics_service_client_unittest.mm",
    "ios_chrome_stability_metrics_provider_unittest.mm",
    "ios_family_link_user_metrics_provider_unittest.mm",
    "ios_feed_activity_metrics_provider_unittest.mm",
    "ios_feed_enabled_metrics_provider_unittest.mm",
    "ios_push_notifications_metrics_provider_unittest.mm",
    "mobile_session_shutdown_metrics_provider_unittest.mm",
    "pageload_foreground_duration_tab_helper_unittest.mm",
  ]
  deps = [
    ":accessor",
    ":constants",
    ":demographics_client",
    ":model",
    "//base",
    "//base/test:test_support",
    "//build:branding_buildflags",
    "//components/feed/core/shared_prefs:feed_shared_prefs",
    "//components/metrics",
    "//components/metrics:test_support",
    "//components/network_time:network_time",
    "//components/prefs",
    "//components/prefs:test_support",
    "//components/previous_session_info",
    "//components/signin/public/identity_manager:test_support",
    "//components/supervised_user/core/browser",
    "//components/supervised_user/core/common",
    "//components/sync_preferences:test_support",
    "//components/ukm",
    "//components/ukm:test_support",
    "//components/variations",
    "//components/variations/service",
    "//components/version_info",
    "//ios/chrome/app/application_delegate:app_state_header",
    "//ios/chrome/browser/default_browser/model:test_support",
    "//ios/chrome/browser/default_browser/model:utils",
    "//ios/chrome/browser/ntp/shared/metrics:constants",
    "//ios/chrome/browser/ntp/ui_bundled:feature_flags",
    "//ios/chrome/browser/push_notification/model:push_notification_client",
    "//ios/chrome/browser/push_notification/model:push_notification_service",
    "//ios/chrome/browser/shared/coordinator/scene:scene_state_header",
    "//ios/chrome/browser/shared/model/application_context",
    "//ios/chrome/browser/shared/model/prefs:browser_prefs",
    "//ios/chrome/browser/shared/model/prefs:pref_names",
    "//ios/chrome/browser/shared/model/profile/test",
    "//ios/chrome/browser/shared/public/features",
    "//ios/chrome/browser/signin/model",
    "//ios/chrome/browser/signin/model:fake_system_identity",
    "//ios/chrome/browser/signin/model:fake_system_identity_manager",
    "//ios/chrome/browser/signin/model:test_support",
    "//ios/chrome/browser/supervised_user/model",
    "//ios/chrome/test:test_support",
    "//ios/web/common",
    "//ios/web/public",
    "//ios/web/public/test",
    "//ios/web/public/test/fakes",
    "//net:test_support",
    "//testing/gtest",
    "//third_party/ocmock",
  ]
}

source_set("metrics_browser_agent") {
  sources = [
    "tab_usage_recorder_browser_agent.h",
    "tab_usage_recorder_browser_agent.mm",
  ]
  deps = [
    ":metrics_internal",
    ":model",
    ":tab_usage_recorder_metrics",
    "//base",
    "//components/google/core/common",
    "//components/previous_session_info",
    "//components/ukm/ios:ukm_url_recorder",
    "//ios/chrome/browser/prerender/model",
    "//ios/chrome/browser/sessions/model:restoration_observer",
    "//ios/chrome/browser/sessions/model:session_restoration_service",
    "//ios/chrome/browser/sessions/model:session_restoration_service_factory",
    "//ios/chrome/browser/shared/model/browser",
    "//ios/chrome/browser/shared/model/browser_state",
    "//ios/chrome/browser/shared/model/url:constants",
    "//ios/chrome/browser/shared/model/web_state_list",
    "//ios/components/webui:url_constants",
    "//ios/web",
    "//ios/web/common:user_agent",
    "//services/metrics/public/cpp:ukm_builders",
    "//ui/base",
    "//url",
  ]
  frameworks = [ "UIKit.framework" ]
}

source_set("metrics_internal") {
  sources = [
    "first_user_action_recorder.cc",
    "first_user_action_recorder.h",
    "new_tab_page_uma.h",
    "new_tab_page_uma.mm",
    "user_interface_style_recorder.h",
    "user_interface_style_recorder.mm",
  ]
  deps = [
    ":model",
    ":tab_usage_recorder_metrics",
    "//base",
    "//components/google/core/common",
    "//ios/chrome/browser/shared/model/url:constants",
    "//ios/chrome/browser/shared/model/web_state_list",
    "//ios/chrome/browser/voice/model",
    "//ios/web",
    "//services/metrics/public/cpp:ukm_builders",
    "//ui/base",
    "//url",
  ]
  frameworks = [ "UIKit.framework" ]
}

source_set("tab_usage_recorder_metrics") {
  sources = [
    "tab_usage_recorder_metrics.h",
    "tab_usage_recorder_metrics.mm",
  ]
  deps = [ "//base" ]
}

source_set("unit_tests_internal") {
  testonly = true
  sources = [
    "first_user_action_recorder_unittest.cc",
    "tab_usage_recorder_browser_agent_unittest.mm",
  ]
  deps = [
    ":metrics_browser_agent",
    ":metrics_internal",
    ":model",
    "//base",
    "//base/test:test_support",
    "//components/previous_session_info",
    "//ios/chrome/browser/shared/model/browser/test:test_support",
    "//ios/chrome/browser/shared/model/profile/test",
    "//ios/chrome/browser/shared/model/web_state_list",
    "//ios/testing:ocmock_support",
    "//ios/web",
    "//ios/web/public/test",
    "//ios/web/public/test/fakes",
    "//testing/gtest",
    "//ui/base",
  ]
}

source_set("eg2_tests") {
  configs += [ "//build/config/ios:xctest_config" ]
  testonly = true
  sources = [
    "demographics_egtest.mm",
    "tab_usage_recorder_egtest.mm",
    "ukm_egtest.mm",
  ]
  deps = [
    ":eg_test_support+eg2",
    ":tab_usage_recorder_metrics",
    "//base/test:test_support",
    "//components/metrics/demographics",
    "//components/strings",
    "//components/ukm",
    "//ios/chrome/browser/signin/model:fake_system_identity",
    "//ios/chrome/browser/ui/authentication:eg_test_support+eg2",
    "//ios/chrome/test:eg_test_support+eg2",
    "//ios/chrome/test/earl_grey:eg_test_support+eg2",
    "//ios/testing/earl_grey:eg_test_support+eg2",
    "//ios/testing/earl_grey:launch_configuration",
    "//ios/web/public/test:element_selector",
    "//ios/web/public/test/http_server",
    "//ui/base:base",
  ]
  frameworks = [ "UIKit.framework" ]
}

import("//components/metrics/generate_expired_histograms_array.gni")

generate_expired_histograms_array("expired_histograms_array") {
  namespace = ""
  header_filename = "ios_expired_histograms_array.h"
  major_branch_date_filepath = "//chrome/MAJOR_BRANCH_DATE"
  milestone_filepath = "//chrome/VERSION"
}

source_set("eg_app_support+eg2") {
  configs += [ "//build/config/ios:xctest_config" ]
  testonly = true
  sources = [
    "metrics_app_interface.h",
    "metrics_app_interface.mm",
  ]
  deps = [
    ":accessor",
    ":metrics_internal",
    ":model",
    "//base",
    "//base/test:test_support",
    "//components/metrics",
    "//components/metrics/demographics:test_support",
    "//components/metrics_services_manager",
    "//components/network_time",
    "//components/prefs",
    "//components/ukm",
    "//components/ukm:ukm_test_helper",
    "//ios/chrome/browser/shared/model/application_context",
    "//ios/chrome/browser/shared/model/profile",
    "//ios/chrome/test/app:test_support",
    "//ios/testing:nserror_support",
    "//third_party/metrics_proto",
  ]
}

source_set("eg_test_support+eg2") {
  configs += [ "//build/config/ios:xctest_config" ]
  testonly = true
  sources = [
    "metrics_app_interface.h",
    "metrics_app_interface_stub.mm",
  ]
  deps = [
    "//base",
    "//base/test:test_support",
    "//ios/chrome/test:eg_test_support+eg2",
    "//ios/chrome/test/earl_grey:eg_test_support+eg2",
    "//ios/testing/earl_grey:eg_test_support+eg2",
    "//third_party/metrics_proto",
  ]
}