chromium/components/page_load_metrics/common/BUILD.gn

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

import("//mojo/public/tools/bindings/mojom.gni")
import("//testing/test.gni")

source_set("common") {
  sources = [
    "page_end_reason.h",
    "page_load_metrics_util.cc",
    "page_load_metrics_util.h",
    "page_load_timing.cc",
    "page_load_timing.h",
    "page_visit_final_status.h",
  ]
  deps = [
    ":page_load_metrics_mojom",
    "//base",
    "//net",
    "//third_party/blink/public:blink_headers",
    "//url",
  ]
}

source_set("test_support") {
  testonly = true
  sources = [
    "test/page_load_metrics_test_util.cc",
    "test/page_load_metrics_test_util.h",
    "test/weak_mock_timer.cc",
    "test/weak_mock_timer.h",
  ]
  deps = [
    ":common",
    ":page_load_metrics_mojom",
    "//base",
    "//base/test:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]
}

mojom("page_load_metrics_mojom") {
  sources = [ "page_load_metrics.mojom" ]

  cpp_typemaps = [
    {
      types = [
        {
          mojom = "page_load_metrics.mojom.SubresourceLoadMetrics"
          cpp = "::blink::SubresourceLoadMetrics"
        },
        {
          mojom = "page_load_metrics.mojom.ServiceWorkerSubresourceLoadMetrics"
          cpp = "::blink::ServiceWorkerSubresourceLoadMetrics"
        },
      ]
      traits_headers = [ "page_load_metrics_mojom_traits.h" ]
      traits_sources = [ "page_load_metrics_mojom_traits.cc" ]
      traits_public_deps = [ "//third_party/blink/public/common" ]
    },
  ]

  public_deps = [
    "//mojo/public/mojom/base",
    "//third_party/blink/public/mojom:mojom_platform",
    "//ui/gfx/geometry/mojom",
    "//url/mojom:url_mojom_origin",
  ]
  overridden_deps = [ "//third_party/blink/public/mojom:mojom_platform" ]
  component_deps = [ "//third_party/blink/public/common" ]
}