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
@@ -67,13 +67,13 @@ using wvcdm::QUERY_VALUE_SECURITY_LEVEL_L3;
|
||||
|
||||
class MockCDM : public wvcdm::WvContentDecryptionModule {
|
||||
public:
|
||||
MOCK_METHOD1(IsOpenSession, bool(const CdmSessionId&));
|
||||
MOCK_METHOD(bool, IsOpenSession, (const CdmSessionId&), (override));
|
||||
|
||||
MOCK_METHOD3(DecryptV16, CdmResponseType(const CdmSessionId&, bool,
|
||||
const CdmDecryptionParametersV16&));
|
||||
MOCK_METHOD(CdmResponseType, DecryptV16, (const CdmSessionId&, bool,
|
||||
const CdmDecryptionParametersV16&), (override));
|
||||
|
||||
MOCK_METHOD2(QuerySessionStatus, CdmResponseType(const CdmSessionId&,
|
||||
CdmQueryMap*));
|
||||
MOCK_METHOD(CdmResponseType, QuerySessionStatus, (const CdmSessionId&,
|
||||
CdmQueryMap*), (override));
|
||||
};
|
||||
|
||||
class WVCryptoPluginTest : public Test {
|
||||
|
||||
Reference in New Issue
Block a user