Google-style override & virtual
(This is a merge of http://go/wvgerrit/66625) Google C++ Style dictates that methods which override base class or interface methods should be declared "override" but not "virtual". Since our codebase has not had access to "override" until now, many of our classes do not follow this rule. I've updated as many places as I could find to follow Google C++ Style, which should hopefully help us catch errors better in the future. Bug: 111851141 Test: CE CDM Unit Tests Test: Android Unit Tests Change-Id: Ic23e2e482e967256da306791532b5fec7b81b2f2
This commit is contained in:
@@ -90,7 +90,7 @@ class OEMCryptoClientTest : public ::testing::Test, public SessionUtil {
|
||||
protected:
|
||||
OEMCryptoClientTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
::testing::Test::SetUp();
|
||||
wvcdm::g_cutoff = wvcdm::LOG_INFO;
|
||||
const ::testing::TestInfo* const test_info =
|
||||
@@ -100,7 +100,7 @@ class OEMCryptoClientTest : public ::testing::Test, public SessionUtil {
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_Initialize());
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
OEMCrypto_Terminate();
|
||||
::testing::Test::TearDown();
|
||||
}
|
||||
@@ -492,7 +492,7 @@ TEST_F(OEMCryptoClientTest, CanLoadTestKeys) {
|
||||
}
|
||||
|
||||
class OEMCryptoKeyboxTest : public OEMCryptoClientTest {
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
OEMCryptoClientTest::SetUp();
|
||||
OEMCryptoResult sts = OEMCrypto_IsKeyboxValid();
|
||||
// If the production keybox is valid, use it for these tests. Most of the
|
||||
@@ -710,7 +710,7 @@ class OEMCryptoSessionTests : public OEMCryptoClientTest {
|
||||
protected:
|
||||
OEMCryptoSessionTests() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
OEMCryptoClientTest::SetUp();
|
||||
EnsureTestKeys();
|
||||
if (global_features.usage_table) {
|
||||
@@ -738,7 +738,7 @@ class OEMCryptoSessionTests : public OEMCryptoClientTest {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
// If we installed a bad keybox, end with a good one installed.
|
||||
if (global_features.derive_key_method == DeviceFeatures::FORCE_TEST_KEYBOX)
|
||||
InstallKeybox(kTestKeybox, true);
|
||||
@@ -1294,7 +1294,7 @@ TEST_F(OEMCryptoSessionTests, LoadKeyUnalignedMessage) {
|
||||
class SessionTestAlternateVerification : public OEMCryptoSessionTests,
|
||||
public WithParamInterface<int> {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
OEMCryptoSessionTests::SetUp();
|
||||
target_api_ = static_cast<uint32_t>(GetParam());
|
||||
}
|
||||
@@ -1569,7 +1569,7 @@ class SessionTestRefreshKeyTest
|
||||
: public OEMCryptoSessionTests,
|
||||
public WithParamInterface<std::pair<bool, int> > {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
OEMCryptoSessionTests::SetUp();
|
||||
new_mac_keys_ =
|
||||
GetParam().first; // Whether to put new mac keys in LoadKeys.
|
||||
@@ -1831,7 +1831,7 @@ class OEMCryptoSessionTestsDecryptTests
|
||||
public WithParamInterface<tuple<OEMCrypto_CENCEncryptPatternDesc,
|
||||
OEMCryptoCipherMode, bool> > {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
OEMCryptoSessionTests::SetUp();
|
||||
pattern_ = ::testing::get<0>(GetParam());
|
||||
cipher_mode_ = ::testing::get<1>(GetParam());
|
||||
@@ -2789,7 +2789,7 @@ TEST_F(OEMCryptoLoadsCertificate, SupportsCertificatesAPI13) {
|
||||
|
||||
class OEMCryptoUsesCertificate : public OEMCryptoLoadsCertificate {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
OEMCryptoLoadsCertificate::SetUp();
|
||||
ASSERT_NO_FATAL_FAILURE(session_.open());
|
||||
if (global_features.derive_key_method !=
|
||||
@@ -2802,7 +2802,7 @@ class OEMCryptoUsesCertificate : public OEMCryptoLoadsCertificate {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
session_.close();
|
||||
OEMCryptoLoadsCertificate::TearDown();
|
||||
}
|
||||
@@ -4067,14 +4067,14 @@ class GenericCryptoTest : public OEMCryptoSessionTests {
|
||||
// reasonable number of blocks for most of the tests.
|
||||
GenericCryptoTest() : buffer_size_(160) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
OEMCryptoSessionTests::SetUp();
|
||||
ASSERT_NO_FATAL_FAILURE(session_.open());
|
||||
ASSERT_NO_FATAL_FAILURE(InstallTestSessionKeys(&session_));
|
||||
ASSERT_NO_FATAL_FAILURE(MakeFourKeys());
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
session_.close();
|
||||
OEMCryptoSessionTests::TearDown();
|
||||
}
|
||||
@@ -4626,7 +4626,7 @@ const unsigned int kLongKeyId = 2;
|
||||
|
||||
class GenericCryptoKeyIdLengthTest : public GenericCryptoTest {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
GenericCryptoTest::SetUp();
|
||||
const uint32_t kNoNonce = 0;
|
||||
session_.set_num_keys(5);
|
||||
@@ -4702,7 +4702,7 @@ TEST_F(GenericCryptoKeyIdLengthTest, UniformLongKeyId) {
|
||||
|
||||
class UsageTableTest : public GenericCryptoTest {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
GenericCryptoTest::SetUp();
|
||||
new_mac_keys_ = true;
|
||||
}
|
||||
@@ -4758,7 +4758,7 @@ class UsageTableTest : public GenericCryptoTest {
|
||||
class UsageTableTestWithMAC : public UsageTableTest,
|
||||
public WithParamInterface<bool> {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
UsageTableTest::SetUp();
|
||||
new_mac_keys_ = GetParam();
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ namespace wvoec {
|
||||
// These tests are required for LollyPop Android devices.
|
||||
class OEMCryptoAndroidLMPTest : public ::testing::Test {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
OEMCrypto_SetSandbox(kTestSandbox, sizeof(kTestSandbox));
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_Initialize());
|
||||
}
|
||||
|
||||
virtual void TearDown() { OEMCrypto_Terminate(); }
|
||||
void TearDown() override { OEMCrypto_Terminate(); }
|
||||
};
|
||||
|
||||
// Android devices must have a keybox, or use provisioning 3.0.
|
||||
|
||||
Reference in New Issue
Block a user