chromium/base/test/BUILD.gn

# Copyright 2013 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("//build/compiled_action.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/nacl/config.gni")
import("//build/config/ui.gni")
import("//build_overrides/build.gni")
import("//third_party/protobuf/proto_library.gni")

if (is_android) {
  import("//build/config/android/rules.gni")
  import("//third_party/jni_zero/jni_zero.gni")
}

if (is_ios) {
  import("//build/config/ios/rules.gni")
}

if (enable_base_tracing) {
  import("//third_party/perfetto/gn/perfetto_cc_proto_descriptor.gni")
}

static_library("test_config") {
  testonly = true
  sources = [
    "test_switches.cc",
    "test_switches.h",
    "test_timeouts.cc",
    "test_timeouts.h",
  ]
  deps = [
    "//base",
    "//base:clang_profiling_buildflags",
    "//build:chromeos_buildflags",
  ]
}

static_library("test_support") {
  testonly = true
  sources = [
    "../task/sequence_manager/test/fake_task.cc",
    "../task/sequence_manager/test/fake_task.h",
    "../task/sequence_manager/test/mock_time_domain.cc",
    "../task/sequence_manager/test/mock_time_domain.h",
    "../task/sequence_manager/test/mock_time_message_pump.cc",
    "../task/sequence_manager/test/mock_time_message_pump.h",
    "../task/sequence_manager/test/sequence_manager_for_test.cc",
    "../task/sequence_manager/test/sequence_manager_for_test.h",
    "../task/sequence_manager/test/test_task_time_observer.h",
    "../timer/mock_timer.cc",
    "../timer/mock_timer.h",
    "allow_check_is_test_for_testing.h",
    "bind.cc",
    "bind.h",
    "copy_only_int.cc",
    "copy_only_int.h",
    "fuzztest_init_helper.cc",
    "fuzztest_init_helper.h",
    "gmock_callback_support.h",
    "gmock_expected_support.h",
    "gmock_move_support.h",
    "gtest_links.cc",
    "gtest_links.h",
    "gtest_tags.cc",
    "gtest_tags.h",
    "gtest_util.cc",
    "gtest_util.h",
    "gtest_xml_unittest_result_printer.cc",
    "gtest_xml_unittest_result_printer.h",
    "gtest_xml_util.cc",
    "gtest_xml_util.h",
    "icu_test_util.cc",
    "icu_test_util.h",
    "launcher/test_result.cc",
    "launcher/test_result.h",
    "launcher/test_results_tracker.h",
    "launcher/unit_test_launcher.h",
    "metrics/action_suffix_reader.cc",
    "metrics/action_suffix_reader.h",
    "metrics/histogram_enum_reader.cc",
    "metrics/histogram_enum_reader.h",
    "metrics/histogram_tester.cc",
    "metrics/histogram_tester.h",
    "metrics/histogram_variants_reader.cc",
    "metrics/histogram_variants_reader.h",
    "metrics/user_action_tester.cc",
    "metrics/user_action_tester.h",
    "mock_callback.h",
    "mock_devices_changed_observer.cc",
    "mock_devices_changed_observer.h",
    "mock_entropy_provider.cc",
    "mock_entropy_provider.h",
    "mock_log.cc",
    "mock_log.h",
    "move_only_int.cc",
    "move_only_int.h",
    "multiprocess_test.h",
    "null_task_runner.cc",
    "null_task_runner.h",
    "perf_log.cc",
    "perf_log.h",
    "perf_test_suite.cc",
    "perf_test_suite.h",
    "perf_time_logger.cc",
    "perf_time_logger.h",
    "power_monitor_test.cc",
    "power_monitor_test.h",
    "power_monitor_test_utils.cc",
    "power_monitor_test_utils.h",
    "protobuf_matchers.cc",
    "protobuf_matchers.h",
    "rectify_callback.h",
    "rectify_callback_internal.h",
    "repeating_test_future.h",
    "run_until.cc",
    "run_until.h",
    "scoped_amount_of_physical_memory_override.cc",
    "scoped_amount_of_physical_memory_override.h",
    "scoped_block_tests_writing_to_special_dirs.cc",
    "scoped_block_tests_writing_to_special_dirs.h",
    "scoped_command_line.cc",
    "scoped_command_line.h",
    "scoped_feature_list.cc",
    "scoped_feature_list.h",
    "scoped_mock_clock_override.cc",
    "scoped_mock_clock_override.h",
    "scoped_mock_time_message_loop_task_runner.cc",
    "scoped_mock_time_message_loop_task_runner.h",
    "scoped_path_override.cc",
    "scoped_path_override.h",
    "scoped_run_loop_timeout.cc",
    "scoped_run_loop_timeout.h",
    "sequenced_task_runner_test_template.cc",
    "sequenced_task_runner_test_template.h",
    "simple_test_clock.cc",
    "simple_test_clock.h",
    "simple_test_tick_clock.cc",
    "simple_test_tick_clock.h",
    "task_environment.cc",
    "task_environment.h",
    "task_runner_test_template.cc",
    "task_runner_test_template.h",
    "test_discardable_memory_allocator.cc",
    "test_discardable_memory_allocator.h",
    "test_file_util.cc",
    "test_file_util.h",
    "test_future.h",
    "test_future_internal.h",
    "test_io_thread.cc",
    "test_io_thread.h",
    "test_message_loop.cc",
    "test_message_loop.h",
    "test_mock_time_task_runner.cc",
    "test_mock_time_task_runner.h",
    "test_pending_task.cc",
    "test_pending_task.h",
    "test_shared_memory_util.cc",
    "test_shared_memory_util.h",
    "test_simple_task_runner.cc",
    "test_simple_task_runner.h",
    "test_suite.cc",
    "test_suite.h",
    "test_suite_helper.cc",
    "test_suite_helper.h",
    "test_waitable_event.cc",
    "test_waitable_event.h",
    "thread_test_helper.cc",
    "thread_test_helper.h",
    "values_test_util.cc",
    "values_test_util.h",
    "with_feature_override.cc",
    "with_feature_override.h",
  ]

  configs += [ "//build/config:precompiled_headers" ]

  public_deps = [
    ":test_config",
    "//base",
    "//base:base_static",
    "//base:i18n",
    "//build:blink_buildflags",
    "//testing/gmock",
    "//testing/gtest",
  ]

  deps = [
    ":proto_test_support",
    "//build:chromeos_buildflags",
    "//third_party/google_benchmark",
    "//third_party/icu:icuuc",
    "//third_party/libxml:libxml_utils",
    "//third_party/libxml:xml_reader",
  ]

  if (enable_base_tracing) {
    public_deps += [ "//third_party/perfetto:perfetto_test_support" ]
    public_deps += [ ":test_trace_processor" ]
    sources += [
      "test_trace_processor.cc",
      "test_trace_processor.h",
    ]
    deps += [
      ":amalgamated_perfetto_sql_stdlib",
      ":gen_cc_chrome_track_event_descriptor",
    ]
    if (is_ios) {
      deps += [
        ":test_trace_processor+bundle",
        ":test_trace_processor+link",
      ]
    }
  }

  if (is_win) {
    sources += [
      "async_results_test_values_win.h",
      "fake_iasync_operation_win.h",
      "file_path_reparse_point_win.cc",
      "file_path_reparse_point_win.h",
      "scoped_os_info_override_win.cc",
      "scoped_os_info_override_win.h",
      "test_file_util_win.cc",
      "test_reg_util_win.cc",
      "test_reg_util_win.h",
      "test_shortcut_win.cc",
      "test_shortcut_win.h",
    ]
  }

  if (is_chromeos) {
    sources += [
      "scoped_chromeos_version_info.cc",
      "scoped_chromeos_version_info.h",
      "scoped_running_on_chromeos.cc",
      "scoped_running_on_chromeos.h",
    ]
  }

  if (is_linux || is_chromeos) {
    sources += [ "test_file_util_linux.cc" ]
    public_deps += [ "//third_party/test_fonts/fontconfig:test_support" ]
  }

  if (is_mac) {
    frameworks = [ "AppKit.framework" ]
    sources += [
      "mock_chrome_application_mac.h",
      "mock_chrome_application_mac.mm",
      "test_file_util_mac.cc",
    ]
  }

  if (is_android) {
    sources += [
      "android/content_uri_test_utils.cc",
      "android/content_uri_test_utils.h",
      "android/java_handler_thread_helpers.cc",
      "android/java_handler_thread_helpers.h",
      "android/url_utils.cc",
      "android/url_utils.h",
      "multiprocess_test_android.cc",
      "test_file_util_android.cc",
      "test_file_util_linux.cc",
      "test_support_android.cc",
      "test_support_android.h",
      "thread_pool_test_helpers_android.cc",
    ]
    deps += [
      ":base_unittests_jni_headers",
      ":test_support_jni_headers",
    ]
  }

  if (is_ios) {
    sources += [
      "ios/wait_util.h",
      "ios/wait_util.mm",
      "test_file_util_mac.cc",
      "test_listener_ios.h",
      "test_listener_ios.mm",
      "test_support_ios.h",
      "test_support_ios.mm",
    ]
    deps += [
      ":google_test_runner_shared_headers",
      "//build:blink_buildflags",
      "//build:ios_buildflags",
    ]

    # With blink, we use the standard unit_test_launcher.cc.
    if (!use_blink) {
      sources += [ "launcher/unit_test_launcher_ios.cc" ]
    }
  }

  if (is_posix || is_fuchsia) {
    sources += [
      "scoped_locale.cc",
      "scoped_locale.h",
      "test_file_util_posix.cc",
    ]
  }

  if (is_fuchsia) {
    deps += [
      "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.io:fuchsia.io_cpp_hlcpp_conversion",
      "//third_party/fuchsia-sdk/sdk/pkg/zx",
    ]
    public_deps += [ "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp" ]
    sources += [
      "../fuchsia/test_component_context_for_process.cc",
      "../fuchsia/test_component_context_for_process.h",
      "fidl_matchers.h",
      "scoped_dev_zero_fuchsia.cc",
      "scoped_dev_zero_fuchsia.h",
    ]
  }

  if (use_blink) {
    sources += [
      "launcher/test_launcher.cc",
      "launcher/test_launcher.h",
      "launcher/test_launcher_test_utils.cc",
      "launcher/test_launcher_test_utils.h",
      "launcher/test_launcher_tracer.cc",
      "launcher/test_launcher_tracer.h",
      "launcher/test_results_tracker.cc",
      "launcher/unit_test_launcher.cc",
      "multiprocess_test.cc",
    ]
  }

  if (enable_base_tracing) {
    sources += [
      "../trace_event/trace_config_memory_test_util.h",
      "trace_event_analyzer.cc",
      "trace_event_analyzer.h",
      "trace_test_utils.cc",
      "trace_test_utils.h",
      "trace_to_file.cc",
      "trace_to_file.h",
    ]
  }
}

