summaryrefslogtreecommitdiff
path: root/chromium/third_party/googletest
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/third_party/googletest
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/googletest')
-rw-r--r--chromium/third_party/googletest/BUILD.gn7
-rw-r--r--chromium/third_party/googletest/OWNERS1
-rw-r--r--chromium/third_party/googletest/custom/gtest/internal/custom/stack_trace_getter.cc2
-rw-r--r--chromium/third_party/googletest/src/.travis.yml17
-rw-r--r--chromium/third_party/googletest/src/BUILD.bazel1
-rw-r--r--chromium/third_party/googletest/src/README.md6
-rwxr-xr-xchromium/third_party/googletest/src/ci/build-linux-bazel.sh1
-rwxr-xr-xchromium/third_party/googletest/src/ci/env-linux.sh4
-rwxr-xr-xchromium/third_party/googletest/src/ci/install-linux.sh2
-rw-r--r--chromium/third_party/googletest/src/googlemock/CMakeLists.txt2
-rw-r--r--chromium/third_party/googletest/src/googlemock/docs/cheat_sheet.md5
-rw-r--r--chromium/third_party/googletest/src/googlemock/docs/community_created_documentation.md9
-rw-r--r--chromium/third_party/googletest/src/googlemock/docs/cook_book.md6
-rw-r--r--chromium/third_party/googletest/src/googlemock/include/gmock/gmock-actions.h8
-rw-r--r--chromium/third_party/googletest/src/googletest/CMakeLists.txt2
-rw-r--r--chromium/third_party/googletest/src/googletest/docs/advanced.md9
-rw-r--r--chromium/third_party/googletest/src/googletest/docs/primer.md2
-rw-r--r--chromium/third_party/googletest/src/googletest/include/gtest/gtest-printers.h86
-rw-r--r--chromium/third_party/googletest/src/googletest/include/gtest/gtest.h6
-rw-r--r--chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-internal.h7
-rw-r--r--chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h105
-rw-r--r--chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-type-util.h38
-rw-r--r--chromium/third_party/googletest/src/googletest/src/gtest-filepath.cc36
-rw-r--r--chromium/third_party/googletest/src/googletest/src/gtest-printers.cc5
-rw-r--r--chromium/third_party/googletest/src/googletest/src/gtest-typed-test.cc12
-rw-r--r--chromium/third_party/googletest/src/googletest/src/gtest.cc39
26 files changed, 303 insertions, 115 deletions
diff --git a/chromium/third_party/googletest/BUILD.gn b/chromium/third_party/googletest/BUILD.gn
index 52c2858852b..dbcf8da7199 100644
--- a/chromium/third_party/googletest/BUILD.gn
+++ b/chromium/third_party/googletest/BUILD.gn
@@ -134,12 +134,7 @@ source_set("gtest") {
]
if (gtest_enable_absl_printers) {
public_deps += [
- "//third_party/abseil-cpp/absl/debugging:failure_signal_handler",
- "//third_party/abseil-cpp/absl/debugging:stacktrace",
- "//third_party/abseil-cpp/absl/debugging:symbolize",
- "//third_party/abseil-cpp/absl/strings",
- "//third_party/abseil-cpp/absl/types:optional",
- "//third_party/abseil-cpp/absl/types:variant",
+ "//third_party/abseil-cpp:absl",
]
}
} else {
diff --git a/chromium/third_party/googletest/OWNERS b/chromium/third_party/googletest/OWNERS
index 507760e8a55..73f2ea54b86 100644
--- a/chromium/third_party/googletest/OWNERS
+++ b/chromium/third_party/googletest/OWNERS
@@ -1,4 +1,5 @@
thakis@chromium.org
pwnall@chromium.org
dpranke@chromium.org
+dpranke@google.com
# COMPONENT: Test>gTest
diff --git a/chromium/third_party/googletest/custom/gtest/internal/custom/stack_trace_getter.cc b/chromium/third_party/googletest/custom/gtest/internal/custom/stack_trace_getter.cc
index e5fd95bc631..7c7ae1efabb 100644
--- a/chromium/third_party/googletest/custom/gtest/internal/custom/stack_trace_getter.cc
+++ b/chromium/third_party/googletest/custom/gtest/internal/custom/stack_trace_getter.cc
@@ -7,7 +7,7 @@
#include <algorithm>
#include <iterator>
-#include "base/logging.h"
+#include "base/check.h"
std::string StackTraceGetter::CurrentStackTrace(int max_depth, int skip_count) {
DCHECK(stack_trace_upon_leaving_gtest_)
diff --git a/chromium/third_party/googletest/src/.travis.yml b/chromium/third_party/googletest/src/.travis.yml
index 930f994487a..d7b23b94991 100644
--- a/chromium/third_party/googletest/src/.travis.yml
+++ b/chromium/third_party/googletest/src/.travis.yml
@@ -14,19 +14,21 @@ matrix:
install: ./ci/install-platformio.sh
script: ./ci/build-platformio.sh
- os: linux
- dist: xenial
+ dist: bionic
compiler: gcc
install: ./ci/install-linux.sh && ./ci/log-config.sh
script: ./ci/build-linux-bazel.sh
- os: linux
- dist: xenial
+ dist: bionic
compiler: clang
install: ./ci/install-linux.sh && ./ci/log-config.sh
script: ./ci/build-linux-bazel.sh
- os: linux
+ dist: bionic
compiler: gcc
env: BUILD_TYPE=Debug VERBOSE=1 CXX_FLAGS="-std=c++11 -Wdeprecated"
- os: linux
+ dist: bionic
compiler: clang
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS="-std=c++11 -Wdeprecated" NO_EXCEPTION=ON NO_RTTI=ON COMPILER_IS_GNUCXX=ON
- os: osx
@@ -48,16 +50,9 @@ script: ./ci/travis.sh
# This section installs the necessary dependencies.
addons:
apt:
- # List of whitelisted in travis packages for ubuntu-precise can be found here:
- # https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
- # List of whitelisted in travis apt-sources:
- # https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
- sources:
- - ubuntu-toolchain-r-test
- - llvm-toolchain-precise-3.9
packages:
- - g++-4.9
- - clang-3.9
+ - g++
+ - clang
update: true
homebrew:
packages:
diff --git a/chromium/third_party/googletest/src/BUILD.bazel b/chromium/third_party/googletest/src/BUILD.bazel
index 9b48aee5308..7e227aa00eb 100644
--- a/chromium/third_party/googletest/src/BUILD.bazel
+++ b/chromium/third_party/googletest/src/BUILD.bazel
@@ -103,6 +103,7 @@ cc_library(
"@com_google_absl//absl/debugging:stacktrace",
"@com_google_absl//absl/debugging:symbolize",
"@com_google_absl//absl/strings",
+ "@com_google_absl//absl/types:any",
"@com_google_absl//absl/types:optional",
"@com_google_absl//absl/types:variant",
],
diff --git a/chromium/third_party/googletest/src/README.md b/chromium/third_party/googletest/src/README.md
index e332e9a216c..1727866297f 100644
--- a/chromium/third_party/googletest/src/README.md
+++ b/chromium/third_party/googletest/src/README.md
@@ -102,9 +102,9 @@ runs tests from your binary in parallel to provide significant speed-up.
is a VS Code extension allowing to view Google Tests in a tree view, and
run/debug your tests.
-[Catch2 and Google Test Explorer](https://github.com/matepek/vscode-catch2-test-adapter)
-is a VS Code extension allowing to view Google Tests in a tree view, and
-run/debug your tests.
+[C++ TestMate](https://github.com/matepek/vscode-catch2-test-adapter) is a VS
+Code extension allowing to view Google Tests in a tree view, and run/debug your
+tests.
[Cornichon](https://pypi.org/project/cornichon/) is a small Gherkin DSL parser
that generates stub code for Google Test.
diff --git a/chromium/third_party/googletest/src/ci/build-linux-bazel.sh b/chromium/third_party/googletest/src/ci/build-linux-bazel.sh
index ae8fb75816f..cfb06a9e0ad 100755
--- a/chromium/third_party/googletest/src/ci/build-linux-bazel.sh
+++ b/chromium/third_party/googletest/src/ci/build-linux-bazel.sh
@@ -32,6 +32,5 @@
set -e
bazel version
-bazel build --curses=no //...:all
bazel test --curses=no //...:all
bazel test --curses=no //...:all --define absl=1
diff --git a/chromium/third_party/googletest/src/ci/env-linux.sh b/chromium/third_party/googletest/src/ci/env-linux.sh
index 37800d6a355..7d2b8a8c5ca 100755
--- a/chromium/third_party/googletest/src/ci/env-linux.sh
+++ b/chromium/third_party/googletest/src/ci/env-linux.sh
@@ -36,6 +36,6 @@
# TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}.
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
- if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi
+ if [ "$CXX" = "g++" ]; then export CXX="g++" CC="gcc"; fi
+ if [ "$CXX" = "clang++" ]; then export CXX="clang++" CC="clang"; fi
fi
diff --git a/chromium/third_party/googletest/src/ci/install-linux.sh b/chromium/third_party/googletest/src/ci/install-linux.sh
index 05e2cb28031..f98ac7d89b1 100755
--- a/chromium/third_party/googletest/src/ci/install-linux.sh
+++ b/chromium/third_party/googletest/src/ci/install-linux.sh
@@ -41,7 +41,7 @@ if [ "${TRAVIS_SUDO}" = "true" ]; then
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | \
sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
- sudo apt-get update && sudo apt-get install -y bazel gcc-4.9 g++-4.9 clang-3.9
+ sudo apt-get update && sudo apt-get install -y bazel gcc g++ clang
elif [ "${CXX}" = "clang++" ]; then
# Use ccache, assuming $HOME/bin is in the path, which is true in the Travis build environment.
ln -sf /usr/bin/ccache $HOME/bin/${CXX};
diff --git a/chromium/third_party/googletest/src/googlemock/CMakeLists.txt b/chromium/third_party/googletest/src/googlemock/CMakeLists.txt
index 8ab59d7f6cd..079c8c9639e 100644
--- a/chromium/third_party/googletest/src/googlemock/CMakeLists.txt
+++ b/chromium/third_party/googletest/src/googlemock/CMakeLists.txt
@@ -100,8 +100,10 @@ if (MSVC)
else()
cxx_library(gmock "${cxx_strict}" src/gmock-all.cc)
target_link_libraries(gmock PUBLIC gtest)
+ set_target_properties(gmock PROPERTIES VERSION ${GOOGLETEST_VERSION})
cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc)
target_link_libraries(gmock_main PUBLIC gmock)
+ set_target_properties(gmock_main PROPERTIES VERSION ${GOOGLETEST_VERSION})
endif()
# If the CMake version supports it, attach header directory information
# to the targets for when we are part of a parent build (ie being pulled
diff --git a/chromium/third_party/googletest/src/googlemock/docs/cheat_sheet.md b/chromium/third_party/googletest/src/googlemock/docs/cheat_sheet.md
index 1e0541ba81c..f2fb272356d 100644
--- a/chromium/third_party/googletest/src/googlemock/docs/cheat_sheet.md
+++ b/chromium/third_party/googletest/src/googlemock/docs/cheat_sheet.md
@@ -239,6 +239,11 @@ A **matcher** matches a *single* argument. You can use it inside `ON_CALL()` or
| `ASSERT_THAT(actual_value, matcher)` | The same as `EXPECT_THAT(actual_value, matcher)`, except that it generates a **fatal** failure. |
<!-- mdformat on -->
+**Note:** Although equality matching via `EXPECT_THAT(actual_value,
+expected_value)` is supported, prefer to make the comparison explicit via
+`EXPECT_THAT(actual_value, Eq(expected_value))` or `EXPECT_EQ(actual_value,
+expected_value)`.
+
Built-in matchers (where `argument` is the function argument, e.g.
`actual_value` in the example above, or when used in the context of
`EXPECT_CALL(mock_object, method(matchers))`, the arguments of `method`) are
diff --git a/chromium/third_party/googletest/src/googlemock/docs/community_created_documentation.md b/chromium/third_party/googletest/src/googlemock/docs/community_created_documentation.md
new file mode 100644
index 00000000000..dfd87f7a61b
--- /dev/null
+++ b/chromium/third_party/googletest/src/googlemock/docs/community_created_documentation.md
@@ -0,0 +1,9 @@
+# Community-Created Documentation
+
+go/gunit-community-created-docs
+
+The following is a list, in no particular order, of links to documentation
+created by the Googletest community.
+
+* [Googlemock Insights](https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/googletest/insights.md),
+ by [ElectricRCAircraftGuy](https://github.com/ElectricRCAircraftGuy)
diff --git a/chromium/third_party/googletest/src/googlemock/docs/cook_book.md b/chromium/third_party/googletest/src/googlemock/docs/cook_book.md
index 4dbfbe09f78..bffbb3c008e 100644
--- a/chromium/third_party/googletest/src/googlemock/docs/cook_book.md
+++ b/chromium/third_party/googletest/src/googlemock/docs/cook_book.md
@@ -410,8 +410,8 @@ NOTE: `NiceMock` and `StrictMock` only affects *uninteresting* calls (calls of
methods with expectations, but they don't match). See
[Understanding Uninteresting vs Unexpected Calls](#uninteresting-vs-unexpected).
-There are some caveats though (I dislike them just as much as the next guy, but
-sadly they are side effects of C++'s limitations):
+There are some caveats though (sadly they are side effects of C++'s
+limitations):
1. `NiceMock<MockFoo>` and `StrictMock<MockFoo>` only work for mock methods
defined using the `MOCK_METHOD` macro **directly** in the `MockFoo` class.
@@ -2686,7 +2686,7 @@ TEST(EventQueueTest, EnqueueEventTest) {
EventQueue event_queue(&mock_event_dispatcher);
const int32 kEventId = 321;
- Notification done;
+ absl::Notification done;
EXPECT_CALL(mock_event_dispatcher, DispatchEvent(kEventId))
.WillOnce(Notify(&done));
diff --git a/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-actions.h b/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-actions.h
index 0f30abde890..ecf47c4048a 100644
--- a/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-actions.h
+++ b/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-actions.h
@@ -1335,15 +1335,17 @@ class ActionHelper {
public:
template <typename... Ts>
static Result Perform(Impl* impl, const std::tuple<Ts...>& args) {
- return Apply(impl, args, MakeIndexSequence<sizeof...(Ts)>{},
- MakeIndexSequence<10 - sizeof...(Ts)>{});
+ static constexpr size_t kMaxArgs = sizeof...(Ts) <= 10 ? sizeof...(Ts) : 10;
+ return Apply(impl, args, MakeIndexSequence<kMaxArgs>{},
+ MakeIndexSequence<10 - kMaxArgs>{});
}
private:
template <typename... Ts, std::size_t... tuple_ids, std::size_t... rest_ids>
static Result Apply(Impl* impl, const std::tuple<Ts...>& args,
IndexSequence<tuple_ids...>, IndexSequence<rest_ids...>) {
- return impl->template gmock_PerformImpl<Ts...>(
+ return impl->template gmock_PerformImpl<
+ typename std::tuple_element<tuple_ids, std::tuple<Ts...>>::type...>(
args, std::get<tuple_ids>(args)...,
((void)rest_ids, ExcessiveArg())...);
}
diff --git a/chromium/third_party/googletest/src/googletest/CMakeLists.txt b/chromium/third_party/googletest/src/googletest/CMakeLists.txt
index 4fd7b5262e3..f538c967fde 100644
--- a/chromium/third_party/googletest/src/googletest/CMakeLists.txt
+++ b/chromium/third_party/googletest/src/googletest/CMakeLists.txt
@@ -126,7 +126,9 @@ include_directories(${gtest_build_include_dirs})
# are used for other targets, to ensure that gtest can be compiled by a user
# aggressive about warnings.
cxx_library(gtest "${cxx_strict}" src/gtest-all.cc)
+set_target_properties(gtest PROPERTIES VERSION ${GOOGLETEST_VERSION})
cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
+set_target_properties(gtest_main PROPERTIES VERSION ${GOOGLETEST_VERSION})
# If the CMake version supports it, attach header directory information
# to the targets for when we are part of a parent build (ie being pulled
# in via add_subdirectory() rather than being a standalone build).
diff --git a/chromium/third_party/googletest/src/googletest/docs/advanced.md b/chromium/third_party/googletest/src/googletest/docs/advanced.md
index a5dd622635c..60c1a2b0b51 100644
--- a/chromium/third_party/googletest/src/googletest/docs/advanced.md
+++ b/chromium/third_party/googletest/src/googletest/docs/advanced.md
@@ -1006,7 +1006,7 @@ TEST(FooTest, Bar) {
// in Subroutine() to abort the entire test.
// The actual behavior: the function goes on after Subroutine() returns.
- int* p = NULL;
+ int* p = nullptr;
*p = 3; // Segfault!
}
```
@@ -1193,7 +1193,7 @@ class FooTest : public ::testing::Test {
// Can be omitted if not needed.
static void TearDownTestSuite() {
delete shared_resource_;
- shared_resource_ = NULL;
+ shared_resource_ = nullptr;
}
// You can define per-test set-up logic as usual.
@@ -1206,7 +1206,7 @@ class FooTest : public ::testing::Test {
static T* shared_resource_;
};
-T* FooTest::shared_resource_ = NULL;
+T* FooTest::shared_resource_ = nullptr;
TEST_F(FooTest, Test1) {
... you can refer to shared_resource_ here ...
@@ -2288,8 +2288,7 @@ environment variable to `0`.
googletest can emit a detailed XML report to a file in addition to its normal
textual output. The report contains the duration of each test, and thus can help
-you identify slow tests. The report is also used by the http://unittest
-dashboard to show per-test-method error messages.
+you identify slow tests.
To generate the XML report, set the `GTEST_OUTPUT` environment variable or the
`--gtest_output` flag to the string `"xml:path_to_output_file"`, which will
diff --git a/chromium/third_party/googletest/src/googletest/docs/primer.md b/chromium/third_party/googletest/src/googletest/docs/primer.md
index f581d77a9ba..2f459fd7fd9 100644
--- a/chromium/third_party/googletest/src/googletest/docs/primer.md
+++ b/chromium/third_party/googletest/src/googletest/docs/primer.md
@@ -169,7 +169,7 @@ you'll get a compiler error. We used to require the arguments to support the
`<<` is supported, it will be called to print the arguments when the assertion
fails; otherwise googletest will attempt to print them in the best way it can.
For more details and how to customize the printing of the arguments, see the
-[documentation](../../googlemock/docs/cook_book.md#teaching-gmock-how-to-print-your-values).
+[documentation](./advanced.md#teaching-googletest-how-to-print-your-values).
These assertions can work with a user-defined type, but only if you define the
corresponding comparison operator (e.g., `==` or `<`). Since this is discouraged
diff --git a/chromium/third_party/googletest/src/googletest/include/gtest/gtest-printers.h b/chromium/third_party/googletest/src/googletest/include/gtest/gtest-printers.h
index 75e4422a519..c74894b023a 100644
--- a/chromium/third_party/googletest/src/googletest/include/gtest/gtest-printers.h
+++ b/chromium/third_party/googletest/src/googletest/include/gtest/gtest-printers.h
@@ -113,8 +113,6 @@
#if GTEST_HAS_ABSL
#include "absl/strings/string_view.h"
-#include "absl/types/optional.h"
-#include "absl/types/variant.h"
#endif // GTEST_HAS_ABSL
namespace testing {
@@ -362,6 +360,14 @@ GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
+#ifdef __cpp_char8_t
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char8_t);
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char8_t);
+#endif
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char16_t);
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char16_t);
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char32_t);
+GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char32_t);
#undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
@@ -379,6 +385,14 @@ GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
+#ifdef __cpp_char8_t
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char8_t, ::std::u8string);
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char8_t, ::std::u8string);
+#endif
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char16_t, ::std::u16string);
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char16_t, ::std::u16string);
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char32_t, ::std::u32string);
+GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char32_t, ::std::u32string);
#if GTEST_HAS_STD_WSTRING
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);
@@ -455,6 +469,16 @@ inline void PrintTo(bool x, ::std::ostream* os) {
// is implemented as an unsigned type.
GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os);
+GTEST_API_ void PrintTo(char32_t c, ::std::ostream* os);
+inline void PrintTo(char16_t c, ::std::ostream* os) {
+ PrintTo(ImplicitCast_<char32_t>(c), os);
+}
+#ifdef __cpp_char8_t
+inline void PrintTo(char8_t c, ::std::ostream* os) {
+ PrintTo(ImplicitCast_<char32_t>(c), os);
+}
+#endif
+
// Overloads for C strings.
GTEST_API_ void PrintTo(const char* s, ::std::ostream* os);
inline void PrintTo(char* s, ::std::ostream* os) {
@@ -596,14 +620,42 @@ class UniversalPrinter {
GTEST_DISABLE_MSC_WARNINGS_POP_()
};
-#if GTEST_HAS_ABSL
+#if GTEST_INTERNAL_HAS_ANY
-// Printer for absl::optional
+// Printer for std::any / absl::any
+
+template <>
+class UniversalPrinter<Any> {
+ public:
+ static void Print(const Any& value, ::std::ostream* os) {
+ if (value.has_value()) {
+ *os << "value of type " << GetTypeName(value);
+ } else {
+ *os << "no value";
+ }
+ }
+
+ private:
+ static std::string GetTypeName(const Any& value) {
+#if GTEST_HAS_RTTI
+ return internal::GetTypeName(value.type());
+#else
+ static_cast<void>(value); // possibly unused
+ return "<unknown_type>";
+#endif // GTEST_HAS_RTTI
+ }
+};
+
+#endif // GTEST_INTERNAL_HAS_ANY
+
+#if GTEST_INTERNAL_HAS_OPTIONAL
+
+// Printer for std::optional / absl::optional
template <typename T>
-class UniversalPrinter<::absl::optional<T>> {
+class UniversalPrinter<Optional<T>> {
public:
- static void Print(const ::absl::optional<T>& value, ::std::ostream* os) {
+ static void Print(const Optional<T>& value, ::std::ostream* os) {
*os << '(';
if (!value) {
*os << "nullopt";
@@ -614,14 +666,22 @@ class UniversalPrinter<::absl::optional<T>> {
}
};
-// Printer for absl::variant
+#endif // GTEST_INTERNAL_HAS_OPTIONAL
+
+#if GTEST_INTERNAL_HAS_VARIANT
+
+// Printer for std::variant / absl::variant
template <typename... T>
-class UniversalPrinter<::absl::variant<T...>> {
+class UniversalPrinter<Variant<T...>> {
public:
- static void Print(const ::absl::variant<T...>& value, ::std::ostream* os) {
+ static void Print(const Variant<T...>& value, ::std::ostream* os) {
*os << '(';
- absl::visit(Visitor{os}, value);
+#if GTEST_HAS_ABSL
+ absl::visit(Visitor{os, value.index()}, value);
+#else
+ std::visit(Visitor{os, value.index()}, value);
+#endif // GTEST_HAS_ABSL
*os << ')';
}
@@ -629,14 +689,16 @@ class UniversalPrinter<::absl::variant<T...>> {
struct Visitor {
template <typename U>
void operator()(const U& u) const {
- *os << "'" << GetTypeName<U>() << "' with value ";
+ *os << "'" << GetTypeName<U>() << "(index = " << index
+ << ")' with value ";
UniversalPrint(u, os);
}
::std::ostream* os;
+ std::size_t index;
};
};
-#endif // GTEST_HAS_ABSL
+#endif // GTEST_INTERNAL_HAS_VARIANT
// UniversalPrintArray(begin, len, os) prints an array of 'len'
// elements, starting at address 'begin'.
diff --git a/chromium/third_party/googletest/src/googletest/include/gtest/gtest.h b/chromium/third_party/googletest/src/googletest/include/gtest/gtest.h
index f53c58405a6..a0942b49a23 100644
--- a/chromium/third_party/googletest/src/googletest/include/gtest/gtest.h
+++ b/chromium/third_party/googletest/src/googletest/include/gtest/gtest.h
@@ -418,10 +418,10 @@ class GTEST_API_ Test {
// The d'tor is virtual as we intend to inherit from Test.
virtual ~Test();
- // Sets up the stuff shared by all tests in this test case.
+ // Sets up the stuff shared by all tests in this test suite.
//
// Google Test will call Foo::SetUpTestSuite() before running the first
- // test in test case Foo. Hence a sub-class can define its own
+ // test in test suite Foo. Hence a sub-class can define its own
// SetUpTestSuite() method to shadow the one defined in the super
// class.
static void SetUpTestSuite() {}
@@ -429,7 +429,7 @@ class GTEST_API_ Test {
// Tears down the stuff shared by all tests in this test suite.
//
// Google Test will call Foo::TearDownTestSuite() after running the last
- // test in test case Foo. Hence a sub-class can define its own
+ // test in test suite Foo. Hence a sub-class can define its own
// TearDownTestSuite() method to shadow the one defined in the super
// class.
static void TearDownTestSuite() {}
diff --git a/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-internal.h b/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-internal.h
index fabc80423b7..028f21eb54c 100644
--- a/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-internal.h
+++ b/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-internal.h
@@ -1283,8 +1283,13 @@ constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; }
// Suppress MSVC warning 4072 (unreachable code) for the code following
// statement if it returns or throws (or doesn't return or throw in some
// situations).
+// NOTE: The "else" is important to keep this expansion to prevent a top-level
+// "else" from attaching to our "if".
#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
- if (::testing::internal::AlwaysTrue()) { statement; }
+ if (::testing::internal::AlwaysTrue()) { \
+ statement; \
+ } else /* NOLINT */ \
+ static_assert(true, "") // User must have a semicolon after expansion.
#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
diff --git a/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h b/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h
index 893c7f30631..6f9c14ae5e2 100644
--- a/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h
+++ b/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h
@@ -199,9 +199,18 @@
// suppressed (constant conditional).
// GTEST_INTENTIONAL_CONST_COND_POP_ - finish code section where MSVC C4127
// is suppressed.
+// GTEST_INTERNAL_HAS_ANY - for enabling UniversalPrinter<std::any> or
+// UniversalPrinter<absl::any> specializations.
+// GTEST_INTERNAL_HAS_OPTIONAL - for enabling UniversalPrinter<std::optional>
+// or
+// UniversalPrinter<absl::optional>
+// specializations.
// GTEST_INTERNAL_HAS_STRING_VIEW - for enabling Matcher<std::string_view> or
// Matcher<absl::string_view>
// specializations.
+// GTEST_INTERNAL_HAS_VARIANT - for enabling UniversalPrinter<std::variant> or
+// UniversalPrinter<absl::variant>
+// specializations.
//
// Synchronization:
// Mutex, MutexLock, ThreadLocal, GetThreadCount()
@@ -269,6 +278,7 @@
#endif
#include <iostream> // NOLINT
+#include <locale>
#include <memory>
#include <string> // NOLINT
#include <tuple>
@@ -2045,7 +2055,15 @@ GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
inline int ChDir(const char* dir) { return chdir(dir); }
#endif
inline FILE* FOpen(const char* path, const char* mode) {
+#if GTEST_OS_WINDOWS
+ struct wchar_codecvt : public std::codecvt<wchar_t, char, std::mbstate_t> {};
+ std::wstring_convert<wchar_codecvt> converter;
+ std::wstring wide_path = converter.from_bytes(path);
+ std::wstring wide_mode = converter.from_bytes(mode);
+ return _wfopen(wide_path.c_str(), wide_mode.c_str());
+#else
return fopen(path, mode);
+#endif // GTEST_OS_WINDOWS
}
#if !GTEST_OS_WINDOWS_MOBILE
inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
@@ -2235,6 +2253,64 @@ const char* StringFromGTestEnv(const char* flag, const char* default_val);
#endif // !defined(GTEST_INTERNAL_DEPRECATED)
#if GTEST_HAS_ABSL
+// Always use absl::any for UniversalPrinter<> specializations if googletest
+// is built with absl support.
+#define GTEST_INTERNAL_HAS_ANY 1
+#include "absl/types/any.h"
+namespace testing {
+namespace internal {
+using Any = ::absl::any;
+} // namespace internal
+} // namespace testing
+#else
+#ifdef __has_include
+#if __has_include(<any>) && __cplusplus >= 201703L
+// Otherwise for C++17 and higher use std::any for UniversalPrinter<>
+// specializations.
+#define GTEST_INTERNAL_HAS_ANY 1
+#include <any>
+namespace testing {
+namespace internal {
+using Any = ::std::any;
+} // namespace internal
+} // namespace testing
+// The case where absl is configured NOT to alias std::any is not
+// supported.
+#endif // __has_include(<any>) && __cplusplus >= 201703L
+#endif // __has_include
+#endif // GTEST_HAS_ABSL
+
+#if GTEST_HAS_ABSL
+// Always use absl::optional for UniversalPrinter<> specializations if
+// googletest is built with absl support.
+#define GTEST_INTERNAL_HAS_OPTIONAL 1
+#include "absl/types/optional.h"
+namespace testing {
+namespace internal {
+template <typename T>
+using Optional = ::absl::optional<T>;
+} // namespace internal
+} // namespace testing
+#else
+#ifdef __has_include
+#if __has_include(<optional>) && __cplusplus >= 201703L
+// Otherwise for C++17 and higher use std::optional for UniversalPrinter<>
+// specializations.
+#define GTEST_INTERNAL_HAS_OPTIONAL 1
+#include <optional>
+namespace testing {
+namespace internal {
+template <typename T>
+using Optional = ::std::optional<T>;
+} // namespace internal
+} // namespace testing
+// The case where absl is configured NOT to alias std::optional is not
+// supported.
+#endif // __has_include(<optional>) && __cplusplus >= 201703L
+#endif // __has_include
+#endif // GTEST_HAS_ABSL
+
+#if GTEST_HAS_ABSL
// Always use absl::string_view for Matcher<> specializations if googletest
// is built with absl support.
# define GTEST_INTERNAL_HAS_STRING_VIEW 1
@@ -2262,4 +2338,33 @@ using StringView = ::std::string_view;
# endif // __has_include
#endif // GTEST_HAS_ABSL
+#if GTEST_HAS_ABSL
+// Always use absl::variant for UniversalPrinter<> specializations if googletest
+// is built with absl support.
+#define GTEST_INTERNAL_HAS_VARIANT 1
+#include "absl/types/variant.h"
+namespace testing {
+namespace internal {
+template <typename... T>
+using Variant = ::absl::variant<T...>;
+} // namespace internal
+} // namespace testing
+#else
+#ifdef __has_include
+#if __has_include(<variant>) && __cplusplus >= 201703L
+// Otherwise for C++17 and higher use std::variant for UniversalPrinter<>
+// specializations.
+#define GTEST_INTERNAL_HAS_VARIANT 1
+#include <variant>
+namespace testing {
+namespace internal {
+template <typename... T>
+using Variant = ::std::variant<T...>;
+} // namespace internal
+} // namespace testing
+// The case where absl is configured NOT to alias std::variant is not supported.
+#endif // __has_include(<variant>) && __cplusplus >= 201703L
+#endif // __has_include
+#endif // GTEST_HAS_ABSL
+
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
diff --git a/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-type-util.h b/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-type-util.h
index 082fdad12c0..c3326f2c517 100644
--- a/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-type-util.h
+++ b/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-type-util.h
@@ -64,34 +64,38 @@ inline std::string CanonicalizeForStdLibVersioning(std::string s) {
return s;
}
-// GetTypeName<T>() returns a human-readable name of type T.
-// NB: This function is also used in Google Mock, so don't move it inside of
-// the typed-test-only section below.
-template <typename T>
-std::string GetTypeName() {
-# if GTEST_HAS_RTTI
-
- const char* const name = typeid(T).name();
-# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
+#if GTEST_HAS_RTTI
+// GetTypeName(const std::type_info&) returns a human-readable name of type T.
+inline std::string GetTypeName(const std::type_info& type) {
+ const char* const name = type.name();
+#if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
int status = 0;
// gcc's implementation of typeid(T).name() mangles the type name,
// so we have to demangle it.
-# if GTEST_HAS_CXXABI_H_
+#if GTEST_HAS_CXXABI_H_
using abi::__cxa_demangle;
-# endif // GTEST_HAS_CXXABI_H_
+#endif // GTEST_HAS_CXXABI_H_
char* const readable_name = __cxa_demangle(name, nullptr, nullptr, &status);
const std::string name_str(status == 0 ? readable_name : name);
free(readable_name);
return CanonicalizeForStdLibVersioning(name_str);
-# else
+#else
return name;
-# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
-
-# else
+#endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
+}
+#endif // GTEST_HAS_RTTI
+// GetTypeName<T>() returns a human-readable name of type T if and only if
+// RTTI is enabled, otherwise it returns a dummy type name.
+// NB: This function is also used in Google Mock, so don't move it inside of
+// the typed-test-only section below.
+template <typename T>
+std::string GetTypeName() {
+#if GTEST_HAS_RTTI
+ return GetTypeName(typeid(T));
+#else
return "<type>";
-
-# endif // GTEST_HAS_RTTI
+#endif // GTEST_HAS_RTTI
}
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
diff --git a/chromium/third_party/googletest/src/googletest/src/gtest-filepath.cc b/chromium/third_party/googletest/src/googletest/src/gtest-filepath.cc
index 9aad12fbd11..062b95b1ff7 100644
--- a/chromium/third_party/googletest/src/googletest/src/gtest-filepath.cc
+++ b/chromium/third_party/googletest/src/googletest/src/gtest-filepath.cc
@@ -349,33 +349,21 @@ FilePath FilePath::RemoveTrailingPathSeparator() const {
// For example, "bar///foo" becomes "bar/foo". Does not eliminate other
// redundancies that might be in a pathname involving "." or "..".
void FilePath::Normalize() {
- if (pathname_.c_str() == nullptr) {
- pathname_ = "";
- return;
- }
- const char* src = pathname_.c_str();
- char* const dest = new char[pathname_.length() + 1];
- char* dest_ptr = dest;
- memset(dest_ptr, 0, pathname_.length() + 1);
-
- while (*src != '\0') {
- *dest_ptr = *src;
- if (!IsPathSeparator(*src)) {
- src++;
+ std::string normalized_pathname;
+ normalized_pathname.reserve(pathname_.length());
+
+ for (const char character : pathname_) {
+ if (!IsPathSeparator(character)) {
+ normalized_pathname.push_back(character);
+ } else if (normalized_pathname.empty() ||
+ normalized_pathname.back() != kPathSeparator) {
+ normalized_pathname.push_back(kPathSeparator);
} else {
-#if GTEST_HAS_ALT_PATH_SEP_
- if (*dest_ptr == kAlternatePathSeparator) {
- *dest_ptr = kPathSeparator;
- }
-#endif
- while (IsPathSeparator(*src))
- src++;
+ continue;
}
- dest_ptr++;
}
- *dest_ptr = '\0';
- pathname_ = dest;
- delete[] dest;
+
+ pathname_ = normalized_pathname;
}
} // namespace internal
diff --git a/chromium/third_party/googletest/src/googletest/src/gtest-printers.cc b/chromium/third_party/googletest/src/googletest/src/gtest-printers.cc
index 4e1ccad881d..ce1b2afca72 100644
--- a/chromium/third_party/googletest/src/googletest/src/gtest-printers.cc
+++ b/chromium/third_party/googletest/src/googletest/src/gtest-printers.cc
@@ -251,6 +251,11 @@ void PrintTo(wchar_t wc, ostream* os) {
PrintCharAndCodeTo<wchar_t>(wc, os);
}
+void PrintTo(char32_t c, ::std::ostream* os) {
+ *os << std::hex << "U+" << std::uppercase << std::setfill('0') << std::setw(4)
+ << c;
+}
+
// Prints the given array of characters to the ostream. CharType must be either
// char or wchar_t.
// The array starts at begin, the length is len, it may include '\0' characters
diff --git a/chromium/third_party/googletest/src/googletest/src/gtest-typed-test.cc b/chromium/third_party/googletest/src/googletest/src/gtest-typed-test.cc
index 1b1cfb0dc15..722c7b14fb2 100644
--- a/chromium/third_party/googletest/src/googletest/src/gtest-typed-test.cc
+++ b/chromium/third_party/googletest/src/googletest/src/gtest-typed-test.cc
@@ -78,17 +78,7 @@ const char* TypedTestSuitePState::VerifyRegisteredTestNames(
continue;
}
- bool found = false;
- for (RegisteredTestIter it = registered_tests_.begin();
- it != registered_tests_.end();
- ++it) {
- if (name == it->first) {
- found = true;
- break;
- }
- }
-
- if (found) {
+ if (registered_tests_.count(name) != 0) {
tests.insert(name);
} else {
errors << "No test named " << name
diff --git a/chromium/third_party/googletest/src/googletest/src/gtest.cc b/chromium/third_party/googletest/src/googletest/src/gtest.cc
index c6722800e95..5a8999f60b9 100644
--- a/chromium/third_party/googletest/src/googletest/src/gtest.cc
+++ b/chromium/third_party/googletest/src/googletest/src/gtest.cc
@@ -81,13 +81,11 @@
#elif GTEST_OS_WINDOWS // We are on Windows proper.
-# include <Windows.h> // NOLINT
# include <windows.h> // NOLINT
# undef min
#ifdef _MSC_VER
# include <crtdbg.h> // NOLINT
-# include <debugapi.h> // NOLINT
#endif
# include <io.h> // NOLINT
@@ -2196,7 +2194,9 @@ std::string AppendUserMessage(const std::string& gtest_msg,
if (user_msg_string.empty()) {
return gtest_msg;
}
-
+ if (gtest_msg.empty()) {
+ return user_msg_string;
+ }
return gtest_msg + "\n" + user_msg_string;
}
@@ -2275,7 +2275,8 @@ static const char* const kReservedTestSuitesAttributes[] = {
// The list of reserved attributes used in the <testsuite> element of XML
// output.
static const char* const kReservedTestSuiteAttributes[] = {
- "disabled", "errors", "failures", "name", "tests", "time", "timestamp"};
+ "disabled", "errors", "failures", "name",
+ "tests", "time", "timestamp", "skipped"};
// The list of reserved attributes used in the <testcase> element of XML output.
static const char* const kReservedTestCaseAttributes[] = {
@@ -3117,7 +3118,7 @@ static std::string FormatTestSuiteCount(int test_suite_count) {
static const char * TestPartResultTypeToString(TestPartResult::Type type) {
switch (type) {
case TestPartResult::kSkip:
- return "Skipped";
+ return "Skipped\n";
case TestPartResult::kSuccess:
return "Success";
@@ -4189,10 +4190,11 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
OutputXmlAttribute(stream, kTestsuite, "classname", test_suite_name);
int failures = 0;
+ int skips = 0;
for (int i = 0; i < result.total_part_count(); ++i) {
const TestPartResult& part = result.GetTestPartResult(i);
if (part.failed()) {
- if (++failures == 1) {
+ if (++failures == 1 && skips == 0) {
*stream << ">\n";
}
const std::string location =
@@ -4205,13 +4207,26 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream,
const std::string detail = location + "\n" + part.message();
OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
*stream << "</failure>\n";
+ } else if (part.skipped()) {
+ if (++skips == 1 && failures == 0) {
+ *stream << ">\n";
+ }
+ const std::string location =
+ internal::FormatCompilerIndependentFileLocation(part.file_name(),
+ part.line_number());
+ const std::string summary = location + "\n" + part.summary();
+ *stream << " <skipped message=\""
+ << EscapeXmlAttribute(summary.c_str()) << "\">";
+ const std::string detail = location + "\n" + part.message();
+ OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str());
+ *stream << "</skipped>\n";
}
}
- if (failures == 0 && result.test_property_count() == 0) {
+ if (failures == 0 && skips == 0 && result.test_property_count() == 0) {
*stream << " />\n";
} else {
- if (failures == 0) {
+ if (failures == 0 && skips == 0) {
*stream << ">\n";
}
OutputXmlTestProperties(stream, result);
@@ -4233,7 +4248,11 @@ void XmlUnitTestResultPrinter::PrintXmlTestSuite(std::ostream* stream,
OutputXmlAttribute(
stream, kTestsuite, "disabled",
StreamableToString(test_suite.reportable_disabled_test_count()));
+ OutputXmlAttribute(stream, kTestsuite, "skipped",
+ StreamableToString(test_suite.skipped_test_count()));
+
OutputXmlAttribute(stream, kTestsuite, "errors", "0");
+
OutputXmlAttribute(stream, kTestsuite, "time",
FormatTimeInMillisAsSeconds(test_suite.elapsed_time()));
OutputXmlAttribute(
@@ -6290,10 +6309,10 @@ static const char kColorEncodedHelpMessage[] =
" @G--" GTEST_FLAG_PREFIX_
"color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D\n"
" Enable/disable colored output. The default is @Gauto@D.\n"
- " -@G-" GTEST_FLAG_PREFIX_
+ " @G--" GTEST_FLAG_PREFIX_
"brief=1@D\n"
" Only print test failures.\n"
- " -@G-" GTEST_FLAG_PREFIX_
+ " @G--" GTEST_FLAG_PREFIX_
"print_time=0@D\n"
" Don't print the elapsed time of each test.\n"
" @G--" GTEST_FLAG_PREFIX_