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.
5 import("//build_overrides/build.gni")
7 config("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
11 ":*", # gmock also shares this config.
12 "//test:*", # webrts standalone setup
13 "//third_party/webrtc/test:*",
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.
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",
26 # Enables C++11 features.
29 # Prevents gtest from including both <tr1/tuple> and <tuple>.
30 "GTEST_HAS_TR1_TUPLE=0",
33 # Gtest headers need to be able to find themselves.
36 "src/googletest/include",
40 cflags = [ "/wd4800" ] # Unused variable warning.
43 if (gtest_enable_absl_printers) {
44 configs = [ "//third_party/abseil-cpp:absl_include_config" ]
45 defines += [ "GTEST_HAS_ABSL=1" ]
49 config("gmock_config") {
50 # Gmock headers need to be able to find themselves.
53 "src/googlemock/include",
57 # TODO(tikuta): remove this when the issue is fixed.
58 # https://github.com/google/googletest/issues/533
59 cflags = [ "-Wno-inconsistent-missing-override" ]
63 # Do NOT depend on this directly. Use //testing/gtest instead.
64 # See README.chromium for details.
68 "custom/gtest/internal/custom/gtest.h",
69 "custom/gtest/internal/custom/stack_trace_getter.cc",
70 "custom/gtest/internal/custom/stack_trace_getter.h",
72 # TODO(crbug.com/1009553): Remove this wrapper and custom temp dir
73 # after plumbing a workable temporary path into googletest on Android.
74 "custom/gtest/internal/custom/chrome_custom_temp_dir.cc",
75 "custom/gtest/internal/custom/chrome_custom_temp_dir.h",
76 "custom/gtest/internal/custom/gtest_port_wrapper.cc",
77 "src/googletest/include/gtest/gtest-assertion-result.h",
78 "src/googletest/include/gtest/gtest-death-test.h",
79 "src/googletest/include/gtest/gtest-matchers.h",
80 "src/googletest/include/gtest/gtest-message.h",
81 "src/googletest/include/gtest/gtest-param-test.h",
82 "src/googletest/include/gtest/gtest-printers.h",
83 "src/googletest/include/gtest/gtest-spi.h",
84 "src/googletest/include/gtest/gtest-test-part.h",
85 "src/googletest/include/gtest/gtest-typed-test.h",
86 "src/googletest/include/gtest/gtest.h",
87 "src/googletest/include/gtest/gtest_pred_impl.h",
88 "src/googletest/include/gtest/gtest_prod.h",
90 #"src/googletest/include/gtest/internal/custom/gtest.h", # Superseded.
91 "src/googletest/include/gtest/internal/custom/gtest-port.h",
92 "src/googletest/include/gtest/internal/custom/gtest-printers.h",
93 "src/googletest/include/gtest/internal/gtest-death-test-internal.h",
94 "src/googletest/include/gtest/internal/gtest-filepath.h",
95 "src/googletest/include/gtest/internal/gtest-internal.h",
96 "src/googletest/include/gtest/internal/gtest-param-util.h",
97 "src/googletest/include/gtest/internal/gtest-port-arch.h",
98 "src/googletest/include/gtest/internal/gtest-port.h",
99 "src/googletest/include/gtest/internal/gtest-string.h",
100 "src/googletest/include/gtest/internal/gtest-type-util.h",
102 #"src/googletest/src/gtest-all.cc", # Not needed by our build.
103 "src/googletest/src/gtest-assertion-result.cc",
104 "src/googletest/src/gtest-death-test.cc",
105 "src/googletest/src/gtest-filepath.cc",
106 "src/googletest/src/gtest-internal-inl.h",
107 "src/googletest/src/gtest-matchers.cc",
109 # gtest_port_wrapper.cc is used instead of gtest-port.cc.
110 # TODO(crbug.com/1009553): Re-enable this file after plumbing a workable
111 # temporary path into googletest on Android.
112 #"src/googletest/src/gtest-port.cc",
113 "src/googletest/src/gtest-printers.cc",
114 "src/googletest/src/gtest-test-part.cc",
115 "src/googletest/src/gtest-typed-test.cc",
116 "src/googletest/src/gtest.cc",
119 # Some files include "src/gtest-internal-inl.h".
120 include_dirs = [ "src/googletest" ]
122 public_configs = [ ":gtest_config" ]
124 configs -= [ "//build/config/compiler:chromium_code" ]
125 configs += [ "//build/config/compiler:no_chromium_code" ]
130 if (is_nacl || !build_with_chromium) {
131 defines += [ "GTEST_DISABLE_PRINT_STACK_TRACE" ]
133 "custom/gtest/internal/custom/stack_trace_getter.cc",
134 "custom/gtest/internal/custom/stack_trace_getter.h",
142 "//third_party/fuchsia-sdk/sdk/pkg/fdio",
143 "//third_party/fuchsia-sdk/sdk/pkg/zx",
147 if (gtest_enable_absl_printers) {
148 deps += [ "//third_party/abseil-cpp:absl" ]
152 # Do NOT depend on this directly. Use //testing/gtest:gtest_main instead.
153 # See README.chromium for details.
154 source_set("gtest_main") {
156 sources = [ "src/googletest/src/gtest_main.cc" ]
160 # Do NOT depend on this directly. Use //testing/gmock instead.
161 # See README.chromium for details.
162 source_set("gmock") {
165 "src/googlemock/include/gmock/gmock-actions.h",
166 "src/googlemock/include/gmock/gmock-cardinalities.h",
167 "src/googlemock/include/gmock/gmock-function-mocker.h",
168 "src/googlemock/include/gmock/gmock-matchers.h",
169 "src/googlemock/include/gmock/gmock-more-matchers.h",
170 "src/googlemock/include/gmock/gmock-nice-strict.h",
171 "src/googlemock/include/gmock/gmock-spec-builders.h",
172 "src/googlemock/include/gmock/gmock.h",
174 #"src/googlemock/include/gmock/internal/custom/gmock-port.h", # Superseded.
175 "src/googlemock/include/gmock/internal/custom/gmock-generated-actions.h",
176 "src/googlemock/include/gmock/internal/custom/gmock-matchers.h",
177 "src/googlemock/include/gmock/internal/gmock-internal-utils.h",
178 "src/googlemock/include/gmock/internal/gmock-port.h",
179 "src/googlemock/include/gmock/internal/gmock-pp.h",
181 #"src/googlemock/src/gmock-all.cc", # Not needed by our build.
182 "src/googlemock/src/gmock-cardinalities.cc",
183 "src/googlemock/src/gmock-internal-utils.cc",
184 "src/googlemock/src/gmock-matchers.cc",
185 "src/googlemock/src/gmock-spec-builders.cc",
186 "src/googlemock/src/gmock.cc",
189 public_deps = [ ":gtest" ]
191 public_configs = [ ":gmock_config" ]
194 # Do NOT depend on this directly. Use //testing/gmock:gmock_main instead.
195 # See README.chromium for details.
196 static_library("gmock_main") {
198 sources = [ "src/googlemock/src/gmock_main.cc" ]