component("proto_test_support") {
  testonly = true

  sources = [
    "test_proto_loader.cc",
    "test_proto_loader.h",
  ]

  defines = [ "PROTO_TEST_IMPLEMENTATION" ]

  deps = [
    "//base",
    "//third_party/protobuf:protobuf_full",
  ]
}

proto_library("test_proto") {
  sources = [ "test.proto" ]
  cc_generator_options = "lite"
}

proto_library("test_proto_descriptor") {
  sources = [ "test.proto" ]
  generate_cc = false
  generate_python = false
  generate_descriptor = "test_proto.descriptor"
}

config("base_test_implementation") {
  defines = [ "IS_BASE_TEST_IMPL" ]
}

config("perf_test_config") {
  defines = [ "PERF_TEST" ]
}

# This is a source set instead of a static library because it seems like some
# linkers get confused when "main" is in a static library, and if you link to
# this, you always want the object file anyway.
source_set("test_support_perf") {
  testonly = true
  sources = [ "run_all_perftests.cc" ]
  deps = [
    ":test_support",
    "//base",
    "//testing/gtest",
  ]

  public_configs = [ ":perf_test_config" ]
}

static_library("run_all_unittests") {
  testonly = true
  sources = [ "run_all_unittests.cc" ]
  deps = [ ":test_support" ]
}

