| # Copyright 2018 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # This configuration was adapted from crashpad's gtest configuration. |
| # The purpose is to configure gtest and gmock so that it can be |
| # used to compile/run tests standalone, that is, outside the Chromium |
| # tree. This file also declares tests of the setup, which are useful |
| # when upgrading gtest / gmock to new versions (see the DEPS file). |
| |
| import("//testing/test.gni") |
| |
| config("gtest_private_config") { |
| visibility = [ ":*" ] |
| include_dirs = [ "gtest/googletest" ] |
| ldflags = [ "-pthread" ] |
| } |
| |
| config("gtest_public_config") { |
| include_dirs = [ "gtest/googletest/include" ] |
| ldflags = [ "-pthread" ] |
| } |
| |
| static_library("gtest") { |
| testonly = true |
| sources = [ |
| "gtest/googletest/include/gtest/gtest-death-test.h", |
| "gtest/googletest/include/gtest/gtest-matchers.h", |
| "gtest/googletest/include/gtest/gtest-message.h", |
| "gtest/googletest/include/gtest/gtest-param-test.h", |
| "gtest/googletest/include/gtest/gtest-printers.h", |
| "gtest/googletest/include/gtest/gtest-spi.h", |
| "gtest/googletest/include/gtest/gtest-test-part.h", |
| "gtest/googletest/include/gtest/gtest-typed-test.h", |
| "gtest/googletest/include/gtest/gtest.h", |
| "gtest/googletest/include/gtest/gtest_pred_impl.h", |
| "gtest/googletest/include/gtest/gtest_prod.h", |
| "gtest/googletest/include/gtest/internal/custom/gtest-port.h", |
| "gtest/googletest/include/gtest/internal/custom/gtest-printers.h", |
| "gtest/googletest/include/gtest/internal/custom/gtest.h", |
| "gtest/googletest/include/gtest/internal/gtest-death-test-internal.h", |
| "gtest/googletest/include/gtest/internal/gtest-filepath.h", |
| "gtest/googletest/include/gtest/internal/gtest-internal.h", |
| "gtest/googletest/include/gtest/internal/gtest-param-util-generated.h", |
| "gtest/googletest/include/gtest/internal/gtest-param-util.h", |
| "gtest/googletest/include/gtest/internal/gtest-port-arch.h", |
| "gtest/googletest/include/gtest/internal/gtest-port.h", |
| "gtest/googletest/include/gtest/internal/gtest-string.h", |
| "gtest/googletest/include/gtest/internal/gtest-type-util.h", |
| "gtest/googletest/src/gtest-all.cc", |
| "gtest/googletest/src/gtest-death-test.cc", |
| "gtest/googletest/src/gtest-filepath.cc", |
| "gtest/googletest/src/gtest-internal-inl.h", |
| "gtest/googletest/src/gtest-matchers.cc", |
| "gtest/googletest/src/gtest-port.cc", |
| "gtest/googletest/src/gtest-printers.cc", |
| "gtest/googletest/src/gtest-test-part.cc", |
| "gtest/googletest/src/gtest-typed-test.cc", |
| "gtest/googletest/src/gtest.cc", |
| ] |
| sources -= [ "gtest/googletest/src/gtest-all.cc" ] |
| public_configs = [ ":gtest_public_config" ] |
| configs -= [ |
| "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors", |
| ] |
| configs += [ ":gtest_private_config" ] |
| } |
| |
| static_library("gtest_main") { |
| # Tests outside of this file should use ../../test:gtest_main instead. |
| visibility = [ ":*" ] |
| |
| testonly = true |
| sources = [ |
| "gtest/googletest/src/gtest_main.cc", |
| ] |
| deps = [ |
| ":gtest", |
| ] |
| } |
| |
| test("gtest_all_test") { |
| sources = [ |
| "gtest/googletest/test/googletest-death-test-test.cc", |
| "gtest/googletest/test/googletest-filepath-test.cc", |
| "gtest/googletest/test/googletest-message-test.cc", |
| "gtest/googletest/test/googletest-options-test.cc", |
| "gtest/googletest/test/googletest-port-test.cc", |
| "gtest/googletest/test/googletest-printers-test.cc", |
| "gtest/googletest/test/googletest-test-part-test.cc", |
| "gtest/googletest/test/googletest-test2_test.cc", |
| "gtest/googletest/test/gtest-typed-test2_test.cc", |
| "gtest/googletest/test/gtest-typed-test_test.cc", |
| "gtest/googletest/test/gtest-typed-test_test.h", |
| "gtest/googletest/test/gtest_main_unittest.cc", |
| "gtest/googletest/test/gtest_pred_impl_unittest.cc", |
| "gtest/googletest/test/gtest_prod_test.cc", |
| "gtest/googletest/test/gtest_unittest.cc", |
| "gtest/googletest/test/production.cc", |
| "gtest/googletest/test/production.h", |
| ] |
| configs -= [ |
| "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors", |
| ] |
| configs += [ ":gtest_private_config" ] |
| deps = [ |
| ":gtest", |
| ":gtest_main", |
| ] |
| } |
| |
| test("gtest_environment_test") { |
| sources = [ |
| "gtest/googletest/test/gtest_environment_test.cc", |
| ] |
| configs += [ ":gtest_private_config" ] |
| deps = [ |
| ":gtest", |
| ] |
| } |
| |
| test("gtest_listener_test") { |
| sources = [ |
| "gtest/googletest/test/googletest-listener-test.cc", |
| ] |
| configs += [ ":gtest_private_config" ] |
| deps = [ |
| ":gtest", |
| ] |
| } |
| |
| test("gtest_no_test") { |
| sources = [ |
| "gtest/googletest/test/gtest_no_test_unittest.cc", |
| ] |
| configs += [ ":gtest_private_config" ] |
| deps = [ |
| ":gtest", |
| ] |
| } |
| |
| test("gtest_param_test") { |
| sources = [ |
| "gtest/googletest/test/googletest-param-test2-test.cc", |
| "gtest/googletest/test/googletest-param-test-test.cc", |
| "gtest/googletest/test/googletest-param-test-test.h", |
| ] |
| configs -= [ |
| "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors", |
| ] |
| configs += [ ":gtest_private_config" ] |
| deps = [ |
| ":gtest", |
| ] |
| } |
| |
| test("gtest_premature_exit_test") { |
| sources = [ |
| "gtest/googletest/test/gtest_premature_exit_test.cc", |
| ] |
| configs += [ ":gtest_private_config" ] |
| deps = [ |
| ":gtest", |
| ] |
| } |
| |
| test("gtest_repeat_test") { |
| sources = [ |
| "gtest/googletest/test/gtest_repeat_test.cc", |
| ] |
| configs += [ ":gtest_private_config" ] |
| deps = [ |
| ":gtest", |
| ] |
| } |
| |
| test("gtest_sole_header_test") { |
| sources = [ |
| "gtest/googletest/test/gtest_sole_header_test.cc", |
| ] |
| configs += [ ":gtest_private_config" ] |
| deps = [ |
| ":gtest", |
| ":gtest_main", |
| ] |
| } |
| |
| test("gtest_stress_test") { |
| sources = [ |
| "gtest/googletest/test/gtest_stress_test.cc", |
| ] |
| configs += [ ":gtest_private_config" ] |
| deps = [ |
| ":gtest", |
| ] |
| } |
| |
| test("gtest_unittest_api_test") { |
| sources = [ |
| "gtest/googletest/test/gtest-unittest-api_test.cc", |
| ] |
| configs += [ ":gtest_private_config" ] |
| deps = [ |
| ":gtest", |
| ] |
| } |
| |
| group("gtest_all_tests") { |
| testonly = true |
| deps = [ |
| ":gtest_all_test", |
| ":gtest_environment_test", |
| ":gtest_listener_test", |
| ":gtest_no_test", |
| ":gtest_param_test", |
| ":gtest_premature_exit_test", |
| ":gtest_repeat_test", |
| ":gtest_sole_header_test", |
| ":gtest_stress_test", |
| ":gtest_unittest_api_test", |
| ] |
| } |
| |
| config("gmock_private_config") { |
| visibility = [ ":*" ] |
| include_dirs = [ "gtest/googlemock" ] |
| ldflags = [ "-pthread" ] |
| } |
| |
| config("gmock_public_config") { |
| include_dirs = [ "gtest/googlemock/include" ] |
| ldflags = [ "-pthread" ] |
| } |
| |
| static_library("gmock") { |
| testonly = true |
| sources = [ |
| "gtest/googlemock/include/gmock/gmock-actions.h", |
| "gtest/googlemock/include/gmock/gmock-cardinalities.h", |
| "gtest/googlemock/include/gmock/gmock-function-mocker.h", |
| "gtest/googlemock/include/gmock/gmock-generated-actions.h", |
| "gtest/googlemock/include/gmock/gmock-generated-function-mockers.h", |
| "gtest/googlemock/include/gmock/gmock-generated-matchers.h", |
| "gtest/googlemock/include/gmock/gmock-matchers.h", |
| "gtest/googlemock/include/gmock/gmock-more-actions.h", |
| "gtest/googlemock/include/gmock/gmock-more-matchers.h", |
| "gtest/googlemock/include/gmock/gmock-nice-strict.h", |
| "gtest/googlemock/include/gmock/gmock-spec-builders.h", |
| "gtest/googlemock/include/gmock/gmock.h", |
| "gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h", |
| "gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h", |
| "gtest/googlemock/include/gmock/internal/custom/gmock-port.h", |
| "gtest/googlemock/include/gmock/internal/gmock-internal-utils.h", |
| "gtest/googlemock/include/gmock/internal/gmock-port.h", |
| "gtest/googlemock/include/gmock/internal/gmock-pp.h", |
| "gtest/googlemock/src/gmock-all.cc", |
| "gtest/googlemock/src/gmock-cardinalities.cc", |
| "gtest/googlemock/src/gmock-internal-utils.cc", |
| "gtest/googlemock/src/gmock-matchers.cc", |
| "gtest/googlemock/src/gmock-spec-builders.cc", |
| "gtest/googlemock/src/gmock.cc", |
| ] |
| sources -= [ "gtest/googlemock/src/gmock-all.cc" ] |
| public_configs = [ ":gmock_public_config" ] |
| configs -= [ |
| "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors", |
| ] |
| configs += [ ":gmock_private_config" ] |
| deps = [ |
| ":gtest", |
| ] |
| } |
| |
| static_library("gmock_main") { |
| # Tests outside of this file should use ../../test:gmock_main instead. |
| visibility = [ ":*" ] |
| testonly = true |
| sources = [ |
| "gtest/googlemock/src/gmock_main.cc", |
| ] |
| deps = [ |
| ":gmock", |
| ":gtest", |
| ] |
| } |
| |
| test("gmock_all_test") { |
| sources = [ |
| "gtest/googlemock/test/gmock-actions_test.cc", |
| "gtest/googlemock/test/gmock-cardinalities_test.cc", |
| "gtest/googlemock/test/gmock-generated-actions_test.cc", |
| "gtest/googlemock/test/gmock-generated-function-mockers_test.cc", |
| "gtest/googlemock/test/gmock-generated-matchers_test.cc", |
| "gtest/googlemock/test/gmock-internal-utils_test.cc", |
| "gtest/googlemock/test/gmock-matchers_test.cc", |
| "gtest/googlemock/test/gmock-more-actions_test.cc", |
| "gtest/googlemock/test/gmock-nice-strict_test.cc", |
| "gtest/googlemock/test/gmock-port_test.cc", |
| "gtest/googlemock/test/gmock-pp-string_test.cc", |
| "gtest/googlemock/test/gmock-pp_test.cc", |
| "gtest/googlemock/test/gmock-spec-builders_test.cc", |
| "gtest/googlemock/test/gmock_test.cc", |
| ] |
| configs += [ |
| ":gmock_private_config", |
| ":gtest_private_config", |
| ] |
| deps = [ |
| ":gmock", |
| ":gmock_main", |
| ":gtest", |
| ] |
| } |
| |
| test("gmock_link_test") { |
| sources = [ |
| "gtest/googlemock/test/gmock_link2_test.cc", |
| "gtest/googlemock/test/gmock_link_test.cc", |
| "gtest/googlemock/test/gmock_link_test.h", |
| ] |
| configs += [ ":gmock_private_config" ] |
| deps = [ |
| ":gmock", |
| ":gmock_main", |
| ":gtest", |
| ] |
| } |
| |
| test("gmock_stress_test") { |
| sources = [ |
| "gtest/googlemock/test/gmock_stress_test.cc", |
| ] |
| configs -= [ |
| "//third_party/mini_chromium/mini_chromium/build:Wexit_time_destructors", |
| ] |
| configs += [ ":gmock_private_config" ] |
| deps = [ |
| ":gmock", |
| ":gtest", |
| ] |
| } |
| |
| group("gmock_all_tests") { |
| testonly = true |
| deps = [ |
| ":gmock_all_test", |
| ":gmock_link_test", |
| ":gmock_stress_test", |
| ] |
| } |