1# Copyright 2014 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import("//build_overrides/build.gni") 6 7config("gtest_config") { 8 # webrtc wants to push this config without a public_dep chain 9 # TODO(crbug.com/1249254): figure out what to do with this 10 visibility = [ 11 ":*", # gmock also shares this config. 12 "//test:*", # webrts standalone setup 13 "//third_party/webrtc/test:*", 14 ] 15 16 defines = [ 17 # Chromium always links googletest statically, so no API qualifier is 18 # necessary. The definition in gtest-port.h at the time of this writing 19 # causes crashes in content_browsertests. 20 "GTEST_API_=", 21 22 # In order to allow regex matches in gtest to be shared between Windows 23 # and other systems, we tell gtest to always use its internal engine. 24 "GTEST_HAS_POSIX_RE=0", 25 26 # Enables C++11 features. 27 "GTEST_LANG_CXX11=1", 28 29 # Prevents gtest from including both <tr1/tuple> and <tuple>. 30 "GTEST_HAS_TR1_TUPLE=0", 31 32 "GTEST_HAS_ABSL=1", 33 ] 34 35 # Gtest headers need to be able to find themselves. 36 include_dirs = [ 37 "custom", 38 "src/googletest/include", 39 ] 40 41 if (is_win) { 42 cflags = [ "/wd4800" ] # Unused variable warning. 43 } 44 45 configs = [ "//third_party/abseil-cpp:absl_include_config" ] 46} 47 48config("gmock_config") { 49 # Gmock headers need to be able to find themselves. 50 include_dirs = [ 51 "custom", 52 "src/googlemock/include", 53 ] 54 55 if (is_clang) { 56 # TODO(tikuta): remove this when the issue is fixed. 57 # https://github.com/google/googletest/issues/533 58 cflags = [ "-Wno-inconsistent-missing-override" ] 59 } 60} 61 62# Do NOT depend on this directly. Use //testing/gtest instead. 63# See README.chromium for details. 64source_set("gtest") { 65 testonly = true 66 sources = [ 67 "custom/gtest/internal/custom/gtest.h", 68 "custom/gtest/internal/custom/stack_trace_getter.cc", 69 "custom/gtest/internal/custom/stack_trace_getter.h", 70 71 # TODO(crbug.com/1009553): Remove this wrapper and custom temp dir 72 # after plumbing a workable temporary path into googletest on Android. 73 "custom/gtest/internal/custom/chrome_custom_temp_dir.cc", 74 "custom/gtest/internal/custom/chrome_custom_temp_dir.h", 75 "custom/gtest/internal/custom/gtest_port_wrapper.cc", 76 "src/googletest/include/gtest/gtest-assertion-result.h", 77 "src/googletest/include/gtest/gtest-death-test.h", 78 "src/googletest/include/gtest/gtest-matchers.h", 79 "src/googletest/include/gtest/gtest-message.h", 80 "src/googletest/include/gtest/gtest-param-test.h", 81 "src/googletest/include/gtest/gtest-printers.h", 82 "src/googletest/include/gtest/gtest-spi.h", 83 "src/googletest/include/gtest/gtest-test-part.h", 84 "src/googletest/include/gtest/gtest-typed-test.h", 85 "src/googletest/include/gtest/gtest.h", 86 "src/googletest/include/gtest/gtest_pred_impl.h", 87 "src/googletest/include/gtest/gtest_prod.h", 88 89 #"src/googletest/include/gtest/internal/custom/gtest.h", # Superseded. 90 "src/googletest/include/gtest/internal/custom/gtest-port.h", 91 "src/googletest/include/gtest/internal/custom/gtest-printers.h", 92 "src/googletest/include/gtest/internal/gtest-death-test-internal.h", 93 "src/googletest/include/gtest/internal/gtest-filepath.h", 94 "src/googletest/include/gtest/internal/gtest-internal.h", 95 "src/googletest/include/gtest/internal/gtest-param-util.h", 96 "src/googletest/include/gtest/internal/gtest-port-arch.h", 97 "src/googletest/include/gtest/internal/gtest-port.h", 98 "src/googletest/include/gtest/internal/gtest-string.h", 99 "src/googletest/include/gtest/internal/gtest-type-util.h", 100 101 #"src/googletest/src/gtest-all.cc", # Not needed by our build. 102 "src/googletest/src/gtest-assertion-result.cc", 103 "src/googletest/src/gtest-death-test.cc", 104 "src/googletest/src/gtest-filepath.cc", 105 "src/googletest/src/gtest-internal-inl.h", 106 "src/googletest/src/gtest-matchers.cc", 107 108 # gtest_port_wrapper.cc is used instead of gtest-port.cc. 109 # TODO(crbug.com/1009553): Re-enable this file after plumbing a workable 110 # temporary path into googletest on Android. 111 #"src/googletest/src/gtest-port.cc", 112 "src/googletest/src/gtest-printers.cc", 113 "src/googletest/src/gtest-test-part.cc", 114 "src/googletest/src/gtest-typed-test.cc", 115 "src/googletest/src/gtest.cc", 116 ] 117 118 # Some files include "src/gtest-internal-inl.h". 119 include_dirs = [ "src/googletest" ] 120 121 public_configs = [ ":gtest_config" ] 122 123 configs -= [ "//build/config/compiler:chromium_code" ] 124 configs += [ "//build/config/compiler:no_chromium_code" ] 125 126 defines = [] 127 deps = [ "//third_party/abseil-cpp:absl" ] 128 public_deps = [ "//third_party/re2" ] 129 if (is_nacl || !build_with_chromium) { 130 defines += [ "GTEST_DISABLE_PRINT_STACK_TRACE" ] 131 sources -= [ 132 "custom/gtest/internal/custom/stack_trace_getter.cc", 133 "custom/gtest/internal/custom/stack_trace_getter.h", 134 ] 135 } else { 136 deps += [ "//base" ] 137 } 138 139 if (is_fuchsia) { 140 deps += [ 141 "//third_party/fuchsia-sdk/sdk/pkg/fdio", 142 "//third_party/fuchsia-sdk/sdk/pkg/zx", 143 ] 144 } 145} 146 147# Do NOT depend on this directly. Use //testing/gtest:gtest_main instead. 148# See README.chromium for details. 149source_set("gtest_main") { 150 testonly = true 151 sources = [ "src/googletest/src/gtest_main.cc" ] 152 deps = [ ":gtest" ] 153} 154 155# Do NOT depend on this directly. Use //testing/gmock instead. 156# See README.chromium for details. 157source_set("gmock") { 158 testonly = true 159 sources = [ 160 "src/googlemock/include/gmock/gmock-actions.h", 161 "src/googlemock/include/gmock/gmock-cardinalities.h", 162 "src/googlemock/include/gmock/gmock-function-mocker.h", 163 "src/googlemock/include/gmock/gmock-matchers.h", 164 "src/googlemock/include/gmock/gmock-more-matchers.h", 165 "src/googlemock/include/gmock/gmock-nice-strict.h", 166 "src/googlemock/include/gmock/gmock-spec-builders.h", 167 "src/googlemock/include/gmock/gmock.h", 168 169 #"src/googlemock/include/gmock/internal/custom/gmock-port.h", # Superseded. 170 "src/googlemock/include/gmock/internal/custom/gmock-generated-actions.h", 171 "src/googlemock/include/gmock/internal/custom/gmock-matchers.h", 172 "src/googlemock/include/gmock/internal/gmock-internal-utils.h", 173 "src/googlemock/include/gmock/internal/gmock-port.h", 174 "src/googlemock/include/gmock/internal/gmock-pp.h", 175 176 #"src/googlemock/src/gmock-all.cc", # Not needed by our build. 177 "src/googlemock/src/gmock-cardinalities.cc", 178 "src/googlemock/src/gmock-internal-utils.cc", 179 "src/googlemock/src/gmock-matchers.cc", 180 "src/googlemock/src/gmock-spec-builders.cc", 181 "src/googlemock/src/gmock.cc", 182 ] 183 184 public_deps = [ ":gtest" ] 185 186 public_configs = [ ":gmock_config" ] 187} 188 189# Do NOT depend on this directly. Use //testing/gmock:gmock_main instead. 190# See README.chromium for details. 191static_library("gmock_main") { 192 testonly = true 193 sources = [ "src/googlemock/src/gmock_main.cc" ] 194 deps = [ ":gmock" ] 195} 196