Add missing override keywords

(This is a merge of http://go/wvgerrit/139629.)

This patch fixes several places where the override keyword was missing.
These were found when future patches that enable stricter checking of
the override keyword were enabled. There are two basic categories of
missing override:

* Destructors found to be overriding a virtual destructor without using
  the override keyword.
* Test methods overriding methods on test-only or mock objects.

Some of these were previously marked as virtual, following our pre-C++11
style guidelines, but this is not necessary now that we have override.

Bug: 207684988
Test: x86-64 build
Change-Id: I09aa499bd3ea80d925e2fc422290d61eb005a769
This commit is contained in:
John "Juce" Bruce
2021-12-01 11:55:32 -08:00
parent 8574a4b98c
commit bfd299a4be
11 changed files with 15 additions and 13 deletions

View File

@@ -29,7 +29,7 @@ class PolicyTimersV15 : public PolicyTimers {
public:
PolicyTimersV15() : grace_period_end_time_(0) {}
virtual ~PolicyTimersV15() {}
~PolicyTimersV15() override {}
// UpdateLicense is used in handling a license response, a renewal response,
// or when restoring or releasing a persistent license.

View File

@@ -26,7 +26,7 @@ class PolicyTimersV16 : public PolicyTimers {
public:
PolicyTimersV16() {}
virtual ~PolicyTimersV16() {}
~PolicyTimersV16() override {}
// UpdateLicense is used in handling a license response, a renewal response,
// or when restoring or releasing a persistent license.

View File

@@ -76,7 +76,8 @@ class MockCryptoSession : public TestCryptoSession {
};
class TestStubCryptoSessionFactory : public CryptoSessionFactory {
CryptoSession* MakeCryptoSession(metrics::CryptoMetrics* crypto_metrics) {
CryptoSession* MakeCryptoSession(
metrics::CryptoMetrics* crypto_metrics) override {
return new MockCryptoSession(crypto_metrics);
}
};

View File

@@ -252,7 +252,7 @@ class CryptoSessionForTest : public TestCryptoSession, public WvCdmTestBase {
using CryptoSession::ExtractSystemIdFromOemCert;
CryptoSessionForTest() : TestCryptoSession(metrics_.GetCryptoMetrics()) {}
void SetUp() {}
void SetUp() override {}
KeySession* key_session() { return key_session_.get(); }

View File

@@ -3745,7 +3745,7 @@ const std::vector<std::string> kHashedUsageInfoFileKeySetList = {
class MockFile : public File {
public:
MockFile() {}
~MockFile() {}
~MockFile() override {}
MOCK_METHOD2(Read, ssize_t(char*, size_t));
MOCK_METHOD2(Write, ssize_t(const char*, size_t));
@@ -3754,7 +3754,7 @@ class MockFile : public File {
class MockFileSystem : public FileSystem {
public:
MockFileSystem() {}
~MockFileSystem() {}
~MockFileSystem() override {}
MOCK_METHOD2(Open, std::unique_ptr<File>(const std::string&, int flags));
MOCK_METHOD0(IsFactoryReset, bool());

View File

@@ -47,7 +47,7 @@ const std::string kAnotherFakeOtaProvisioningResponse =
class MockCryptoSession : public CryptoSession {
public:
MockCryptoSession() : CryptoSession(&crypto_metrics_) {}
~MockCryptoSession() {}
~MockCryptoSession() override {}
bool IsOpen() override { return is_open_; }
void SetIsOpen(bool is_open) { is_open_ = is_open; }

View File

@@ -79,7 +79,7 @@ class StubCdmClientPropertySet : public CdmClientPropertySet {
}
uint32_t session_sharing_id() const override { return session_sharing_id_; }
virtual bool use_atsc_mode() const { return false; }
bool use_atsc_mode() const override { return false; }
void set_session_sharing_id(uint32_t id) override {
session_sharing_id_ = id;

View File

@@ -248,7 +248,8 @@ CdmResponseType TestCryptoSession::GenerateNonce(uint32_t* nonce) {
}
class TestCryptoSessionFactory : public CryptoSessionFactory {
CryptoSession* MakeCryptoSession(metrics::CryptoMetrics* crypto_metrics) {
CryptoSession* MakeCryptoSession(
metrics::CryptoMetrics* crypto_metrics) override {
// We need to add extra locking here because we need to make sure that there
// are no other OEMCrypto calls between OEMCrypto_Initialize and
// InstallTestRootOfTrust. OEMCrypto_Initialize is called in the production

View File

@@ -105,7 +105,7 @@ class TestCryptoSession : public CryptoSession {
explicit TestCryptoSession(metrics::CryptoMetrics* crypto_metrics);
// This intercepts nonce flood errors, which is useful for tests that request
// many nonces and are not time critical.
CdmResponseType GenerateNonce(uint32_t* nonce);
CdmResponseType GenerateNonce(uint32_t* nonce) override;
};
// A holder for a license. Users of this class will first open a session with

View File

@@ -445,8 +445,8 @@ class MockCryptoSession : public TestCryptoSession {
// Fake method for testing. Having an EXPECT_CALL causes complexities
// for getting table capacity during initialization.
virtual bool GetMaximumUsageTableEntries(SecurityLevel /*security_level*/,
size_t* number_of_entries) {
bool GetMaximumUsageTableEntries(SecurityLevel /*security_level*/,
size_t* number_of_entries) override {
if (number_of_entries == nullptr || !maximum_usage_table_entries_set_)
return false;
*number_of_entries = maximum_usage_table_entries_;

View File

@@ -16,7 +16,7 @@ using drm_metrics::TestMetrics;
class EventMetricTest : public ::testing::Test {
public:
void SetUp() {}
void SetUp() override {}
protected:
};