Commit dca5245e authored by jamesr@chromium.org's avatar jamesr@chromium.org

GN: Only define UNIT_TEST in direct gtest deps

This matches the gyp build and is important for parts of the code that
guard their API with UNIT_TEST. For instance,
chrome/browser/ui/views/omnibox/omnibox_view_views.h has a GetRenderText
function guarded by #if UNIT_TEST that shadows a protected function
GetRenderText from its parent class views::Textfield, but with different
const-ness. If c/b/u/v/o/omnibox_view_views.cc is compiled with UNIT_TEST
set, it attempts to use the guarded member function instead of the base
class which fails to compile.

R=brettw@chromium.org

Review URL: https://codereview.chromium.org/464503003

Cr-Commit-Position: refs/heads/master@{#288988}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288988 0039d316-1c4b-4281-b951-d872f2087c98
parent 041e601d
...@@ -9,7 +9,6 @@ config("gtest_config") { ...@@ -9,7 +9,6 @@ config("gtest_config") {
] ]
defines = [ defines = [
"UNIT_TEST",
# In order to allow regex matches in gtest to be shared between Windows # In order to allow regex matches in gtest to be shared between Windows
# and other systems, we tell gtest to always use it's internal engine. # and other systems, we tell gtest to always use it's internal engine.
...@@ -54,6 +53,11 @@ config("gtest_config") { ...@@ -54,6 +53,11 @@ config("gtest_config") {
} }
} }
config("gtest_direct_config") {
visibility = ":*"
defines = [ "UNIT_TEST" ]
}
static_library("gtest") { static_library("gtest") {
sources = [ sources = [
"include/gtest/gtest-death-test.h", "include/gtest/gtest-death-test.h",
...@@ -100,6 +104,7 @@ static_library("gtest") { ...@@ -100,6 +104,7 @@ static_library("gtest") {
include_dirs = [ "." ] include_dirs = [ "." ]
all_dependent_configs = [ ":gtest_config" ] all_dependent_configs = [ ":gtest_config" ]
direct_dependent_configs = [ ":gtest_direct_config" ]
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment