summaryrefslogtreecommitdiff
path: root/chromium/third_party/googletest
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-05-20 09:47:09 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-06-07 11:15:42 +0000
commit189d4fd8fad9e3c776873be51938cd31a42b6177 (patch)
tree6497caeff5e383937996768766ab3bb2081a40b2 /chromium/third_party/googletest
parent8bc75099d364490b22f43a7ce366b366c08f4164 (diff)
downloadqtwebengine-chromium-189d4fd8fad9e3c776873be51938cd31a42b6177.tar.gz
BASELINE: Update Chromium to 90.0.4430.221
Change-Id: Iff4d9d18d2fcf1a576f3b1f453010f744a232920 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/googletest')
-rw-r--r--chromium/third_party/googletest/DIR_METADATA3
-rw-r--r--chromium/third_party/googletest/OWNERS1
-rw-r--r--chromium/third_party/googletest/src/BUILD.bazel2
-rw-r--r--chromium/third_party/googletest/src/CMakeLists.txt2
-rw-r--r--chromium/third_party/googletest/src/CONTRIBUTING.md2
-rw-r--r--chromium/third_party/googletest/src/README.md10
-rw-r--r--chromium/third_party/googletest/src/googlemock/CMakeLists.txt1
-rw-r--r--chromium/third_party/googletest/src/googlemock/docs/cheat_sheet.md88
-rw-r--r--chromium/third_party/googletest/src/googlemock/docs/cook_book.md39
-rw-r--r--chromium/third_party/googletest/src/googlemock/docs/for_dummies.md38
-rw-r--r--chromium/third_party/googletest/src/googlemock/docs/gmock_faq.md2
-rw-r--r--chromium/third_party/googletest/src/googlemock/docs/pump_manual.md2
-rw-r--r--chromium/third_party/googletest/src/googlemock/include/gmock/gmock-actions.h32
-rw-r--r--chromium/third_party/googletest/src/googlemock/include/gmock/gmock-function-mocker.h2
-rw-r--r--chromium/third_party/googletest/src/googlemock/include/gmock/gmock-generated-actions.h57
-rw-r--r--chromium/third_party/googletest/src/googlemock/include/gmock/gmock-generated-actions.h.pump12
-rw-r--r--chromium/third_party/googletest/src/googlemock/include/gmock/gmock-matchers.h228
-rwxr-xr-xchromium/third_party/googletest/src/googlemock/scripts/generator/cpp/ast.py7
-rwxr-xr-xchromium/third_party/googletest/src/googlemock/scripts/generator/cpp/gmock_class_test.py8
-rw-r--r--chromium/third_party/googletest/src/googlemock/src/gmock-spec-builders.cc60
-rw-r--r--chromium/third_party/googletest/src/googlemock/src/gmock.cc2
-rw-r--r--chromium/third_party/googletest/src/googletest/CMakeLists.txt3
-rw-r--r--chromium/third_party/googletest/src/googletest/cmake/internal_utils.cmake4
-rw-r--r--chromium/third_party/googletest/src/googletest/docs/advanced.md26
-rw-r--r--chromium/third_party/googletest/src/googletest/docs/faq.md12
-rw-r--r--chromium/third_party/googletest/src/googletest/docs/pkgconfig.md2
-rw-r--r--chromium/third_party/googletest/src/googletest/docs/primer.md2
-rw-r--r--chromium/third_party/googletest/src/googletest/include/gtest/gtest-matchers.h18
-rw-r--r--chromium/third_party/googletest/src/googletest/include/gtest/gtest-param-test.h3
-rw-r--r--chromium/third_party/googletest/src/googletest/include/gtest/gtest-printers.h20
-rw-r--r--chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-internal.h127
-rw-r--r--chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-param-util.h16
-rw-r--r--chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h9
-rw-r--r--chromium/third_party/googletest/src/googletest/src/gtest-death-test.cc34
-rw-r--r--chromium/third_party/googletest/src/googletest/src/gtest-port.cc7
-rw-r--r--chromium/third_party/googletest/src/googletest/src/gtest-printers.cc3
-rw-r--r--chromium/third_party/googletest/src/googletest/src/gtest.cc28
37 files changed, 593 insertions, 319 deletions
diff --git a/chromium/third_party/googletest/DIR_METADATA b/chromium/third_party/googletest/DIR_METADATA
new file mode 100644
index 00000000000..6f2a42f05f7
--- /dev/null
+++ b/chromium/third_party/googletest/DIR_METADATA
@@ -0,0 +1,3 @@
+monorail: {
+ component: "Test>gTest"
+}
diff --git a/chromium/third_party/googletest/OWNERS b/chromium/third_party/googletest/OWNERS
index 9f741973f3d..4d5df35d9c7 100644
--- a/chromium/third_party/googletest/OWNERS
+++ b/chromium/third_party/googletest/OWNERS
@@ -1,4 +1,3 @@
thakis@chromium.org
pwnall@chromium.org
dpranke@google.com
-# COMPONENT: Test>gTest
diff --git a/chromium/third_party/googletest/src/BUILD.bazel b/chromium/third_party/googletest/src/BUILD.bazel
index 7e227aa00eb..8099642a858 100644
--- a/chromium/third_party/googletest/src/BUILD.bazel
+++ b/chromium/third_party/googletest/src/BUILD.bazel
@@ -36,6 +36,8 @@ package(default_visibility = ["//visibility:public"])
licenses(["notice"])
+exports_files(["LICENSE"])
+
config_setting(
name = "windows",
constraint_values = ["@bazel_tools//platforms:windows"],
diff --git a/chromium/third_party/googletest/src/CMakeLists.txt b/chromium/third_party/googletest/src/CMakeLists.txt
index 37e7b61211f..e516b4b7a65 100644
--- a/chromium/third_party/googletest/src/CMakeLists.txt
+++ b/chromium/third_party/googletest/src/CMakeLists.txt
@@ -11,7 +11,7 @@ project(googletest-distribution)
set(GOOGLETEST_VERSION 1.10.0)
if (CMAKE_VERSION VERSION_GREATER "3.0.2")
- if(NOT CYGWIN AND NOT MSYS)
+ if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
endif()
diff --git a/chromium/third_party/googletest/src/CONTRIBUTING.md b/chromium/third_party/googletest/src/CONTRIBUTING.md
index bd1843eb48e..fe4790d7f6c 100644
--- a/chromium/third_party/googletest/src/CONTRIBUTING.md
+++ b/chromium/third_party/googletest/src/CONTRIBUTING.md
@@ -28,7 +28,7 @@ PR is acceptable as an alternative.
## Contributing A Patch
1. Submit an issue describing your proposed change to the
- [issue tracker](https://github.com/google/googletest).
+ [issue tracker](https://github.com/google/googletest/issues).
2. Please don't mix more than one logical change per submittal, because it
makes the history hard to follow. If you want to make a change that doesn't
have a corresponding issue in the issue tracker, please create one.
diff --git a/chromium/third_party/googletest/src/README.md b/chromium/third_party/googletest/src/README.md
index 1727866297f..e8eefe5fba6 100644
--- a/chromium/third_party/googletest/src/README.md
+++ b/chromium/third_party/googletest/src/README.md
@@ -25,9 +25,6 @@ This repository is a merger of the formerly separate GoogleTest and GoogleMock
projects. These were so closely related that it makes sense to maintain and
release them together.
-Please subscribe to the mailing list at googletestframework@googlegroups.com for
-questions, discussions, and development.
-
### Getting started:
The information for **Google Test** is available in the
@@ -76,8 +73,6 @@ following notable projects:
* [Protocol Buffers](https://github.com/google/protobuf), Google's data
interchange format.
* The [OpenCV](http://opencv.org/) computer vision library.
-* [tiny-dnn](https://github.com/tiny-dnn/tiny-dnn): header only,
- dependency-free deep learning framework in C++11.
## Related Open Source Projects
@@ -113,8 +108,9 @@ that generates stub code for Google Test.
Google Test is designed to have fairly minimal requirements to build and use
with your projects, but there are some. If you notice any problems on your
-platform, please notify
-[googletestframework@googlegroups.com](https://groups.google.com/forum/#!forum/googletestframework).
+platform, please file an issue on the
+[GoogleTest GitHub Issue Tracker](https://github.com/google/googletest/issues).
+
Patches for fixing them are welcome!
### Build Requirements
diff --git a/chromium/third_party/googletest/src/googlemock/CMakeLists.txt b/chromium/third_party/googletest/src/googlemock/CMakeLists.txt
index 079c8c9639e..188794270ec 100644
--- a/chromium/third_party/googletest/src/googlemock/CMakeLists.txt
+++ b/chromium/third_party/googletest/src/googlemock/CMakeLists.txt
@@ -168,7 +168,6 @@ $env:Path = \"$project_bin;$env:Path\"
cxx_test(gmock_ex_test gmock_main)
cxx_test(gmock-function-mocker_test gmock_main)
cxx_test(gmock-generated-actions_test gmock_main)
- cxx_test(gmock-generated-matchers_test gmock_main)
cxx_test(gmock-internal-utils_test gmock_main)
cxx_test(gmock-matchers_test gmock_main)
cxx_test(gmock-more-actions_test gmock_main)
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 f2fb272356d..cc7e699b85d 100644
--- a/chromium/third_party/googletest/src/googlemock/docs/cheat_sheet.md
+++ b/chromium/third_party/googletest/src/googlemock/docs/cheat_sheet.md
@@ -1,12 +1,14 @@
-## gMock Cheat Sheet
+# gMock Cheat Sheet
<!-- GOOGLETEST_CM0019 DO NOT DELETE -->
+<!-- GOOGLETEST_CM0035 DO NOT DELETE -->
+
<!-- GOOGLETEST_CM0033 DO NOT DELETE -->
-### Defining a Mock Class
+## Defining a Mock Class
-#### Mocking a Normal Class {#MockClass}
+### Mocking a Normal Class {#MockClass}
Given
@@ -52,7 +54,7 @@ StrictMock<MockFoo> strict_foo; // The type is a subclass of MockFoo.
**Note:** A mock object is currently naggy by default. We may make it nice by
default in the future.
-#### Mocking a Class Template {#MockTemplate}
+### Mocking a Class Template {#MockTemplate}
Class templates can be mocked just like any class.
@@ -80,7 +82,7 @@ class MockStack : public StackInterface<Elem> {
};
```
-#### Specifying Calling Conventions for Mock Functions
+### Specifying Calling Conventions for Mock Functions
If your mock function doesn't use the default calling convention, you can
specify it by adding `Calltype(convention)` to `MOCK_METHOD`'s 4th parameter.
@@ -94,7 +96,7 @@ For example,
where `STDMETHODCALLTYPE` is defined by `<objbase.h>` on Windows.
-### Using Mocks in Tests {#UsingMocks}
+## Using Mocks in Tests {#UsingMocks}
The typical work flow is:
@@ -130,7 +132,7 @@ TEST(BarTest, DoesThis) {
} // #6
```
-### Setting Default Actions {#OnCall}
+## Setting Default Actions {#OnCall}
gMock has a **built-in default action** for any function that returns `void`,
`bool`, a numeric value, or a pointer. In C++11, it will additionally returns
@@ -186,7 +188,7 @@ ON_CALL(mock-object, method(matchers))
.WillByDefault(action);
```
-### Setting Expectations {#ExpectCall}
+## Setting Expectations {#ExpectCall}
`EXPECT_CALL()` sets **expectations** on a mock method (How will it be called?
What will it do?):
@@ -225,7 +227,7 @@ If `Times()` is omitted, the cardinality is assumed to be:
A method with no `EXPECT_CALL()` is free to be invoked *any number of times*,
and the default action will be taken each time.
-### Matchers {#MatcherList}
+## Matchers {#MatcherList}
<!-- GOOGLETEST_CM0020 DO NOT DELETE -->
@@ -249,14 +251,14 @@ Built-in matchers (where `argument` is the function argument, e.g.
`EXPECT_CALL(mock_object, method(matchers))`, the arguments of `method`) are
divided into several categories:
-#### Wildcard
+### Wildcard
Matcher | Description
:-------------------------- | :-----------------------------------------------
`_` | `argument` can be any value of the correct type.
`A<type>()` or `An<type>()` | `argument` can be any value of type `type`.
-#### Generic Comparison
+### Generic Comparison
<!-- mdformat off(no multiline tables) -->
| Matcher | Description |
@@ -279,9 +281,10 @@ Matcher | Description
Except `Ref()`, these matchers make a *copy* of `value` in case it's modified or
destructed later. If the compiler complains that `value` doesn't have a public
-copy constructor, try wrap it in `ByRef()`, e.g.
-`Eq(ByRef(non_copyable_value))`. If you do that, make sure `non_copyable_value`
-is not changed afterwards, or the meaning of your matcher will be changed.
+copy constructor, try wrap it in `std::ref()`, e.g.
+`Eq(std::ref(non_copyable_value))`. If you do that, make sure
+`non_copyable_value` is not changed afterwards, or the meaning of your matcher
+will be changed.
`IsTrue` and `IsFalse` are useful when you need to use a matcher, or for types
that can be explicitly converted to Boolean, but are not implicitly converted to
@@ -289,7 +292,7 @@ Boolean. In other cases, you can use the basic
[`EXPECT_TRUE` and `EXPECT_FALSE`](../../googletest/docs/primer#basic-assertions)
assertions.
-#### Floating-Point Matchers {#FpMatchers}
+### Floating-Point Matchers {#FpMatchers}
<!-- mdformat off(no multiline tables) -->
| Matcher | Description |
@@ -317,7 +320,7 @@ user wants.
| `NanSensitiveFloatNear(a_float, max_abs_error)` | `argument` is a `float` value close to `a_float` (absolute error <= `max_abs_error`), treating two NaNs as equal. |
<!-- mdformat on -->
-#### String Matchers
+### String Matchers
The `argument` can be either a C string or a C++ string object:
@@ -341,7 +344,7 @@ use the regular expression syntax defined
these matchers, except `ContainsRegex()` and `MatchesRegex()` work for wide
strings as well.
-#### Container Matchers
+### Container Matchers
Most STL-style containers support `==`, so you can use `Eq(expected_container)`
or simply `expected_container` to match a container exactly. If you want to
@@ -392,7 +395,7 @@ messages, you can use:
EXPECT_THAT(actual_foos, Pointwise(FooEq(), expected_foos));
```
-#### Member Matchers
+### Member Matchers
<!-- mdformat off(no multiline tables) -->
| Matcher | Description |
@@ -403,7 +406,7 @@ messages, you can use:
| `Property(&class::property, m)` | `argument.property()` (or `argument->property()` when `argument` is a plain pointer) matches matcher `m`, where `argument` is an object of type _class_. |
<!-- mdformat on -->
-#### Matching the Result of a Function, Functor, or Callback
+### Matching the Result of a Function, Functor, or Callback
<!-- mdformat off(no multiline tables) -->
| Matcher | Description |
@@ -411,7 +414,7 @@ messages, you can use:
| `ResultOf(f, m)` | `f(argument)` matches matcher `m`, where `f` is a function or functor. |
<!-- mdformat on -->
-#### Pointer Matchers
+### Pointer Matchers
<!-- mdformat off(no multiline tables) -->
| Matcher | Description |
@@ -424,7 +427,7 @@ messages, you can use:
<!-- GOOGLETEST_CM0027 DO NOT DELETE -->
-#### Multi-argument Matchers {#MultiArgMatchers}
+### Multi-argument Matchers {#MultiArgMatchers}
Technically, all matchers match a *single* value. A "multi-argument" matcher is
just one that matches a *tuple*. The following matchers can be used to match a
@@ -449,7 +452,7 @@ reorder them) to participate in the matching:
| `Args<N1, N2, ..., Nk>(m)` | The tuple of the `k` selected (using 0-based indices) arguments matches `m`, e.g. `Args<1, 2>(Eq())`. |
<!-- mdformat on -->
-#### Composite Matchers
+### Composite Matchers
You can make a matcher from one or more other matchers:
@@ -465,7 +468,7 @@ You can make a matcher from one or more other matchers:
<!-- GOOGLETEST_CM0028 DO NOT DELETE -->
-#### Adapters for Matchers
+### Adapters for Matchers
<!-- mdformat off(no multiline tables) -->
| Matcher | Description |
@@ -478,7 +481,7 @@ You can make a matcher from one or more other matchers:
`AddressSatisfies(callback)` and `Truly(callback)` take ownership of `callback`,
which must be a permanent callback.
-#### Using Matchers as Predicates {#MatchersAsPredicatesCheat}
+### Using Matchers as Predicates {#MatchersAsPredicatesCheat}
<!-- mdformat off(no multiline tables) -->
| Matcher | Description |
@@ -488,7 +491,7 @@ which must be a permanent callback.
| `Value(value, m)` | evaluates to `true` if `value` matches `m`. |
<!-- mdformat on -->
-#### Defining Matchers
+### Defining Matchers
<!-- mdformat off(no multiline tables) -->
| Matcher | Description |
@@ -507,11 +510,11 @@ which must be a permanent callback.
3. You can use `PrintToString(x)` to convert a value `x` of any type to a
string.
-### Actions {#ActionList}
+## Actions {#ActionList}
**Actions** specify what a mock function should do when invoked.
-#### Returning a Value
+### Returning a Value
<!-- mdformat off(no multiline tables) -->
| | |
@@ -527,7 +530,7 @@ which must be a permanent callback.
| `ReturnRoundRobin({a1, ..., ak})` | Each call will return the next `ai` in the list, starting at the beginning when the end of the list is reached. |
<!-- mdformat on -->
-#### Side Effects
+### Side Effects
<!-- mdformat off(no multiline tables) -->
| | |
@@ -544,7 +547,7 @@ which must be a permanent callback.
| `Throw(exception)` | Throws the given exception, which can be any copyable value. Available since v1.1.0. |
<!-- mdformat on -->
-#### Using a Function, Functor, or Lambda as an Action
+### Using a Function, Functor, or Lambda as an Action
In the following, by "callable" we mean a free function, `std::function`,
functor, or lambda.
@@ -586,19 +589,18 @@ callback type instead of a derived one, e.g.
```
In `InvokeArgument<N>(...)`, if an argument needs to be passed by reference,
-wrap it inside `ByRef()`. For example,
+wrap it inside `std::ref()`. For example,
```cpp
-using ::testing::ByRef;
using ::testing::InvokeArgument;
...
-InvokeArgument<2>(5, string("Hi"), ByRef(foo))
+InvokeArgument<2>(5, string("Hi"), std::ref(foo))
```
calls the mock function's #2 argument, passing to it `5` and `string("Hi")` by
value, and `foo` by reference.
-#### Default Action
+### Default Action
<!-- mdformat off(no multiline tables) -->
| Matcher | Description |
@@ -611,19 +613,19 @@ composite action - trying to do so will result in a run-time error.
<!-- GOOGLETEST_CM0032 DO NOT DELETE -->
-#### Composite Actions
+### Composite Actions
<!-- mdformat off(no multiline tables) -->
| | |
| :----------------------------- | :------------------------------------------ |
-| `DoAll(a1, a2, ..., an)` | Do all actions `a1` to `an` and return the result of `an` in each invocation. The first `n - 1` sub-actions must return void. |
+| `DoAll(a1, a2, ..., an)` | Do all actions `a1` to `an` and return the result of `an` in each invocation. The first `n - 1` sub-actions must return void and will receive a readonly view of the arguments. |
| `IgnoreResult(a)` | Perform action `a` and ignore its result. `a` must not return void. |
| `WithArg<N>(a)` | Pass the `N`-th (0-based) argument of the mock function to action `a` and perform it. |
| `WithArgs<N1, N2, ..., Nk>(a)` | Pass the selected (0-based) arguments of the mock function to action `a` and perform it. |
| `WithoutArgs(a)` | Perform action `a` without any arguments. |
<!-- mdformat on -->
-#### Defining Actions
+### Defining Actions
<!-- mdformat off(no multiline tables) -->
| | |
@@ -635,7 +637,7 @@ composite action - trying to do so will result in a run-time error.
The `ACTION*` macros cannot be used inside a function or class.
-### Cardinalities {#CardinalityList}
+## Cardinalities {#CardinalityList}
These are used in `Times()` to specify how many times a mock function will be
called:
@@ -650,13 +652,13 @@ called:
| `Exactly(n) or n` | The call is expected exactly `n` times. In particular, the call should never happen when `n` is 0. |
<!-- mdformat on -->
-### Expectation Order
+## Expectation Order
By default, the expectations can be matched in *any* order. If some or all
expectations must be matched in a given order, there are two ways to specify it.
They can be used either independently or together.
-#### The After Clause {#AfterClause}
+### The After Clause {#AfterClause}
```cpp
using ::testing::Expectation;
@@ -690,7 +692,7 @@ says that `Bar()` can be called only after all elements have been initialized
Modifying an `ExpectationSet` after using it in an `.After()` doesn't affect the
meaning of the `.After()`.
-#### Sequences {#UsingSequences}
+### Sequences {#UsingSequences}
When you have a long chain of sequential expectations, it's easier to specify
the order using **sequences**, which don't require you to given each expectation
@@ -733,7 +735,7 @@ using ::testing::InSequence;
says that all expected calls in the scope of `seq` must occur in strict order.
The name `seq` is irrelevant.
-### Verifying and Resetting a Mock
+## Verifying and Resetting a Mock
gMock will verify the expectations on a mock object when it is destructed, or
you can do it earlier:
@@ -758,7 +760,7 @@ verified:
Mock::AllowLeak(&mock_obj);
```
-### Mock Classes
+## Mock Classes
gMock defines a convenient mock class template
@@ -771,7 +773,7 @@ class MockFunction<R(A1, ..., An)> {
See this [recipe](cook_book.md#using-check-points) for one application of it.
-### Flags
+## Flags
<!-- mdformat off(no multiline tables) -->
| Flag | Description |
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 bffbb3c008e..d7cee698873 100644
--- a/chromium/third_party/googletest/src/googlemock/docs/cook_book.md
+++ b/chromium/third_party/googletest/src/googlemock/docs/cook_book.md
@@ -10,6 +10,8 @@ recommended to write `using ::testing::Foo;` once in your file before using the
name `Foo` defined by gMock. We omit such `using` statements in this section for
brevity, but you should do it in your own code.
+<!-- GOOGLETEST_CM0035 DO NOT DELETE -->
+
## Creating Mock Classes
Mock classes are defined as normal classes, using the `MOCK_METHOD` macro to
@@ -1180,15 +1182,14 @@ executed. Just tell gMock that it should save a reference to `bar`, instead of a
copy of it. Here's how:
```cpp
-using ::testing::ByRef;
using ::testing::Eq;
using ::testing::Lt;
...
// Expects that Foo()'s argument == bar.
- EXPECT_CALL(mock_obj, Foo(Eq(ByRef(bar))));
+ EXPECT_CALL(mock_obj, Foo(Eq(std::ref(bar))));
// Expects that Foo()'s argument < bar.
- EXPECT_CALL(mock_obj, Foo(Lt(ByRef(bar))));
+ EXPECT_CALL(mock_obj, Foo(Lt(std::ref(bar))));
```
Remember: if you do this, don't change `bar` after the `EXPECT_CALL()`, or the
@@ -1675,11 +1676,11 @@ times from calling it with the wrong arguments.
### Expecting Ordered Calls {#OrderedCalls}
-Although an `EXPECT_CALL()` statement defined earlier takes precedence when
-gMock tries to match a function call with an expectation, by default calls don't
-have to happen in the order `EXPECT_CALL()` statements are written. For example,
-if the arguments match the matchers in the third `EXPECT_CALL()`, but not those
-in the first two, then the third expectation will be used.
+Although an `EXPECT_CALL()` statement defined later takes precedence when gMock
+tries to match a function call with an expectation, by default calls don't have
+to happen in the order `EXPECT_CALL()` statements are written. For example, if
+the arguments match the matchers in the second `EXPECT_CALL()`, but not those in
+the first and third, then the second expectation will be used.
If you would rather have all calls occur in the order of the expectations, put
the `EXPECT_CALL()` statements in a block where you define a variable of type
@@ -1851,10 +1852,9 @@ Methods"). However, gMock doesn't let you use `ReturnRef()` in a mock function
whose return type is not a reference, as doing that usually indicates a user
error. So, what shall you do?
-Though you may be tempted, DO NOT use `ByRef()`:
+Though you may be tempted, DO NOT use `std::ref()`:
```cpp
-using testing::ByRef;
using testing::Return;
class MockFoo : public Foo {
@@ -1865,7 +1865,7 @@ class MockFoo : public Foo {
int x = 0;
MockFoo foo;
EXPECT_CALL(foo, GetValue())
- .WillRepeatedly(Return(ByRef(x))); // Wrong!
+ .WillRepeatedly(Return(std::ref(x))); // Wrong!
x = 42;
EXPECT_EQ(42, foo.GetValue());
```
@@ -1881,9 +1881,9 @@ Expected: 42
The reason is that `Return(*value*)` converts `value` to the actual return type
of the mock function at the time when the action is *created*, not when it is
*executed*. (This behavior was chosen for the action to be safe when `value` is
-a proxy object that references some temporary objects.) As a result, `ByRef(x)`
-is converted to an `int` value (instead of a `const int&`) when the expectation
-is set, and `Return(ByRef(x))` will always return 0.
+a proxy object that references some temporary objects.) As a result,
+`std::ref(x)` is converted to an `int` value (instead of a `const int&`) when
+the expectation is set, and `Return(std::ref(x))` will always return 0.
`ReturnPointee(pointer)` was provided to solve this problem specifically. It
returns the value pointed to by `pointer` at the time the action is *executed*:
@@ -2376,7 +2376,7 @@ using ::testing::InvokeArgument;
```
What if the callable takes an argument by reference? No problem - just wrap it
-inside `ByRef()`:
+inside `std::ref()`:
```cpp
...
@@ -2385,20 +2385,19 @@ inside `ByRef()`:
(override));
...
using ::testing::_;
- using ::testing::ByRef;
using ::testing::InvokeArgument;
...
MockFoo foo;
Helper helper;
...
EXPECT_CALL(foo, Bar(_))
- .WillOnce(InvokeArgument<0>(5, ByRef(helper)));
- // ByRef(helper) guarantees that a reference to helper, not a copy of it,
- // will be passed to the callback.
+ .WillOnce(InvokeArgument<0>(5, std::ref(helper)));
+ // std::ref(helper) guarantees that a reference to helper, not a copy of
+ // it, will be passed to the callback.
```
What if the callable takes an argument by reference and we do **not** wrap the
-argument in `ByRef()`? Then `InvokeArgument()` will *make a copy* of the
+argument in `std::ref()`? Then `InvokeArgument()` will *make a copy* of the
argument, and pass a *reference to the copy*, instead of a reference to the
original value, to the callable. This is especially handy when the argument is a
temporary value:
diff --git a/chromium/third_party/googletest/src/googlemock/docs/for_dummies.md b/chromium/third_party/googletest/src/googlemock/docs/for_dummies.md
index 8f5d17aedd3..a9c012b89e6 100644
--- a/chromium/third_party/googletest/src/googlemock/docs/for_dummies.md
+++ b/chromium/third_party/googletest/src/googlemock/docs/for_dummies.md
@@ -1,8 +1,10 @@
-## gMock for Dummies {#GMockForDummies}
+# gMock for Dummies {#GMockForDummies}
<!-- GOOGLETEST_CM0013 DO NOT DELETE -->
-### What Is gMock?
+<!-- GOOGLETEST_CM0035 DO NOT DELETE -->
+
+## What Is gMock?
When you write a prototype or test, often it's not feasible or wise to rely on
real objects entirely. A **mock object** implements the same interface as a real
@@ -39,7 +41,7 @@ When using gMock,
3. then you exercise code that uses the mock objects. gMock will catch any
violation to the expectations as soon as it arises.
-### Why gMock?
+## Why gMock?
While mock objects help you remove unnecessary dependencies in tests and make
them fast and reliable, using mocks manually in C++ is *hard*:
@@ -85,11 +87,11 @@ We encourage you to use gMock as
* a *testing* tool to cut your tests' outbound dependencies and probe the
interaction between your module and its collaborators.
-### Getting Started
+## Getting Started
gMock is bundled with googletest.
-### A Case for Mock Turtles
+## A Case for Mock Turtles
Let's look at an example. Suppose you are developing a graphics program that
relies on a [LOGO](http://en.wikipedia.org/wiki/Logo_programming_language)-like
@@ -135,13 +137,13 @@ because your new machine does anti-aliasing differently), easier to read and
maintain (the intent of a test is expressed in the code, not in some binary
images), and run *much, much faster*.
-### Writing the Mock Class
+## Writing the Mock Class
If you are lucky, the mocks you need to use have already been implemented by
some nice people. If, however, you find yourself in the position to write a mock
class, relax - gMock turns this task into a fun game! (Well, almost.)
-#### How to Define It
+### How to Define It
Using the `Turtle` interface as example, here are the simple steps you need to
follow:
@@ -184,7 +186,7 @@ class MockTurtle : public Turtle {
You don't need to define these mock methods somewhere else - the `MOCK_METHOD`
macro will generate the definitions for you. It's that simple!
-#### Where to Put It
+### Where to Put It
When you define a mock class, you need to decide where to put its definition.
Some people put it in a `_test.cc`. This is fine when the interface being mocked
@@ -208,7 +210,7 @@ specific domain much better than `Foo` does.
<!-- GOOGLETEST_CM0029 DO NOT DELETE -->
-### Using Mocks in Tests
+## Using Mocks in Tests
Once you have a mock class, using it is easy. The typical work flow is:
@@ -279,7 +281,7 @@ Admittedly, this test is contrived and doesn't do much. You can easily achieve
the same effect without using gMock. However, as we shall reveal soon, gMock
allows you to do *so much more* with the mocks.
-### Setting Expectations
+## Setting Expectations
The key to using a mock object successfully is to set the *right expectations*
on it. If you set the expectations too strict, your test will fail as the result
@@ -288,7 +290,7 @@ to do it just right such that your test can catch exactly the kind of bugs you
intend it to catch. gMock provides the necessary means for you to do it "just
right."
-#### General Syntax
+### General Syntax
In gMock we use the `EXPECT_CALL()` macro to set an expectation on a mock
method. The general syntax is:
@@ -343,7 +345,7 @@ it makes expectations easily identifiable (either by `gsearch` or by a human
reader), and second it allows gMock to include the source file location of a
failed expectation in messages, making debugging easier.
-#### Matchers: What Arguments Do We Expect?
+### Matchers: What Arguments Do We Expect?
When a mock function takes arguments, we may specify what arguments we are
expecting, for example:
@@ -399,7 +401,7 @@ to help gMock resolve which overload is expected by specifying the number of
arguments and possibly also the
[types of the arguments](cook_book.md#SelectOverload).
-#### Cardinalities: How Many Times Will It Be Called?
+### Cardinalities: How Many Times Will It Be Called?
The first clause we can specify following an `EXPECT_CALL()` is `Times()`. We
call its argument a **cardinality** as it tells *how many times* the call should
@@ -429,7 +431,7 @@ the cardinality for you.** The rules are easy to remember:
**Quick quiz:** what do you think will happen if a function is expected to be
called twice but actually called four times?
-#### Actions: What Should It Do?
+### Actions: What Should It Do?
Remember that a mock object doesn't really have a working implementation? We as
users have to tell it what to do when a method is invoked. This is easy in
@@ -522,7 +524,7 @@ will be taken afterwards. So the right answer is that `turtle.GetY()` will
return 100 the first time, but **return 0 from the second time on**, as
returning 0 is the default action for `int` functions.
-#### Using Multiple Expectations {#MultiExpectations}
+### Using Multiple Expectations {#MultiExpectations}
So far we've only shown examples where you have a single expectation. More
realistically, you'll specify expectations on multiple mock methods which may be
@@ -563,7 +565,7 @@ useful for methods that have some expectations, but for which other calls are
ok. See
[Understanding Uninteresting vs Unexpected Calls](cook_book.md#uninteresting-vs-unexpected).
-#### Ordered vs Unordered Calls {#OrderedCalls}
+### Ordered vs Unordered Calls {#OrderedCalls}
By default, an expectation can match a call even though an earlier expectation
hasn't been satisfied. In other words, the calls don't have to occur in the
@@ -600,7 +602,7 @@ order as written. If a call is made out-of-order, it will be an error.
them? Can you specify an arbitrary partial order? The answer is ... yes! The
details can be found [here](cook_book.md#OrderedCalls).)
-#### All Expectations Are Sticky (Unless Said Otherwise) {#StickyExpectations}
+### All Expectations Are Sticky (Unless Said Otherwise) {#StickyExpectations}
Now let's do a quick quiz to see how well you can use this mock stuff already.
How would you test that the turtle is asked to go to the origin *exactly twice*
@@ -688,7 +690,7 @@ it's in a sequence - as soon as another expectation that comes after it in the
sequence has been used, it automatically retires (and will never be used to
match any call).
-#### Uninteresting Calls
+### Uninteresting Calls
A mock object may have many methods, and not all of them are that interesting.
For example, in some tests we may not care about how many times `GetX()` and
diff --git a/chromium/third_party/googletest/src/googlemock/docs/gmock_faq.md b/chromium/third_party/googletest/src/googlemock/docs/gmock_faq.md
index 7f8c647afa6..14acae53025 100644
--- a/chromium/third_party/googletest/src/googlemock/docs/gmock_faq.md
+++ b/chromium/third_party/googletest/src/googlemock/docs/gmock_faq.md
@@ -2,6 +2,8 @@
<!-- GOOGLETEST_CM0021 DO NOT DELETE -->
+<!-- GOOGLETEST_CM0035 DO NOT DELETE -->
+
### When I call a method on my mock object, the method for the real object is invoked instead. What's the problem?
In order for a method to be mocked, it must be *virtual*, unless you use the
diff --git a/chromium/third_party/googletest/src/googlemock/docs/pump_manual.md b/chromium/third_party/googletest/src/googlemock/docs/pump_manual.md
index cdf7c57da2d..19f1a48eb5c 100644
--- a/chromium/third_party/googletest/src/googlemock/docs/pump_manual.md
+++ b/chromium/third_party/googletest/src/googlemock/docs/pump_manual.md
@@ -1,5 +1,7 @@
<b>P</b>ump is <b>U</b>seful for <b>M</b>eta <b>P</b>rogramming.
+<!-- GOOGLETEST_CM0035 DO NOT DELETE -->
+
# The Problem
Template and macro libraries often need to define many classes, functions, or
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 ecf47c4048a..02356a40df2 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
@@ -1032,9 +1032,13 @@ struct WithArgsAction {
template <typename... Actions>
struct DoAllAction {
private:
- template <typename... Args, size_t... I>
- std::vector<Action<void(Args...)>> Convert(IndexSequence<I...>) const {
- return {std::get<I>(actions)...};
+ template <typename T>
+ using NonFinalType =
+ typename std::conditional<std::is_scalar<T>::value, T, const T&>::type;
+
+ template <typename ActionT, size_t... I>
+ std::vector<ActionT> Convert(IndexSequence<I...>) const {
+ return {ActionT(std::get<I>(actions))...};
}
public:
@@ -1043,17 +1047,18 @@ struct DoAllAction {
template <typename R, typename... Args>
operator Action<R(Args...)>() const { // NOLINT
struct Op {
- std::vector<Action<void(Args...)>> converted;
+ std::vector<Action<void(NonFinalType<Args>...)>> converted;
Action<R(Args...)> last;
R operator()(Args... args) const {
auto tuple_args = std::forward_as_tuple(std::forward<Args>(args)...);
for (auto& a : converted) {
a.Perform(tuple_args);
}
- return last.Perform(tuple_args);
+ return last.Perform(std::move(tuple_args));
}
};
- return Op{Convert<Args...>(MakeIndexSequence<sizeof...(Actions) - 1>()),
+ return Op{Convert<Action<void(NonFinalType<Args>...)>>(
+ MakeIndexSequence<sizeof...(Actions) - 1>()),
std::get<sizeof...(Actions) - 1>(actions)};
}
};
@@ -1093,7 +1098,8 @@ struct DoAllAction {
typedef internal::IgnoredValue Unused;
// Creates an action that does actions a1, a2, ..., sequentially in
-// each invocation.
+// each invocation. All but the last action will have a readonly view of the
+// arguments.
template <typename... Action>
internal::DoAllAction<typename std::decay<Action>::type...> DoAll(
Action&&... action) {
@@ -1388,23 +1394,15 @@ class ActionImpl<Derived<Ts...>> {
std::tuple<Ts...> params_;
};
-namespace invoke_argument {
-
-// Appears in InvokeArgumentAdl's argument list to help avoid
-// accidental calls to user functions of the same name.
-struct AdlTag {};
-
-// InvokeArgumentAdl - a helper for InvokeArgument.
+// internal::InvokeArgument - a helper for InvokeArgument action.
// The basic overloads are provided here for generic functors.
// Overloads for other custom-callables are provided in the
// internal/custom/gmock-generated-actions.h header.
template <typename F, typename... Args>
-auto InvokeArgumentAdl(AdlTag, F f, Args... args) -> decltype(f(args...)) {
+auto InvokeArgument(F f, Args... args) -> decltype(f(args...)) {
return f(args...);
}
-} // namespace invoke_argument
-
#define GMOCK_INTERNAL_ARG_UNUSED(i, data, el) \
, const arg##i##_type& arg##i GTEST_ATTRIBUTE_UNUSED_
#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_ \
diff --git a/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-function-mocker.h b/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-function-mocker.h
index 317d6c2b7eb..7140a289478 100644
--- a/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-function-mocker.h
+++ b/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-function-mocker.h
@@ -234,7 +234,7 @@ using internal::FunctionMocker;
GMOCK_INTERNAL_GET_VALUE_CALLTYPE_I( \
GMOCK_PP_CAT(GMOCK_INTERNAL_IS_CALLTYPE_HELPER_, _arg))
#define GMOCK_INTERNAL_GET_VALUE_CALLTYPE_I(_arg) \
- GMOCK_PP_CAT(GMOCK_PP_IDENTITY, _arg)
+ GMOCK_PP_IDENTITY _arg
#define GMOCK_INTERNAL_IS_CALLTYPE_HELPER_Calltype
diff --git a/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-generated-actions.h b/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-generated-actions.h
index 7030a98e992..ccae6110063 100644
--- a/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-generated-actions.h
+++ b/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-generated-actions.h
@@ -47,6 +47,8 @@
#include "gmock/gmock-actions.h"
#include "gmock/internal/gmock-port.h"
+// Include any custom callback actions added by the local installation.
+#include "gmock/internal/custom/gmock-generated-actions.h"
// Sometimes you want to give an action explicit template parameters
// that cannot be inferred from its value parameters. ACTION() and
@@ -511,91 +513,71 @@ namespace testing {
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_0_VALUE_PARAMS()) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
- ::std::get<k>(args));
+ return internal::InvokeArgument(::std::get<k>(args));
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_1_VALUE_PARAMS(p0)) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
- ::std::get<k>(args), p0);
+ return internal::InvokeArgument(::std::get<k>(args), p0);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_2_VALUE_PARAMS(p0, p1)) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
- ::std::get<k>(args), p0, p1);
+ return internal::InvokeArgument(::std::get<k>(args), p0, p1);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_3_VALUE_PARAMS(p0, p1, p2)) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
- ::std::get<k>(args), p0, p1, p2);
+ return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_4_VALUE_PARAMS(p0, p1, p2, p3)) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
- ::std::get<k>(args), p0, p1, p2, p3);
+ return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
- ::std::get<k>(args), p0, p1, p2, p3, p4);
+ return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3, p4);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
- ::std::get<k>(args), p0, p1, p2, p3, p4, p5);
+ return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3, p4, p5);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
- ::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6);
+ return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3, p4, p5,
+ p6);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
- ::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7);
+ return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3, p4, p5,
+ p6, p7);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
- ::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7,
- p8);
+ return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3, p4, p5,
+ p6, p7, p8);
}
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
- ::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7,
- p8, p9);
+ return internal::InvokeArgument(::std::get<k>(args), p0, p1, p2, p3, p4, p5,
+ p6, p7, p8, p9);
}
#ifdef _MSC_VER
@@ -604,9 +586,4 @@ ACTION_TEMPLATE(InvokeArgument,
} // namespace testing
-// Include any custom callback actions added by the local installation.
-// We must include this header at the end to make sure it can use the
-// declarations from this file.
-#include "gmock/internal/custom/gmock-generated-actions.h"
-
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
diff --git a/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-generated-actions.h.pump b/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-generated-actions.h.pump
index 3430204f366..1512d72d8dd 100644
--- a/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-generated-actions.h.pump
+++ b/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-generated-actions.h.pump
@@ -49,6 +49,9 @@ $$}} This meta comment fixes auto-indentation in editors.
#include "gmock/gmock-actions.h"
#include "gmock/internal/gmock-port.h"
+// Include any custom callback actions added by the local installation.
+#include "gmock/internal/custom/gmock-generated-actions.h"
+
$range i 0..n
$range k 0..n-1
@@ -333,9 +336,7 @@ $range j 0..i-1
ACTION_TEMPLATE(InvokeArgument,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])) {
- using internal::invoke_argument::InvokeArgumentAdl;
- return InvokeArgumentAdl(internal::invoke_argument::AdlTag(),
- ::std::get<k>(args)$for j[[, p$j]]);
+ return internal::InvokeArgument(::std::get<k>(args)$for j[[, p$j]]);
}
]]
@@ -346,9 +347,4 @@ ACTION_TEMPLATE(InvokeArgument,
} // namespace testing
-// Include any custom callback actions added by the local installation.
-// We must include this header at the end to make sure it can use the
-// declarations from this file.
-#include "gmock/internal/custom/gmock-generated-actions.h"
-
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
diff --git a/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-matchers.h b/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-matchers.h
index 08fd6d14ff2..a897611c9c8 100644
--- a/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-matchers.h
+++ b/chromium/third_party/googletest/src/googlemock/include/gmock/gmock-matchers.h
@@ -903,9 +903,10 @@ bool CaseInsensitiveStringEquals(const StringType& s1,
template <typename StringType>
class StrEqualityMatcher {
public:
- StrEqualityMatcher(const StringType& str, bool expect_eq,
- bool case_sensitive)
- : string_(str), expect_eq_(expect_eq), case_sensitive_(case_sensitive) {}
+ StrEqualityMatcher(StringType str, bool expect_eq, bool case_sensitive)
+ : string_(std::move(str)),
+ expect_eq_(expect_eq),
+ case_sensitive_(case_sensitive) {}
#if GTEST_INTERNAL_HAS_STRING_VIEW
bool MatchAndExplain(const internal::StringView& s,
@@ -3990,52 +3991,60 @@ internal::ResultOfMatcher<Callable, InnerMatcher> ResultOf(
// String matchers.
// Matches a string equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrEq(
- const std::string& str) {
+template <typename T = std::string>
+PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrEq(
+ const internal::StringLike<T>& str) {
return MakePolymorphicMatcher(
- internal::StrEqualityMatcher<std::string>(str, true, true));
+ internal::StrEqualityMatcher<std::string>(std::string(str), true, true));
}
// Matches a string not equal to str.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrNe(
- const std::string& str) {
+template <typename T = std::string>
+PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrNe(
+ const internal::StringLike<T>& str) {
return MakePolymorphicMatcher(
- internal::StrEqualityMatcher<std::string>(str, false, true));
+ internal::StrEqualityMatcher<std::string>(std::string(str), false, true));
}
// Matches a string equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrCaseEq(
- const std::string& str) {
+template <typename T = std::string>
+PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrCaseEq(
+ const internal::StringLike<T>& str) {
return MakePolymorphicMatcher(
- internal::StrEqualityMatcher<std::string>(str, true, false));
+ internal::StrEqualityMatcher<std::string>(std::string(str), true, false));
}
// Matches a string not equal to str, ignoring case.
-inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrCaseNe(
- const std::string& str) {
- return MakePolymorphicMatcher(
- internal::StrEqualityMatcher<std::string>(str, false, false));
+template <typename T = std::string>
+PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrCaseNe(
+ const internal::StringLike<T>& str) {
+ return MakePolymorphicMatcher(internal::StrEqualityMatcher<std::string>(
+ std::string(str), false, false));
}
// Creates a matcher that matches any string, std::string, or C string
// that contains the given substring.
-inline PolymorphicMatcher<internal::HasSubstrMatcher<std::string> > HasSubstr(
- const std::string& substring) {
+template <typename T = std::string>
+PolymorphicMatcher<internal::HasSubstrMatcher<std::string> > HasSubstr(
+ const internal::StringLike<T>& substring) {
return MakePolymorphicMatcher(
- internal::HasSubstrMatcher<std::string>(substring));
+ internal::HasSubstrMatcher<std::string>(std::string(substring)));
}
// Matches a string that starts with 'prefix' (case-sensitive).
-inline PolymorphicMatcher<internal::StartsWithMatcher<std::string> > StartsWith(
- const std::string& prefix) {
+template <typename T = std::string>
+PolymorphicMatcher<internal::StartsWithMatcher<std::string> > StartsWith(
+ const internal::StringLike<T>& prefix) {
return MakePolymorphicMatcher(
- internal::StartsWithMatcher<std::string>(prefix));
+ internal::StartsWithMatcher<std::string>(std::string(prefix)));
}
// Matches a string that ends with 'suffix' (case-sensitive).
-inline PolymorphicMatcher<internal::EndsWithMatcher<std::string> > EndsWith(
- const std::string& suffix) {
- return MakePolymorphicMatcher(internal::EndsWithMatcher<std::string>(suffix));
+template <typename T = std::string>
+PolymorphicMatcher<internal::EndsWithMatcher<std::string> > EndsWith(
+ const internal::StringLike<T>& suffix) {
+ return MakePolymorphicMatcher(
+ internal::EndsWithMatcher<std::string>(std::string(suffix)));
}
#if GTEST_HAS_STD_WSTRING
@@ -4716,6 +4725,175 @@ PolymorphicMatcher<internal::variant_matcher::VariantMatcher<T> > VariantWith(
internal::variant_matcher::VariantMatcher<T>(matcher));
}
+#if GTEST_HAS_EXCEPTIONS
+
+// Anything inside the `internal` namespace is internal to the implementation
+// and must not be used in user code!
+namespace internal {
+
+class WithWhatMatcherImpl {
+ public:
+ WithWhatMatcherImpl(Matcher<std::string> matcher)
+ : matcher_(std::move(matcher)) {}
+
+ void DescribeTo(std::ostream* os) const {
+ *os << "contains .what() that ";
+ matcher_.DescribeTo(os);
+ }
+
+ void DescribeNegationTo(std::ostream* os) const {
+ *os << "contains .what() that does not ";
+ matcher_.DescribeTo(os);
+ }
+
+ template <typename Err>
+ bool MatchAndExplain(const Err& err, MatchResultListener* listener) const {
+ *listener << "which contains .what() that ";
+ return matcher_.MatchAndExplain(err.what(), listener);
+ }
+
+ private:
+ const Matcher<std::string> matcher_;
+};
+
+inline PolymorphicMatcher<WithWhatMatcherImpl> WithWhat(
+ Matcher<std::string> m) {
+ return MakePolymorphicMatcher(WithWhatMatcherImpl(std::move(m)));
+}
+
+template <typename Err>
+class ExceptionMatcherImpl {
+ class NeverThrown {
+ public:
+ const char* what() const noexcept {
+ return "this exception should never be thrown";
+ }
+ };
+
+ // If the matchee raises an exception of a wrong type, we'd like to
+ // catch it and print its message and type. To do that, we add an additional
+ // catch clause:
+ //
+ // try { ... }
+ // catch (const Err&) { /* an expected exception */ }
+ // catch (const std::exception&) { /* exception of a wrong type */ }
+ //
+ // However, if the `Err` itself is `std::exception`, we'd end up with two
+ // identical `catch` clauses:
+ //
+ // try { ... }
+ // catch (const std::exception&) { /* an expected exception */ }
+ // catch (const std::exception&) { /* exception of a wrong type */ }
+ //
+ // This can cause a warning or an error in some compilers. To resolve
+ // the issue, we use a fake error type whenever `Err` is `std::exception`:
+ //
+ // try { ... }
+ // catch (const std::exception&) { /* an expected exception */ }
+ // catch (const NeverThrown&) { /* exception of a wrong type */ }
+ using DefaultExceptionType = typename std::conditional<
+ std::is_same<typename std::remove_cv<
+ typename std::remove_reference<Err>::type>::type,
+ std::exception>::value,
+ const NeverThrown&, const std::exception&>::type;
+
+ public:
+ ExceptionMatcherImpl(Matcher<const Err&> matcher)
+ : matcher_(std::move(matcher)) {}
+
+ void DescribeTo(std::ostream* os) const {
+ *os << "throws an exception which is a " << GetTypeName<Err>();
+ *os << " which ";
+ matcher_.DescribeTo(os);
+ }
+
+ void DescribeNegationTo(std::ostream* os) const {
+ *os << "throws an exception which is not a " << GetTypeName<Err>();
+ *os << " which ";
+ matcher_.DescribeNegationTo(os);
+ }
+
+ template <typename T>
+ bool MatchAndExplain(T&& x, MatchResultListener* listener) const {
+ try {
+ (void)(std::forward<T>(x)());
+ } catch (const Err& err) {
+ *listener << "throws an exception which is a " << GetTypeName<Err>();
+ *listener << " ";
+ return matcher_.MatchAndExplain(err, listener);
+ } catch (DefaultExceptionType err) {
+#if GTEST_HAS_RTTI
+ *listener << "throws an exception of type " << GetTypeName(typeid(err));
+ *listener << " ";
+#else
+ *listener << "throws an std::exception-derived type ";
+#endif
+ *listener << "with description \"" << err.what() << "\"";
+ return false;
+ } catch (...) {
+ *listener << "throws an exception of an unknown type";
+ return false;
+ }
+
+ *listener << "does not throw any exception";
+ return false;
+ }
+
+ private:
+ const Matcher<const Err&> matcher_;
+};
+
+} // namespace internal
+
+// Throws()
+// Throws(exceptionMatcher)
+// ThrowsMessage(messageMatcher)
+//
+// This matcher accepts a callable and verifies that when invoked, it throws
+// an exception with the given type and properties.
+//
+// Examples:
+//
+// EXPECT_THAT(
+// []() { throw std::runtime_error("message"); },
+// Throws<std::runtime_error>());
+//
+// EXPECT_THAT(
+// []() { throw std::runtime_error("message"); },
+// ThrowsMessage<std::runtime_error>(HasSubstr("message")));
+//
+// EXPECT_THAT(
+// []() { throw std::runtime_error("message"); },
+// Throws<std::runtime_error>(
+// Property(&std::runtime_error::what, HasSubstr("message"))));
+
+template <typename Err>
+PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>> Throws() {
+ return MakePolymorphicMatcher(
+ internal::ExceptionMatcherImpl<Err>(A<const Err&>()));
+}
+
+template <typename Err, typename ExceptionMatcher>
+PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>> Throws(
+ const ExceptionMatcher& exception_matcher) {
+ // Using matcher cast allows users to pass a matcher of a more broad type.
+ // For example user may want to pass Matcher<std::exception>
+ // to Throws<std::runtime_error>, or Matcher<int64> to Throws<int32>.
+ return MakePolymorphicMatcher(internal::ExceptionMatcherImpl<Err>(
+ SafeMatcherCast<const Err&>(exception_matcher)));
+}
+
+template <typename Err, typename MessageMatcher>
+PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>> ThrowsMessage(
+ MessageMatcher&& message_matcher) {
+ static_assert(std::is_base_of<std::exception, Err>::value,
+ "expected an std::exception-derived type");
+ return Throws<Err>(internal::WithWhat(
+ MatcherCast<std::string>(std::forward<MessageMatcher>(message_matcher))));
+}
+
+#endif // GTEST_HAS_EXCEPTIONS
+
// These macros allow using matchers to check values in Google Test
// tests. ASSERT_THAT(value, matcher) and EXPECT_THAT(value, matcher)
// succeed if and only if the value matches the matcher. If the assertion
diff --git a/chromium/third_party/googletest/src/googlemock/scripts/generator/cpp/ast.py b/chromium/third_party/googletest/src/googlemock/scripts/generator/cpp/ast.py
index b4890a5471b..cc9f89aa510 100755
--- a/chromium/third_party/googletest/src/googlemock/scripts/generator/cpp/ast.py
+++ b/chromium/third_party/googletest/src/googlemock/scripts/generator/cpp/ast.py
@@ -1599,12 +1599,11 @@ class AstBuilder(object):
bases, templated_types, body, self.namespace_stack)
def handle_namespace(self):
- token = self._GetNextToken()
# Support anonymous namespaces.
name = None
- if token.token_type == tokenize.NAME:
- name = token.name
- token = self._GetNextToken()
+ name_tokens, token = self.GetName()
+ if name_tokens:
+ name = ''.join([t.name for t in name_tokens])
self.namespace_stack.append(name)
assert token.token_type == tokenize.SYNTAX, token
# Create an internal token that denotes when the namespace is complete.
diff --git a/chromium/third_party/googletest/src/googlemock/scripts/generator/cpp/gmock_class_test.py b/chromium/third_party/googletest/src/googlemock/scripts/generator/cpp/gmock_class_test.py
index 74655692c30..527182cc39a 100755
--- a/chromium/third_party/googletest/src/googlemock/scripts/generator/cpp/gmock_class_test.py
+++ b/chromium/third_party/googletest/src/googlemock/scripts/generator/cpp/gmock_class_test.py
@@ -361,26 +361,26 @@ class GenerateMocksTest(TestCase):
source = """
namespace Foo {
namespace Bar { class Forward; }
-namespace Baz {
+namespace Baz::Qux {
class Test {
public:
virtual void Foo();
};
-} // namespace Baz
+} // namespace Baz::Qux
} // namespace Foo
"""
expected = """\
namespace Foo {
-namespace Baz {
+namespace Baz::Qux {
class MockTest : public Test {
public:
MOCK_METHOD(void, Foo, (), (override));
};
-} // namespace Baz
+} // namespace Baz::Qux
} // namespace Foo
"""
self.assertEqualIgnoreLeadingWhitespace(expected,
diff --git a/chromium/third_party/googletest/src/googlemock/src/gmock-spec-builders.cc b/chromium/third_party/googletest/src/googlemock/src/gmock-spec-builders.cc
index 81ea98949c2..05a50f67c2b 100644
--- a/chromium/third_party/googletest/src/googlemock/src/gmock-spec-builders.cc
+++ b/chromium/third_party/googletest/src/googlemock/src/gmock-spec-builders.cc
@@ -433,10 +433,10 @@ UntypedActionResultHolderBase* UntypedFunctionMockerBase::UntypedInvokeWith(
// The UntypedFindMatchingExpectation() function acquires and
// releases g_gmock_mutex.
+
const ExpectationBase* const untyped_expectation =
- this->UntypedFindMatchingExpectation(
- untyped_args, &untyped_action, &is_excessive,
- &ss, &why);
+ this->UntypedFindMatchingExpectation(untyped_args, &untyped_action,
+ &is_excessive, &ss, &why);
const bool found = untyped_expectation != nullptr;
// True if and only if we need to print the call's arguments
@@ -461,26 +461,42 @@ UntypedActionResultHolderBase* UntypedFunctionMockerBase::UntypedInvokeWith(
untyped_expectation->DescribeLocationTo(&loc);
}
- UntypedActionResultHolderBase* const result =
- untyped_action == nullptr
- ? this->UntypedPerformDefaultAction(untyped_args, ss.str())
- : this->UntypedPerformAction(untyped_action, untyped_args);
- if (result != nullptr) result->PrintAsActionResult(&ss);
- ss << "\n" << why.str();
-
- if (!found) {
- // No expectation matches this call - reports a failure.
- Expect(false, nullptr, -1, ss.str());
- } else if (is_excessive) {
- // We had an upper-bound violation and the failure message is in ss.
- Expect(false, untyped_expectation->file(),
- untyped_expectation->line(), ss.str());
- } else {
- // We had an expected call and the matching expectation is
- // described in ss.
- Log(kInfo, loc.str() + ss.str(), 2);
+ UntypedActionResultHolderBase* result = nullptr;
+
+ auto perform_action = [&] {
+ return untyped_action == nullptr
+ ? this->UntypedPerformDefaultAction(untyped_args, ss.str())
+ : this->UntypedPerformAction(untyped_action, untyped_args);
+ };
+ auto handle_failures = [&] {
+ ss << "\n" << why.str();
+
+ if (!found) {
+ // No expectation matches this call - reports a failure.
+ Expect(false, nullptr, -1, ss.str());
+ } else if (is_excessive) {
+ // We had an upper-bound violation and the failure message is in ss.
+ Expect(false, untyped_expectation->file(), untyped_expectation->line(),
+ ss.str());
+ } else {
+ // We had an expected call and the matching expectation is
+ // described in ss.
+ Log(kInfo, loc.str() + ss.str(), 2);
+ }
+ };
+#if GTEST_HAS_EXCEPTIONS
+ try {
+ result = perform_action();
+ } catch (...) {
+ handle_failures();
+ throw;
}
+#else
+ result = perform_action();
+#endif
+ if (result != nullptr) result->PrintAsActionResult(&ss);
+ handle_failures();
return result;
}
@@ -624,7 +640,7 @@ class MockObjectRegistry {
if (leaked_count > 0) {
std::cout << "\nERROR: " << leaked_count << " leaked mock "
<< (leaked_count == 1 ? "object" : "objects")
- << " found at program exit. Expectations on a mock object is "
+ << " found at program exit. Expectations on a mock object are "
"verified when the object is destructed. Leaking a mock "
"means that its expectations aren't verified, which is "
"usually a test bug. If you really intend to leak a mock, "
diff --git a/chromium/third_party/googletest/src/googlemock/src/gmock.cc b/chromium/third_party/googletest/src/googlemock/src/gmock.cc
index 32b2a7394fd..7bcdb0ba2df 100644
--- a/chromium/third_party/googletest/src/googlemock/src/gmock.cc
+++ b/chromium/third_party/googletest/src/googlemock/src/gmock.cc
@@ -124,7 +124,7 @@ static bool ParseGoogleMockStringFlag(const char* str, const char* flag,
}
static bool ParseGoogleMockIntFlag(const char* str, const char* flag,
- int* value) {
+ int32_t* value) {
// Gets the value of the flag as a string.
const char* const value_str = ParseGoogleMockFlagValue(str, flag, true);
diff --git a/chromium/third_party/googletest/src/googletest/CMakeLists.txt b/chromium/third_party/googletest/src/googletest/CMakeLists.txt
index f538c967fde..cf63c6026f1 100644
--- a/chromium/third_party/googletest/src/googletest/CMakeLists.txt
+++ b/chromium/third_party/googletest/src/googletest/CMakeLists.txt
@@ -320,6 +320,9 @@ $env:Path = \"$project_bin;$env:Path\"
cxx_executable(googletest-uninitialized-test_ test gtest)
py_test(googletest-uninitialized-test)
+ cxx_executable(gtest_list_output_unittest_ test gtest)
+ py_test(gtest_list_output_unittest)
+
cxx_executable(gtest_xml_outfile1_test_ test gtest_main)
cxx_executable(gtest_xml_outfile2_test_ test gtest_main)
py_test(gtest_xml_outfiles_test)
diff --git a/chromium/third_party/googletest/src/googletest/cmake/internal_utils.cmake b/chromium/third_party/googletest/src/googletest/cmake/internal_utils.cmake
index 2f70f0b084b..b3e8b8190ea 100644
--- a/chromium/third_party/googletest/src/googletest/cmake/internal_utils.cmake
+++ b/chromium/third_party/googletest/src/googletest/cmake/internal_utils.cmake
@@ -188,6 +188,10 @@ function(cxx_library_with_type name type cxx_flags)
endif()
target_link_libraries(${name} PUBLIC ${threads_spec})
endif()
+
+ if (NOT "${CMAKE_VERSION}" VERSION_LESS "3.8")
+ target_compile_features(${name} PUBLIC cxx_std_11)
+ endif()
endfunction()
########################################################################
diff --git a/chromium/third_party/googletest/src/googletest/docs/advanced.md b/chromium/third_party/googletest/src/googletest/docs/advanced.md
index 60c1a2b0b51..32819b6ba13 100644
--- a/chromium/third_party/googletest/src/googletest/docs/advanced.md
+++ b/chromium/third_party/googletest/src/googletest/docs/advanced.md
@@ -2,6 +2,8 @@
<!-- GOOGLETEST_CM0016 DO NOT DELETE -->
+<!-- GOOGLETEST_CM0035 DO NOT DELETE -->
+
## Introduction
Now that you have read the [googletest Primer](primer.md) and learned how to
@@ -909,6 +911,12 @@ handlers registered with `pthread_atfork(3)`.
## Using Assertions in Sub-routines
+Note: If you want to put a series of test assertions in a subroutine to check
+for a complex condition, consider using
+[a custom GMock matcher](../../googlemock/docs/cook_book.md#NewMatchers)
+instead. This lets you provide a more readable error message in case of failure
+and avoid all of the issues described below.
+
### Adding Traces to Assertions
If a test sub-routine is called from several places, when an assertion inside it
@@ -1375,15 +1383,11 @@ INSTANTIATE_TEST_SUITE_P(InstantiationName,
NOTE: The code above must be placed at global or namespace scope, not at
function scope.
-NOTE: Don't forget this step! If you do your test will silently pass, but none
-of its suites will ever run!
-
-There is work in progress to make omitting `INSTANTIATE_TEST_SUITE_P` show up
-under the `GoogleTestVerification` test suite and to then make that an error.
-If you have a test suite where that omission is not an error, for example it is
-in a library that may be linked in for other reason or where the list of test
-cases is dynamic and may be empty, then this check can be suppressed by tagging
-the test suite:
+Per default, every `TEST_P` without a corresponding `INSTANTIATE_TEST_SUITE_P`
+causes a failing test in test suite `GoogleTestVerification`. If you have a test
+suite where that omission is not an error, for example it is in a library that
+may be linked in for other reason or where the list of test cases is dynamic and
+may be empty, then this check can be suppressed by tagging the test suite:
```c++
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(FooTest);
@@ -1490,7 +1494,7 @@ for conciseness:
```c++
enum class MyType { MY_FOO = 0, MY_BAR = 1 };
-class MyTestSuite : public testing::TestWithParam<std::tuple<MyType, string>> {
+class MyTestSuite : public testing::TestWithParam<std::tuple<MyType, std::string>> {
};
INSTANTIATE_TEST_SUITE_P(
@@ -1499,7 +1503,7 @@ INSTANTIATE_TEST_SUITE_P(
testing::Values(MyType::VALUE_0, MyType::VALUE_1),
testing::ValuesIn("", "")),
[](const testing::TestParamInfo<MyTestSuite::ParamType>& info) {
- string name = absl::StrCat(
+ std::string name = absl::StrCat(
std::get<0>(info.param) == MY_FOO ? "Foo" : "Bar", "_",
std::get<1>(info.param));
absl::c_replace_if(name, [](char c) { return !std::isalnum(c); }, '_');
diff --git a/chromium/third_party/googletest/src/googletest/docs/faq.md b/chromium/third_party/googletest/src/googletest/docs/faq.md
index 05ecdd7d8da..f290f0250b5 100644
--- a/chromium/third_party/googletest/src/googletest/docs/faq.md
+++ b/chromium/third_party/googletest/src/googletest/docs/faq.md
@@ -2,6 +2,8 @@
<!-- GOOGLETEST_CM0014 DO NOT DELETE -->
+<!-- GOOGLETEST_CM0035 DO NOT DELETE -->
+
## Why should test suite names and test names not contain underscore?
Underscore (`_`) is special, as C++ reserves the following to be used by the
@@ -295,7 +297,7 @@ program from the beginning in the child process. Therefore make sure your
program can run side-by-side with itself and is deterministic.
In the end, this boils down to good concurrent programming. You have to make
-sure that there is no race conditions or dead locks in your program. No silver
+sure that there are no race conditions or deadlocks in your program. No silver
bullet - sorry!
## Should I use the constructor/destructor of the test fixture or SetUp()/TearDown()? {#CtorVsSetUp}
@@ -401,7 +403,7 @@ you can use it in a predicate assertion like this:
ASSERT_PRED1(IsNegative<int>, -5);
```
-Things are more interesting if your template has more than one parameters. The
+Things are more interesting if your template has more than one parameter. The
following won't compile:
```c++
@@ -555,7 +557,7 @@ TEST(MyDeathTest, ComplexExpression) {
"(Func1|Method) failed");
}
-// Death assertions can be used any where in a function. In
+// Death assertions can be used anywhere in a function. In
// particular, they can be inside a loop.
TEST(MyDeathTest, InsideLoop) {
// Verifies that Foo(0), Foo(1), ..., and Foo(4) all die.
@@ -597,7 +599,7 @@ However, there are cases where you have to define your own:
## Why does ASSERT_DEATH complain about previous threads that were already joined?
With the Linux pthread library, there is no turning back once you cross the line
-from single thread to multiple threads. The first time you create a thread, a
+from a single thread to multiple threads. The first time you create a thread, a
manager thread is created in addition, so you get 3, not 2, threads. Later when
the thread you create joins the main thread, the thread count decrements by 1,
but the manager thread will never be killed, so you still have 2 threads, which
@@ -612,7 +614,7 @@ runs on, you shouldn't depend on this.
googletest does not interleave tests from different test suites. That is, it
runs all tests in one test suite first, and then runs all tests in the next test
suite, and so on. googletest does this because it needs to set up a test suite
-before the first test in it is run, and tear it down afterwords. Splitting up
+before the first test in it is run, and tear it down afterwards. Splitting up
the test case would require multiple set-up and tear-down processes, which is
inefficient and makes the semantics unclean.
diff --git a/chromium/third_party/googletest/src/googletest/docs/pkgconfig.md b/chromium/third_party/googletest/src/googletest/docs/pkgconfig.md
index b9bef3fde50..aed4ad45440 100644
--- a/chromium/third_party/googletest/src/googletest/docs/pkgconfig.md
+++ b/chromium/third_party/googletest/src/googletest/docs/pkgconfig.md
@@ -1,5 +1,7 @@
## Using GoogleTest from various build systems
+<!-- GOOGLETEST_CM0035 DO NOT DELETE -->
+
GoogleTest comes with pkg-config files that can be used to determine all
necessary flags for compiling and linking to GoogleTest (and GoogleMock).
Pkg-config is a standardised plain-text format containing
diff --git a/chromium/third_party/googletest/src/googletest/docs/primer.md b/chromium/third_party/googletest/src/googletest/docs/primer.md
index 2f459fd7fd9..ed44369ab3f 100644
--- a/chromium/third_party/googletest/src/googletest/docs/primer.md
+++ b/chromium/third_party/googletest/src/googletest/docs/primer.md
@@ -1,5 +1,7 @@
# Googletest Primer
+<!-- GOOGLETEST_CM0035 DO NOT DELETE -->
+
## Introduction: Why googletest?
*googletest* helps you write better C++ tests.
diff --git a/chromium/third_party/googletest/src/googletest/include/gtest/gtest-matchers.h b/chromium/third_party/googletest/src/googletest/include/gtest/gtest-matchers.h
index a61cef4093c..04cc63de239 100644
--- a/chromium/third_party/googletest/src/googletest/include/gtest/gtest-matchers.h
+++ b/chromium/third_party/googletest/src/googletest/include/gtest/gtest-matchers.h
@@ -612,6 +612,10 @@ class GeMatcher : public ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe> {
static const char* NegatedDesc() { return "isn't >="; }
};
+template <typename T, typename = typename std::enable_if<
+ std::is_constructible<std::string, T>::value>::type>
+using StringLike = T;
+
// Implements polymorphic matchers MatchesRegex(regex) and
// ContainsRegex(regex), which can be used as a Matcher<T> as long as
// T can be converted to a string.
@@ -672,9 +676,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
const internal::RE* regex) {
return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
}
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
- const std::string& regex) {
- return MatchesRegex(new internal::RE(regex));
+template <typename T = std::string>
+PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
+ const internal::StringLike<T>& regex) {
+ return MatchesRegex(new internal::RE(std::string(regex)));
}
// Matches a string that contains regular expression 'regex'.
@@ -683,9 +688,10 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
const internal::RE* regex) {
return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
}
-inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
- const std::string& regex) {
- return ContainsRegex(new internal::RE(regex));
+template <typename T = std::string>
+PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
+ const internal::StringLike<T>& regex) {
+ return ContainsRegex(new internal::RE(std::string(regex)));
}
// Creates a polymorphic matcher that matches anything equal to x.
diff --git a/chromium/third_party/googletest/src/googletest/include/gtest/gtest-param-test.h b/chromium/third_party/googletest/src/googletest/include/gtest/gtest-param-test.h
index 5b039df9f6e..9a60b76677c 100644
--- a/chromium/third_party/googletest/src/googletest/include/gtest/gtest-param-test.h
+++ b/chromium/third_party/googletest/src/googletest/include/gtest/gtest-param-test.h
@@ -428,7 +428,8 @@ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) {
->AddTestPattern( \
GTEST_STRINGIFY_(test_suite_name), GTEST_STRINGIFY_(test_name), \
new ::testing::internal::TestMetaFactory<GTEST_TEST_CLASS_NAME_( \
- test_suite_name, test_name)>()); \
+ test_suite_name, test_name)>(), \
+ ::testing::internal::CodeLocation(__FILE__, __LINE__)); \
return 0; \
} \
static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
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 c74894b023a..f24512a9f2e 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
@@ -499,6 +499,26 @@ inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
inline void PrintTo(unsigned char* s, ::std::ostream* os) {
PrintTo(ImplicitCast_<const void*>(s), os);
}
+#ifdef __cpp_char8_t
+inline void PrintTo(const char8_t* s, ::std::ostream* os) {
+ PrintTo(ImplicitCast_<const void*>(s), os);
+}
+inline void PrintTo(char8_t* s, ::std::ostream* os) {
+ PrintTo(ImplicitCast_<const void*>(s), os);
+}
+#endif
+inline void PrintTo(const char16_t* s, ::std::ostream* os) {
+ PrintTo(ImplicitCast_<const void*>(s), os);
+}
+inline void PrintTo(char16_t* s, ::std::ostream* os) {
+ PrintTo(ImplicitCast_<const void*>(s), os);
+}
+inline void PrintTo(const char32_t* s, ::std::ostream* os) {
+ PrintTo(ImplicitCast_<const void*>(s), os);
+}
+inline void PrintTo(char32_t* s, ::std::ostream* os) {
+ PrintTo(ImplicitCast_<const void*>(s), os);
+}
// MSVC can be configured to define wchar_t as a typedef of unsigned
// short. It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native
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 028f21eb54c..233724ccdd9 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
@@ -520,6 +520,7 @@ struct SuiteApiResolver : T {
static SetUpTearDownSuiteFuncType GetSetUpCaseOrSuite(const char* filename,
int line_num) {
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
SetUpTearDownSuiteFuncType test_case_fp =
GetNotDefaultOrNull(&T::SetUpTestCase, &Test::SetUpTestCase);
SetUpTearDownSuiteFuncType test_suite_fp =
@@ -531,10 +532,16 @@ struct SuiteApiResolver : T {
<< filename << ":" << line_num;
return test_case_fp != nullptr ? test_case_fp : test_suite_fp;
+#else
+ (void)(filename);
+ (void)(line_num);
+ return &T::SetUpTestSuite;
+#endif
}
static SetUpTearDownSuiteFuncType GetTearDownCaseOrSuite(const char* filename,
int line_num) {
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
SetUpTearDownSuiteFuncType test_case_fp =
GetNotDefaultOrNull(&T::TearDownTestCase, &Test::TearDownTestCase);
SetUpTearDownSuiteFuncType test_suite_fp =
@@ -546,6 +553,11 @@ struct SuiteApiResolver : T {
<< filename << ":" << line_num;
return test_case_fp != nullptr ? test_case_fp : test_suite_fp;
+#else
+ (void)(filename);
+ (void)(line_num);
+ return &T::TearDownTestSuite;
+#endif
}
};
@@ -1291,41 +1303,90 @@ constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; }
} else /* NOLINT */ \
static_assert(true, "") // User must have a semicolon after expansion.
-#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::ConstCharPtr gtest_msg = "") { \
- bool gtest_caught_expected = false; \
- try { \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- } \
- catch (expected_exception const&) { \
- gtest_caught_expected = true; \
- } \
- catch (...) { \
- gtest_msg.value = \
- "Expected: " #statement " throws an exception of type " \
- #expected_exception ".\n Actual: it throws a different type."; \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
- } \
- if (!gtest_caught_expected) { \
- gtest_msg.value = \
- "Expected: " #statement " throws an exception of type " \
- #expected_exception ".\n Actual: it throws nothing."; \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
- fail(gtest_msg.value)
+#if GTEST_HAS_EXCEPTIONS
+
+namespace testing {
+namespace internal {
+
+class NeverThrown {
+ public:
+ const char* what() const noexcept {
+ return "this exception should never be thrown";
+ }
+};
+
+} // namespace internal
+} // namespace testing
+
+#if GTEST_HAS_RTTI
+
+#define GTEST_EXCEPTION_TYPE_(e) ::testing::internal::GetTypeName(typeid(e))
+
+#else // GTEST_HAS_RTTI
+
+#define GTEST_EXCEPTION_TYPE_(e) \
+ std::string { "an std::exception-derived error" }
+
+#endif // GTEST_HAS_RTTI
+
+#define GTEST_TEST_THROW_CATCH_STD_EXCEPTION_(statement, expected_exception) \
+ catch (typename std::conditional< \
+ std::is_same<typename std::remove_cv<typename std::remove_reference< \
+ expected_exception>::type>::type, \
+ std::exception>::value, \
+ const ::testing::internal::NeverThrown&, const std::exception&>::type \
+ e) { \
+ gtest_msg.value = "Expected: " #statement \
+ " throws an exception of type " #expected_exception \
+ ".\n Actual: it throws "; \
+ gtest_msg.value += GTEST_EXCEPTION_TYPE_(e); \
+ gtest_msg.value += " with description \""; \
+ gtest_msg.value += e.what(); \
+ gtest_msg.value += "\"."; \
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
+ }
+
+#else // GTEST_HAS_EXCEPTIONS
+
+#define GTEST_TEST_THROW_CATCH_STD_EXCEPTION_(statement, expected_exception)
+
+#endif // GTEST_HAS_EXCEPTIONS
+
+#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (::testing::internal::TrueWithString gtest_msg{}) { \
+ bool gtest_caught_expected = false; \
+ try { \
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
+ } catch (expected_exception const&) { \
+ gtest_caught_expected = true; \
+ } \
+ GTEST_TEST_THROW_CATCH_STD_EXCEPTION_(statement, expected_exception) \
+ catch (...) { \
+ gtest_msg.value = "Expected: " #statement \
+ " throws an exception of type " #expected_exception \
+ ".\n Actual: it throws a different type."; \
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
+ } \
+ if (!gtest_caught_expected) { \
+ gtest_msg.value = "Expected: " #statement \
+ " throws an exception of type " #expected_exception \
+ ".\n Actual: it throws nothing."; \
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
+ } \
+ } else /*NOLINT*/ \
+ GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__) \
+ : fail(gtest_msg.value.c_str())
#if GTEST_HAS_EXCEPTIONS
-#define GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \
- catch (std::exception const& e) { \
- gtest_msg.value = ( \
- "it throws std::exception-derived exception with description: \"" \
- ); \
- gtest_msg.value += e.what(); \
- gtest_msg.value += "\"."; \
+#define GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \
+ catch (std::exception const& e) { \
+ gtest_msg.value = "it throws "; \
+ gtest_msg.value += GTEST_EXCEPTION_TYPE_(e); \
+ gtest_msg.value += " with description \""; \
+ gtest_msg.value += e.what(); \
+ gtest_msg.value += "\"."; \
goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
}
@@ -1409,7 +1470,7 @@ constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; }
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
: public parent_class { \
public: \
- GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
+ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() = default; \
~GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() override = default; \
GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
test_name)); \
diff --git a/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-param-util.h b/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-param-util.h
index 7f7a13bf84b..f26d7d1186f 100644
--- a/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-param-util.h
+++ b/chromium/third_party/googletest/src/googletest/include/gtest/internal/gtest-param-util.h
@@ -520,9 +520,10 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
// parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is
// test suite base name and DoBar is test base name.
void AddTestPattern(const char* test_suite_name, const char* test_base_name,
- TestMetaFactoryBase<ParamType>* meta_factory) {
- tests_.push_back(std::shared_ptr<TestInfo>(
- new TestInfo(test_suite_name, test_base_name, meta_factory)));
+ TestMetaFactoryBase<ParamType>* meta_factory,
+ CodeLocation code_location) {
+ tests_.push_back(std::shared_ptr<TestInfo>(new TestInfo(
+ test_suite_name, test_base_name, meta_factory, code_location)));
}
// INSTANTIATE_TEST_SUITE_P macro uses AddGenerator() to record information
// about a generator.
@@ -589,7 +590,7 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
MakeAndRegisterTestInfo(
test_suite_name.c_str(), test_name_stream.GetString().c_str(),
nullptr, // No type parameter.
- PrintToString(*param_it).c_str(), code_location_,
+ PrintToString(*param_it).c_str(), test_info->code_location,
GetTestSuiteTypeId(),
SuiteApiResolver<TestSuite>::GetSetUpCaseOrSuite(file, line),
SuiteApiResolver<TestSuite>::GetTearDownCaseOrSuite(file, line),
@@ -610,14 +611,17 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
// with TEST_P macro.
struct TestInfo {
TestInfo(const char* a_test_suite_base_name, const char* a_test_base_name,
- TestMetaFactoryBase<ParamType>* a_test_meta_factory)
+ TestMetaFactoryBase<ParamType>* a_test_meta_factory,
+ CodeLocation a_code_location)
: test_suite_base_name(a_test_suite_base_name),
test_base_name(a_test_base_name),
- test_meta_factory(a_test_meta_factory) {}
+ test_meta_factory(a_test_meta_factory),
+ code_location(a_code_location) {}
const std::string test_suite_base_name;
const std::string test_base_name;
const std::unique_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory;
+ const CodeLocation code_location;
};
using TestInfoContainer = ::std::vector<std::shared_ptr<TestInfo> >;
// Records data received from INSTANTIATE_TEST_SUITE_P macros:
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 6f9c14ae5e2..6b66362f17a 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
@@ -2055,15 +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
+#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW
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
+#else // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW
return fopen(path, mode);
-#endif // GTEST_OS_WINDOWS
+#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW
}
#if !GTEST_OS_WINDOWS_MOBILE
inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
@@ -2220,7 +2220,8 @@ using TimeInMillis = int64_t; // Represents time in milliseconds.
// Parses 'str' for a 32-bit signed integer. If successful, writes the result
// to *value and returns true; otherwise leaves *value unchanged and returns
// false.
-bool ParseInt32(const Message& src_text, const char* str, int32_t* value);
+GTEST_API_ bool ParseInt32(const Message& src_text, const char* str,
+ int32_t* value);
// Parses a bool/int32_t/string from the environment variable
// corresponding to the given Google Test flag.
diff --git a/chromium/third_party/googletest/src/googletest/src/gtest-death-test.cc b/chromium/third_party/googletest/src/googletest/src/gtest-death-test.cc
index 5d1031bea25..31de7d627e8 100644
--- a/chromium/third_party/googletest/src/googletest/src/gtest-death-test.cc
+++ b/chromium/third_party/googletest/src/googletest/src/gtest-death-test.cc
@@ -1225,21 +1225,9 @@ struct ExecDeathTestArgs {
int close_fd; // File descriptor to close; the read end of a pipe
};
-# if GTEST_OS_MAC
-inline char** GetEnviron() {
- // When Google Test is built as a framework on MacOS X, the environ variable
- // is unavailable. Apple's documentation (man environ) recommends using
- // _NSGetEnviron() instead.
- return *_NSGetEnviron();
-}
-# else
-// Some POSIX platforms expect you to declare environ. extern "C" makes
-// it reside in the global namespace.
+# if GTEST_OS_QNX
extern "C" char** environ;
-inline char** GetEnviron() { return environ; }
-# endif // GTEST_OS_MAC
-
-# if !GTEST_OS_QNX
+# else // GTEST_OS_QNX
// The main function for a threadsafe-style death test child process.
// This function is called in a clone()-ed process and thus must avoid
// any potentially unsafe operations like malloc or libc functions.
@@ -1259,18 +1247,18 @@ static int ExecDeathTestChildMain(void* child_arg) {
return EXIT_FAILURE;
}
- // We can safely call execve() as it's a direct system call. We
+ // We can safely call execv() as it's almost a direct system call. We
// cannot use execvp() as it's a libc function and thus potentially
- // unsafe. Since execve() doesn't search the PATH, the user must
+ // unsafe. Since execv() doesn't search the PATH, the user must
// invoke the test program via a valid path that contains at least
// one path separator.
- execve(args->argv[0], args->argv, GetEnviron());
- DeathTestAbort(std::string("execve(") + args->argv[0] + ", ...) in " +
+ execv(args->argv[0], args->argv);
+ DeathTestAbort(std::string("execv(") + args->argv[0] + ", ...) in " +
original_dir + " failed: " +
GetLastErrnoDescription());
return EXIT_FAILURE;
}
-# endif // !GTEST_OS_QNX
+# endif // GTEST_OS_QNX
# if GTEST_HAS_CLONE
// Two utility routines that together determine the direction the stack
@@ -1284,8 +1272,13 @@ static int ExecDeathTestChildMain(void* child_arg) {
// correct answer.
static void StackLowerThanAddress(const void* ptr,
bool* result) GTEST_NO_INLINE_;
+// Make sure sanitizers do not tamper with the stack here.
+// Ideally, we want to use `__builtin_frame_address` instead of a local variable
+// address with sanitizer disabled, but it does not work when the
+// compiler optimizes the stack frame out, which happens on PowerPC targets.
// HWAddressSanitizer add a random tag to the MSB of the local variable address,
// making comparison result unpredictable.
+GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
static void StackLowerThanAddress(const void* ptr, bool* result) {
int dummy;
@@ -1339,8 +1332,7 @@ static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) {
fd_flags | FD_CLOEXEC));
struct inheritance inherit = {0};
// spawn is a system call.
- child_pid =
- spawn(args.argv[0], 0, nullptr, &inherit, args.argv, GetEnviron());
+ child_pid = spawn(args.argv[0], 0, nullptr, &inherit, args.argv, environ);
// Restores the current working directory.
GTEST_DEATH_TEST_CHECK_(fchdir(cwd_fd) != -1);
GTEST_DEATH_TEST_CHECK_SYSCALL_(close(cwd_fd));
diff --git a/chromium/third_party/googletest/src/googletest/src/gtest-port.cc b/chromium/third_party/googletest/src/googletest/src/gtest-port.cc
index c180233735b..3f39f71c074 100644
--- a/chromium/third_party/googletest/src/googletest/src/gtest-port.cc
+++ b/chromium/third_party/googletest/src/googletest/src/gtest-port.cc
@@ -198,7 +198,8 @@ size_t GetThreadCount() {
if (sysctl(mib, miblen, NULL, &size, NULL, 0)) {
return 0;
}
- mib[5] = size / mib[4];
+
+ mib[5] = static_cast<int>(size / static_cast<size_t>(mib[4]));
// populate array of structs
struct kinfo_proc info[mib[5]];
@@ -207,8 +208,8 @@ size_t GetThreadCount() {
}
// exclude empty members
- int nthreads = 0;
- for (size_t i = 0; i < size / mib[4]; i++) {
+ size_t nthreads = 0;
+ for (size_t i = 0; i < size / static_cast<size_t>(mib[4]); i++) {
if (info[i].p_tid != -1)
nthreads++;
}
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 ce1b2afca72..20ce1b8692f 100644
--- a/chromium/third_party/googletest/src/googletest/src/gtest-printers.cc
+++ b/chromium/third_party/googletest/src/googletest/src/gtest-printers.cc
@@ -44,6 +44,7 @@
#include "gtest/gtest-printers.h"
#include <stdio.h>
#include <cctype>
+#include <cstdint>
#include <cwchar>
#include <ostream> // NOLINT
#include <string>
@@ -253,7 +254,7 @@ void PrintTo(wchar_t wc, ostream* os) {
void PrintTo(char32_t c, ::std::ostream* os) {
*os << std::hex << "U+" << std::uppercase << std::setfill('0') << std::setw(4)
- << c;
+ << static_cast<uint32_t>(c);
}
// Prints the given array of characters to the ostream. CharType must be either
diff --git a/chromium/third_party/googletest/src/googletest/src/gtest.cc b/chromium/third_party/googletest/src/googletest/src/gtest.cc
index 5a8999f60b9..96150f1fe5e 100644
--- a/chromium/third_party/googletest/src/googletest/src/gtest.cc
+++ b/chromium/third_party/googletest/src/googletest/src/gtest.cc
@@ -432,8 +432,8 @@ namespace {
// inserted to report ether an error or a log message.
//
// This configuration bit will likely be removed at some point.
-constexpr bool kErrorOnUninstantiatedParameterizedTest = false;
-constexpr bool kErrorOnUninstantiatedTypeParameterizedTest = false;
+constexpr bool kErrorOnUninstantiatedParameterizedTest = true;
+constexpr bool kErrorOnUninstantiatedTypeParameterizedTest = true;
// A test that fails at a given file/line location with a given message.
class FailureTest : public Test {
@@ -497,7 +497,7 @@ void InsertSyntheticTestCase(const std::string& name, CodeLocation location,
"removed but the rest got left behind.";
std::string message =
- "Paramaterized test suite " + name +
+ "Parameterized test suite " + name +
(has_test_p ? kMissingInstantiation : kMissingTestCase) +
"\n\n"
"To suppress this error for this test suite, insert the following line "
@@ -505,7 +505,7 @@ void InsertSyntheticTestCase(const std::string& name, CodeLocation location,
"\n\n"
"GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(" + name + ");";
- std::string full_name = "UninstantiatedParamaterizedTestSuite<" + name + ">";
+ std::string full_name = "UninstantiatedParameterizedTestSuite<" + name + ">";
RegisterTest( //
"GoogleTestVerification", full_name.c_str(),
nullptr, // No type parameter.
@@ -552,7 +552,7 @@ void TypeParameterizedTestSuiteRegistry::CheckForInstantiations() {
if (ignored.find(testcase.first) != ignored.end()) continue;
std::string message =
- "Type paramaterized test suite " + testcase.first +
+ "Type parameterized test suite " + testcase.first +
" is defined via REGISTER_TYPED_TEST_SUITE_P, but never instantiated "
"via INSTANTIATE_TYPED_TEST_SUITE_P. None of the test cases will run."
"\n\n"
@@ -568,7 +568,7 @@ void TypeParameterizedTestSuiteRegistry::CheckForInstantiations() {
testcase.first + ");";
std::string full_name =
- "UninstantiatedTypeParamaterizedTestSuite<" + testcase.first + ">";
+ "UninstantiatedTypeParameterizedTestSuite<" + testcase.first + ">";
RegisterTest( //
"GoogleTestVerification", full_name.c_str(),
nullptr, // No type parameter.
@@ -3007,9 +3007,9 @@ void TestSuite::Run() {
// Call both legacy and the new API
repeater->OnTestSuiteStart(*this);
// Legacy API is deprecated but still available
-#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
repeater->OnTestCaseStart(*this);
-#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI
+#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
impl->os_stack_trace_getter()->UponLeavingGTest();
internal::HandleExceptionsInMethodIfSupported(
@@ -3034,9 +3034,9 @@ void TestSuite::Run() {
// Call both legacy and the new API
repeater->OnTestSuiteEnd(*this);
// Legacy API is deprecated but still available
-#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
repeater->OnTestCaseEnd(*this);
-#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI
+#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
impl->set_current_test_suite(nullptr);
}
@@ -3053,9 +3053,9 @@ void TestSuite::Skip() {
// Call both legacy and the new API
repeater->OnTestSuiteStart(*this);
// Legacy API is deprecated but still available
-#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
repeater->OnTestCaseStart(*this);
-#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI
+#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
for (int i = 0; i < total_test_count(); i++) {
GetMutableTestInfo(i)->Skip();
@@ -3064,9 +3064,9 @@ void TestSuite::Skip() {
// Call both legacy and the new API
repeater->OnTestSuiteEnd(*this);
// Legacy API is deprecated but still available
-#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI
+#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
repeater->OnTestCaseEnd(*this);
-#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI
+#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
impl->set_current_test_suite(nullptr);
}