chromium/ui/latency/BUILD.gn

# 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/buildflag_header.gni")
import("//testing/test.gni")

declare_args() {
  use_jank_tracker_for_experiments = false
}

buildflag_header("jank_tracker_for_experiments_buildflags") {
  header = "jank_tracker_for_experiments_buildflags.h"
  header_dir = "ui/latency"

  flags = [ "JANK_TRACKER_FOR_EXPERIMENTS=$use_jank_tracker_for_experiments" ]
}

source_set("latency") {
  sources = [
    "latency_info.cc",
    "latency_info.h",
  ]
  if (use_jank_tracker_for_experiments) {
    sources += [
      "janky_duration_tracker.cc",
      "janky_duration_tracker.h",
    ]
  }

  deps = [
    "//base",
    "//build:blink_buildflags",
    "//services/tracing/public/cpp:cpp",
    "//ui/gfx",
  ]

  public_deps = [
    ":jank_tracker_for_experiments_buildflags",
    "//services/metrics/public/cpp:metrics_cpp",
  ]
}

source_set("test_support") {
  testonly = true
  sources = [ "latency_info_test_support.cc" ]

  public_deps = [ ":latency" ]
}

test("latency_unittests") {
  sources = [ "latency_info_unittest.cc" ]

  deps = [
    ":latency",
    "//base",
    "//base/test:test_support",
    "//mojo/core/test:run_all_unittests",
    "//testing/gmock",
    "//testing/gtest",
  ]

  if (!is_ios) {
    sources += [
      "ipc/latency_info_param_traits_unittest.cc",
      "mojom/mojom_traits_unittest.cc",
    ]
    deps += [
      "//ipc:test_support",
      "//mojo/public/cpp/bindings",
      "//ui/gfx/ipc/geometry",
      "//ui/latency/ipc",
      "//ui/latency/mojom:test_interfaces",
    ]
  }
}