Upgrade MOCK_METHOD to googletest 1.10
(This is a merge of http://go/wvgerrit/139989.) Googletest added a new, more powerful MOCK_METHOD() macro in 1.10. This patch updates all our usage of the old MOCK_METHOD family to the new macro. Full details can be found at https://github.com/google/googletest/blob/release-1.10.0/googlemock/docs/cook_book.md#creating-mock-classes but in brief, the new MOCK_METHOD() replaces the entire old MOCK_METHOD family and has the following advantages: 1) No need to count parameters or update the macro name when changing parameters. 2) No need for a different macro for const methods. 3) The ability to specify override, noexcept, and other function qualifiers. 4) The macro order is now the same as C++ method definition order: Return Type -> Name -> Arguments -> Qualifiers In addition to upgrading all our usage sites to the new macro, the addition of the override qualifier to our MOCK_METHODs helped uncover several cases where we were using MOCK_METHOD to override methods that didn't exist. This is a great example of why the override qualifier is so useful. These places have been updated, by removing the invalid and unused mock method. Bug: 207693687 Test: build_and_run_all_unit_tests Change-Id: Iaad4a22c7f72bb48b1356fe01a41eb0a2f555244
This commit is contained in:
committed by
John Bruce
parent
e5822def1d
commit
5606e7dae3
@@ -12,7 +12,7 @@ namespace wvcdm {
|
||||
|
||||
class MockClock : public Clock {
|
||||
public:
|
||||
MOCK_METHOD0(GetCurrentTime, int64_t());
|
||||
MOCK_METHOD(int64_t, GetCurrentTime, (), (override));
|
||||
};
|
||||
|
||||
// Frozen clock will always return the same value for the current time.
|
||||
|
||||
Reference in New Issue
Block a user