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

git-svn-id: http://src.chromium.org/svn/trunk/src/build@288988 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
jamesr@chromium.org 2014-08-12 15:45:19 +00:00
Родитель 27654960d9
Коммит 0603299dc4
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -9,7 +9,6 @@ config("gtest_config") {
]
defines = [
"UNIT_TEST",
# 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.
@ -54,6 +53,11 @@ config("gtest_config") {
}
}
config("gtest_direct_config") {
visibility = ":*"
defines = [ "UNIT_TEST" ]
}
static_library("gtest") {
sources = [
"include/gtest/gtest-death-test.h",
@ -100,6 +104,7 @@ static_library("gtest") {
include_dirs = [ "." ]
all_dependent_configs = [ ":gtest_config" ]
direct_dependent_configs = [ ":gtest_direct_config" ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]