chromium/chrome/browser/error_reporting/BUILD.gn

# Copyright 2020 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")

# TODO(crbug.com/40149439) This is currently disabled due to Windows DLL
# thunking issues. Fix & re-enable.
assert(is_linux || is_chromeos)

source_set("constants") {
  sources = [
    "constants.cc",
    "constants.h",
  ]
  deps = [ "//build:chromeos_buildflags" ]
}

static_library("error_reporting") {
  sources = [
    "chrome_js_error_report_processor.cc",
    "chrome_js_error_report_processor.h",
  ]
  deps = [
    "//base",
    "//build:branding_buildflags",
    "//build:chromeos_buildflags",
    "//chrome/common:constants",
    "//components/crash/content/browser/error_reporting",
    "//components/crash/core/app",
    "//components/feedback/redaction_tool",
    "//components/startup_metric_utils",
    "//components/upload_list",
    "//components/variations",
    "//content/public/browser",
    "//net",
    "//services/network:network_service",
    "//services/network/public/cpp",
  ]
  if (is_chromeos) {
    sources += [ "chrome_js_error_report_processor_chromeos.cc" ]
    deps += [ ":constants" ]
  } else {
    sources += [ "chrome_js_error_report_processor_nonchromeos.cc" ]
  }
}

source_set("test_support") {
  testonly = true
  sources = [
    "mock_chrome_js_error_report_processor.cc",
    "mock_chrome_js_error_report_processor.h",
  ]
  deps = [
    ":error_reporting",
    "//base",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//chrome/common:constants",
    "//components/crash/content/browser/error_reporting",
    "//components/crash/content/browser/error_reporting:mock_crash_endpoint",
    "//components/variations",
  ]
  if (is_chromeos) {
    data_deps = [ ":mock_chromeos_crash_reporter" ]
  }
}

source_set("unit_test") {
  testonly = true
  sources = [ "chrome_js_error_report_processor_unittest.cc" ]
  deps = [
    ":error_reporting",
    ":test_support",
    "//base",
    "//chrome/browser/crash_upload_list",
    "//chrome/test:test_support",
    "//components/crash/content/browser/error_reporting",
    "//components/crash/content/browser/error_reporting:mock_crash_endpoint",
    "//components/crash/core/app",
    "//components/upload_list",
    "//content/test:test_support",
    "//net:test_support",
    "//testing/gtest",
  ]
}

if (is_chromeos) {
  executable("mock_chromeos_crash_reporter") {
    testonly = true
    sources = [ "mock_chromeos_crash_reporter.cc" ]

    deps = [
      ":constants",
      "//base",
      "//net",
      "//third_party/crashpad/crashpad/third_party/cpp-httplib",
    ]
  }
}