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