# These sources are linked into both the base_unittests binary and the test
# shared library target below.
source_set("native_library_test_utils") {
  testonly = true
  sources = [
    "native_library_test_utils.cc",
    "native_library_test_utils.h",
  ]
}

# This shared library is dynamically loaded by ImmediateCrash unittests.
shared_library("immediate_crash_test_helper") {
  sources = [ "immediate_crash_test_helper.cc" ]

  # Note: the helper has a header-only dependency on //base/immediate_helper.h.
  # However, the build rule intentionally omits an explicit //base dependency
  # to avoid potential ODR violations and minimize the amount of code linked in.
  # We do however need to depend upon a buildflag header included in
  # base/immediate_crash.h.
  deps = [ "//base:fuzzing_buildflags" ]

  # Try to minimize the risk of non-official builds generating different code.
  if (!is_official_build) {
    configs -= [ "//build/config/compiler:default_optimization" ]
    configs += [ "//build/config/compiler:optimize_max" ]
  }

  # Disable sanitization: sanitized builds are assumed to be saner than normal,
  # and can affect codegen in surprising ways, which breaks the tests.
  configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]

  if (is_android) {
    configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
  }
}

# This shared library is dynamically loaded by NativeLibrary unittests.
shared_library("test_shared_library") {
  testonly = true
  sources = [ "test_shared_library.cc" ]

  deps = [ ":native_library_test_utils" ]
}

