diff --git a/third_party/googletest/googlemock/include/gmock/gmock-actions.h b/third_party/googletest/googlemock/include/gmock/gmock-actions.h --- a/third_party/googletest/googlemock/include/gmock/gmock-actions.h +++ b/third_party/googletest/googlemock/include/gmock/gmock-actions.h @@ -133,10 +133,11 @@ #ifndef _WIN32_WCE #include #endif #include +#include #include #include #include #include #include @@ -1744,10 +1745,17 @@ operator Action() const { // NOLINT T copy = exception; return [copy](Args...) -> R { throw copy; }; } }; +struct RethrowAction { + std::exception_ptr exception; + template + operator Action() const { // NOLINT + return [ex = exception](Args...) -> R { std::rethrow_exception(ex); }; + } +}; #endif // GTEST_HAS_EXCEPTIONS } // namespace internal // An Unused object can be implicitly constructed from ANY value. @@ -2060,17 +2068,27 @@ template internal::ReturnPointeeAction ReturnPointee(Ptr pointer) { return {pointer}; } +#if GTEST_HAS_EXCEPTIONS // Action Throw(exception) can be used in a mock function of any type -// to throw the given exception. Any copyable value can be thrown. -#if GTEST_HAS_EXCEPTIONS +// to throw the given exception. Any copyable value can be thrown, +// except for std::exception_ptr, which is likely a mistake if +// thrown directly. template -internal::ThrowAction::type> Throw(T&& exception) { +typename std::enable_if< + !std::is_base_of::type>::value, + internal::ThrowAction::type>>::type +Throw(T&& exception) { return {std::forward(exception)}; } +// Action Rethrow(exception_ptr) can be used in a mock function of any type +// to rethrow any exception_ptr. Note that the same object is thrown each time. +inline internal::RethrowAction Rethrow(std::exception_ptr exception) { + return {std::move(exception)}; +} #endif // GTEST_HAS_EXCEPTIONS namespace internal { // A macro from the ACTION* family (defined later in gmock-generated-actions.h) diff --git a/third_party/googletest/googlemock/include/gmock/gmock.h b/third_party/googletest/googlemock/include/gmock/gmock.h --- a/third_party/googletest/googlemock/include/gmock/gmock.h +++ b/third_party/googletest/googlemock/include/gmock/gmock.h @@ -58,10 +58,11 @@ #include "gmock/gmock-function-mocker.h" // IWYU pragma: export #include "gmock/gmock-matchers.h" // IWYU pragma: export #include "gmock/gmock-more-actions.h" // IWYU pragma: export #include "gmock/gmock-more-matchers.h" // IWYU pragma: export #include "gmock/gmock-nice-strict.h" // IWYU pragma: export +#include "gmock/gmock-spec-builders.h" // IWYU pragma: export #include "gmock/internal/gmock-internal-utils.h" #include "gmock/internal/gmock-port.h" // Declares Google Mock flags that we want a user to use programmatically. GMOCK_DECLARE_bool_(catch_leaked_mocks); diff --git a/third_party/googletest/googletest/include/gtest/gtest.h b/third_party/googletest/googletest/include/gtest/gtest.h --- a/third_party/googletest/googletest/include/gtest/gtest.h +++ b/third_party/googletest/googletest/include/gtest/gtest.h @@ -71,12 +71,10 @@ #include "gtest/gtest_pred_impl.h" #include "gtest/gtest_prod.h" #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-string.h" -#include "mozilla/Attributes.h" - GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ /* class A needs to have dll-interface to be used by clients of class B */) // Declares the flags. @@ -325,11 +323,11 @@ // // A sub-class must implement this to define the test logic. // // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM. // Instead, use the TEST or TEST_F macro. - MOZ_CAN_RUN_SCRIPT virtual void TestBody() = 0; + virtual void TestBody() = 0; // Sets up, executes, and tears down the test. void Run(); // Deletes self. We deliberately pick an unusual name for this diff --git a/third_party/googletest/googletest/src/gtest.cc b/third_party/googletest/googletest/src/gtest.cc --- a/third_party/googletest/googletest/src/gtest.cc +++ b/third_party/googletest/googletest/src/gtest.cc @@ -41,10 +41,11 @@ #include #include #include // NOLINT #include +#include // NOLINT: raise(3) is used on some platforms #include #include #include #include #include diff --git a/third_party/googletest/moz.yaml b/third_party/googletest/moz.yaml --- a/third_party/googletest/moz.yaml +++ b/third_party/googletest/moz.yaml @@ -8,13 +8,13 @@ name: googletest description: Google Testing and Mocking Framework url: https://google.github.io/googletest/ - release: 518387203b573f35477fa6872dd54620e70d2bdb (2023-10-23T17:11:36Z). + release: 76bb2afb8b522d24496ad1c757a49784fbfa2e42 (2023-11-27T21:32:49Z). - revision: 518387203b573f35477fa6872dd54620e70d2bdb + revision: 76bb2afb8b522d24496ad1c757a49784fbfa2e42 license: BSD-3-Clause license-file: LICENSE vendoring: