Home | History | Annotate | Download | only in test
      1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 import("//build/config/ui.gni")
      6 
      7 if (is_android) {
      8   import("//build/config/android/rules.gni")
      9 }
     10 
     11 # GYP: //base/base.gyp:test_support_base
     12 source_set("test_support") {
     13   # TODO http://crbug.com/412064 enable this flag all the time.
     14   testonly = !is_component_build
     15   sources = [
     16     "expectations/expectation.cc",
     17     "expectations/expectation.h",
     18     "expectations/parser.cc",
     19     "expectations/parser.h",
     20     "gtest_xml_util.cc",
     21     "gtest_xml_util.h",
     22     "histogram_tester.cc",
     23     "histogram_tester.h",
     24     "launcher/test_launcher.cc",
     25     "launcher/test_launcher.h",
     26     "launcher/test_result.cc",
     27     "launcher/test_result.h",
     28     "launcher/test_results_tracker.cc",
     29     "launcher/test_results_tracker.h",
     30     "launcher/unit_test_launcher.cc",
     31     "launcher/unit_test_launcher.h",
     32     "launcher/unit_test_launcher_ios.cc",
     33     "mock_chrome_application_mac.h",
     34     "mock_chrome_application_mac.mm",
     35     "mock_devices_changed_observer.cc",
     36     "mock_devices_changed_observer.h",
     37     "mock_time_provider.cc",
     38     "mock_time_provider.h",
     39     "multiprocess_test.cc",
     40     "multiprocess_test.h",
     41     "multiprocess_test_android.cc",
     42     "null_task_runner.cc",
     43     "null_task_runner.h",
     44     "perf_log.cc",
     45     "perf_log.h",
     46     "perf_test_suite.cc",
     47     "perf_test_suite.h",
     48     "perf_time_logger.cc",
     49     "perf_time_logger.h",
     50     "power_monitor_test_base.cc",
     51     "power_monitor_test_base.h",
     52     "scoped_locale.cc",
     53     "scoped_locale.h",
     54     "scoped_path_override.cc",
     55     "scoped_path_override.h",
     56     "sequenced_task_runner_test_template.cc",
     57     "sequenced_task_runner_test_template.h",
     58     "sequenced_worker_pool_owner.cc",
     59     "sequenced_worker_pool_owner.h",
     60     "simple_test_clock.cc",
     61     "simple_test_clock.h",
     62     "simple_test_tick_clock.cc",
     63     "simple_test_tick_clock.h",
     64     "task_runner_test_template.cc",
     65     "task_runner_test_template.h",
     66     "test_file_util.cc",
     67     "test_file_util.h",
     68     "test_file_util_android.cc",
     69     "test_file_util_linux.cc",
     70     "test_file_util_mac.cc",
     71     "test_file_util_posix.cc",
     72     "test_file_util_win.cc",
     73     "test_io_thread.cc",
     74     "test_io_thread.h",
     75     "test_listener_ios.h",
     76     "test_listener_ios.mm",
     77     "test_pending_task.cc",
     78     "test_pending_task.h",
     79     "test_reg_util_win.cc",
     80     "test_reg_util_win.h",
     81     "test_shortcut_win.cc",
     82     "test_shortcut_win.h",
     83     "test_simple_task_runner.cc",
     84     "test_simple_task_runner.h",
     85     "test_suite.cc",
     86     "test_suite.h",
     87     "test_support_android.cc",
     88     "test_support_android.h",
     89     "test_support_ios.h",
     90     "test_support_ios.mm",
     91     "test_switches.cc",
     92     "test_switches.h",
     93     "test_timeouts.cc",
     94     "test_timeouts.h",
     95     "thread_test_helper.cc",
     96     "thread_test_helper.h",
     97     "trace_event_analyzer.cc",
     98     "trace_event_analyzer.h",
     99     "trace_to_file.cc",
    100     "trace_to_file.h",
    101     "values_test_util.cc",
    102     "values_test_util.h",
    103   ]
    104 
    105   public_deps = [
    106     "//base",
    107     "//base:i18n",
    108     "//base:base_static",
    109   ]
    110   deps = [
    111     "//base/third_party/dynamic_annotations",
    112     "//testing/gmock",
    113     "//testing/gtest",
    114     "//third_party/libxml"
    115   ]
    116 
    117   if (!is_posix) {
    118     sources -= [
    119       "scoped_locale.cc",
    120       "scoped_locale.h",
    121     ]
    122   }
    123   if (is_ios) {
    124     # iOS uses its own unit test launcher.
    125     sources -= [ "launcher/unit_test_launcher.cc" ]
    126 
    127     # Pull in specific Mac files for iOS (which have been filtered out
    128     # by file name rules).
    129     set_sources_assignment_filter([])
    130     sources += [ "test_file_util_mac.cc" ]
    131   }
    132 
    133   if (is_android) {
    134     deps += [ ":base_unittests_jni_headers" ]
    135   }
    136 }
    137 
    138 config("perf_test_config") {
    139   defines = [ "PERF_TEST" ]
    140 }
    141 
    142 source_set("test_support_perf") {
    143   testonly = true
    144   sources = [
    145     "run_all_perftests.cc",
    146   ]
    147   deps = [
    148     ":test_support",
    149     "//base",
    150     "//testing/gtest",
    151   ]
    152 
    153   public_configs = [ ":perf_test_config" ]
    154 }
    155 
    156 source_set("run_all_unittests") {
    157   testonly = true
    158   sources = [
    159     "run_all_unittests.cc",
    160   ]
    161   deps = [
    162     ":test_support",
    163   ]
    164 }
    165 
    166 if (is_android) {
    167   generate_jni("base_unittests_jni_headers") {
    168     sources = [
    169       "android/java/src/org/chromium/base/ContentUriTestUtils.java",
    170     ]
    171     jni_package = "base"
    172   }
    173 }
    174