if (is_fuchsia || is_linux || is_chromeos) {
  shared_library("malloc_wrapper") {
    testonly = true
    sources = [
      "malloc_wrapper.cc",
      "malloc_wrapper.h",
    ]
  }
}

if (is_android) {
  generate_jni("base_unittests_jni_headers") {
    testonly = true
    sources = [
      "android/java/src/org/chromium/base/ContentUriTestUtils.java",
      "android/java/src/org/chromium/base/JavaHandlerThreadHelpers.java",
    ]
  }

  generate_jni("test_support_jni_headers") {
    testonly = true
    sources = [
      "android/java/src/org/chromium/base/MainReturnCodeResult.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientLauncher.java",
      "android/javatests/src/org/chromium/base/test/task/ThreadPoolTestHelpers.java",
      "android/javatests/src/org/chromium/base/test/util/UrlUtils.java",
    ]
  }

  # Used by all base test targets: gtests, robolectric, and instrumentation tests.
  android_library("test_support_java") {
    testonly = true

    mergeable_android_manifests =
        [ "android/java/AndroidManifest_file_provider.xml" ]

    deps = [
      ":file_provider_resources",
      "//base:base_java",
      "//base:content_uri_utils_java",
      "//base:process_launcher_java",
      "//testing/android/native_test:native_main_runner_java",
      "//third_party/android_deps:com_google_code_findbugs_jsr305_java",
      "//third_party/jni_zero:jni_zero_java",
    ]

    srcjar_deps = [ ":test_support_java_aidl" ]
    sources = [
      "android/java/src/org/chromium/base/GarbageCollectionTestUtils.java",
      "android/java/src/org/chromium/base/MainReturnCodeResult.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientLauncher.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientService.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientService0.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientService1.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientService2.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientService3.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientService4.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientService5.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientService6.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientService7.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientService8.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientService9.java",
      "android/java/src/org/chromium/base/MultiprocessTestClientServiceDelegate.java",
    ]
  }

  android_aidl("test_support_java_aidl") {
    testonly = true
    import_include = [
      "android/java/src",
      "//base/android/java/src",
    ]
    sources = [
      "android/java/src/org/chromium/base/ITestCallback.aidl",
      "android/java/src/org/chromium/base/ITestController.aidl",
    ]
  }

  android_resources("file_provider_resources") {
    testonly = true
    sources = [ "android/java/res/xml/file_paths_file_provider.xml" ]
  }
}

if (is_ios) {
  source_set("google_test_runner_shared_headers") {
    sources = [ "ios/google_test_runner_delegate.h" ]
  }

  source_set("google_test_runner") {
    sources = [ "ios/google_test_runner.mm" ]
    deps = [ ":google_test_runner_shared_headers" ]
    frameworks = [ "UIKit.framework" ]
    configs += [ "//build/config/ios:xctest_config" ]
  }
}

# Trivial executable which outputs space-delimited argv to stdout,
# used for testing.
executable("test_child_process") {
  testonly = true
  sources = [ "test_child_process.cc" ]
}

if (enable_base_tracing) {
  perfetto_cc_proto_descriptor("gen_cc_chrome_track_event_descriptor") {
    descriptor_name = "chrome_track_event.descriptor"
    descriptor_target = "//base/tracing/protos:chrome_track_event"
    namespace = "base::testing"
  }

  import("//base/tracing/stdlib/chrome/perfetto_sql_files.gni")
  action("amalgamated_perfetto_sql_stdlib") {
    script = "//third_party/perfetto/tools/gen_amalgamated_sql.py"
    sources = rebase_path(chrome_stdlib_sql_files,
                          ".",
                          "//base/tracing/stdlib/chrome")
    stdlib_header = "$root_gen_dir/base/test/perfetto_sql_stdlib.h"
    outputs = [ stdlib_header ]
    args = [
             "--namespace",
             "chrome_stdlib",
             "--cpp-out",
             rebase_path(stdlib_header, root_build_dir),
           ] + rebase_path(sources, root_build_dir)
  }

  # We encapsulate the trace processor in a separate shared library to prevent
  # any duplicate symbol issues. Perfetto symbols are exported by chromium’s
  # base via a public_dep on libperfetto; libtrace_processor also depends on
  # these symbols. So we “hide” the perfetto symbols exported from this
  # interface. Also, chrome targets depend on chromium_sqlite and the trace
  # processor depends on dev_sqlite. The two share the same symbols but have
  # different implementations, so we need to hide dev_sqlite in this shared
  # library even in non-component builds to prevent duplicate symbols.
  _target_type = "shared_library"
  if (is_ios) {
    _target_type = "ios_framework_bundle"
  }

  target(_target_type, "test_trace_processor") {
    defines = [ "TEST_TRACE_PROCESSOR_IMPL" ]
    testonly = true
    sources = [
      "test_trace_processor_export.h",
      "test_trace_processor_impl.cc",
      "test_trace_processor_impl.h",
    ]
    deps = [
      "//third_party/abseil-cpp:absl",
      "//third_party/perfetto:libtrace_processor",
    ]
    if (is_android) {
      configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
    }

    if (is_ios) {
      info_plist = "test_trace_processor_impl.plist"
      output_name = "TestTraceProcessor"
      bundle_deps_filter = [ "//third_party/icu:icudata" ]
    }

    # Set rpath on dependent tests so that they can find the shared library
    # in a non-component build.
    if (!is_component_build) {
      all_dependent_configs = []
      if (is_linux || is_chromeos) {
        all_dependent_configs +=
            [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
      }
      if (is_mac) {
        # We need the lib to be in $root_out_dir/Libraries so the library is where
        # the linker expects it, since we set the install_name flag. We need to
        # set this flag so that the library can be found when it is bundled in the
        # Content Shell Framework (see test_trace_processor_bundle_data).
        output_dir = "$root_out_dir/Libraries"
        ldflags = [ "-Wl,-install_name,@loader_path/Libraries/libtest_trace_processor.dylib" ]
      }
    }
  }

  if (!is_component_build && is_mac) {
    bundle_data("test_trace_processor_bundle_data") {
      testonly = true
      sources = [ "$root_out_dir/Libraries/libtest_trace_processor.dylib" ]
      outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
      public_deps = [ ":test_trace_processor" ]
    }
  }
} else if (!is_component_build && is_mac) {
  # Provide a dummy target in order for clients to not have to special-case
  # the dependency.
  group("test_trace_processor_bundle_data") {
    testonly = true
  }
}

if (is_android) {
  android_library("public_transit_java") {
    testonly = true

    deps = [
      "//base:base_java",
      "//base:base_java_test_support",
      "//build/android:build_java",
      "//third_party/android_deps:com_google_errorprone_error_prone_annotations_java",
      "//third_party/android_deps:espresso_java",
      "//third_party/android_deps:guava_android_java",
      "//third_party/androidx:androidx_annotation_annotation_java",
      "//third_party/androidx:androidx_core_core_java",
      "//third_party/androidx:androidx_fragment_fragment_java",
      "//third_party/androidx:androidx_test_monitor_java",
      "//third_party/hamcrest:hamcrest_java",
      "//third_party/junit",
    ]

    sources = [
      "android/javatests/src/org/chromium/base/test/transit/ActivityElement.java",
      "android/javatests/src/org/chromium/base/test/transit/BatchedPublicTransitRule.java",
      "android/javatests/src/org/chromium/base/test/transit/CallbackCondition.java",
      "android/javatests/src/org/chromium/base/test/transit/CarryOn.java",
      "android/javatests/src/org/chromium/base/test/transit/Condition.java",
      "android/javatests/src/org/chromium/base/test/transit/ConditionChecker.java",
      "android/javatests/src/org/chromium/base/test/transit/ConditionStatus.java",
      "android/javatests/src/org/chromium/base/test/transit/ConditionStatusWithResult.java",
      "android/javatests/src/org/chromium/base/test/transit/ConditionWaiter.java",
      "android/javatests/src/org/chromium/base/test/transit/ConditionWithResult.java",
      "android/javatests/src/org/chromium/base/test/transit/ConditionalState.java",
      "android/javatests/src/org/chromium/base/test/transit/DisplayedPortion.java",
      "android/javatests/src/org/chromium/base/test/transit/Element.java",
      "android/javatests/src/org/chromium/base/test/transit/ElementFactory.java",
      "android/javatests/src/org/chromium/base/test/transit/Elements.java",
      "android/javatests/src/org/chromium/base/test/transit/EntryPointSentinelStation.java",
      "android/javatests/src/org/chromium/base/test/transit/Facility.java",
      "android/javatests/src/org/chromium/base/test/transit/FacilityCheckIn.java",
      "android/javatests/src/org/chromium/base/test/transit/FacilityCheckOut.java",
      "android/javatests/src/org/chromium/base/test/transit/FacilitySwap.java",
      "android/javatests/src/org/chromium/base/test/transit/FragmentElement.java",
      "android/javatests/src/org/chromium/base/test/transit/InstrumentationThreadCondition.java",
      "android/javatests/src/org/chromium/base/test/transit/LogicalElement.java",
      "android/javatests/src/org/chromium/base/test/transit/MoreViewConditions.java",
      "android/javatests/src/org/chromium/base/test/transit/PublicTransitConfig.java",
      "android/javatests/src/org/chromium/base/test/transit/ScrollableFacility.java",
      "android/javatests/src/org/chromium/base/test/transit/Station.java",
      "android/javatests/src/org/chromium/base/test/transit/StatusStore.java",
      "android/javatests/src/org/chromium/base/test/transit/TrafficControl.java",
      "android/javatests/src/org/chromium/base/test/transit/TransitAsserts.java",
      "android/javatests/src/org/chromium/base/test/transit/Transition.java",
      "android/javatests/src/org/chromium/base/test/transit/TravelException.java",
      "android/javatests/src/org/chromium/base/test/transit/Trip.java",
      "android/javatests/src/org/chromium/base/test/transit/UiThreadCondition.java",
      "android/javatests/src/org/chromium/base/test/transit/ViewConditions.java",
      "android/javatests/src/org/chromium/base/test/transit/ViewElement.java",
      "android/javatests/src/org/chromium/base/test/transit/ViewSpec.java",
    ]
  }

  robolectric_library("public_transit_robolectric_tests_java") {
    deps = [
      ":public_transit_java",
      "//base:base_java_test_support",
      "//base:base_junit_test_support",
      "//base:callback_java",
      "//third_party/junit",
    ]

    sources = [
      "android/javatests/src/org/chromium/base/test/transit/TripUnitTest.java",
    ]
  }
}

source_set("fuzztest_support") {
  testonly = true
  sources = [ "fuzztest_support.h" ]
  deps = [
    "//base",
    "//third_party/fuzztest:fuzztest_internal",
  ]
}

buildflag_header("confirm_fuzztest_init_buildflags") {
  header = "confirm_fuzztest_init_buildflags.h"
  flags =
      [ "REGISTER_FUZZTESTS_IN_TEST_SUITES=$register_fuzztests_in_test_suites" ]
}

# Contains a static initializer which will arrange for fuzztests to be
# registered. Usually invoked from testing/test.gni
source_set("confirm_fuzztest_init") {
  sources = [ "confirm_fuzztest_init.cc" ]
  testonly = true
  deps = [
    ":confirm_fuzztest_init_buildflags",
    ":test_support",
    "//third_party/fuzztest:init_fuzztest",
  ]
}