Log test name

[ Merge of http://go/wvgerrit/94083 ]

Logs the test case and test name when widevine android unit/integration
tests are run.

Bug: 149664134
Test: wv unit/integration tests
Change-Id: I446b88aa2954a386765e4559358d386b1a263913
This commit is contained in:
Rahul Frias
2020-02-16 23:30:26 -08:00
parent d7492082c6
commit ea2e110213
2 changed files with 14 additions and 4 deletions

View File

@@ -268,6 +268,14 @@ void WvCdmTestBase::InstallTestRootOfTrust() {
} }
} }
WvCdmTestBase::WvCdmTestBase()
: config_(default_config_), binary_provisioning_(false) {
const ::testing::TestInfo* const test_info =
::testing::UnitTest::GetInstance()->current_test_info();
LOGD("Running test %s.%s", test_info->test_case_name(), test_info->name());
}
void WvCdmTestBase::Provision() { void WvCdmTestBase::Provision() {
CdmProvisioningRequest prov_request; CdmProvisioningRequest prov_request;
CdmProvisioningRequest binary_prov_request; CdmProvisioningRequest binary_prov_request;

View File

@@ -25,10 +25,12 @@ class WvCdmTestBase : public ::testing::Test {
// Default number of provisioning try attempts. // Default number of provisioning try attempts.
constexpr static size_t kDefaultMaxProvisioningAttempts = 10; constexpr static size_t kDefaultMaxProvisioningAttempts = 10;
WvCdmTestBase() : config_(default_config_), binary_provisioning_(false) {} WvCdmTestBase();
~WvCdmTestBase() override {} ~WvCdmTestBase() override {}
void SetUp() override; void SetUp() override;
virtual std::string binary_key_id() const { return a2bs_hex(config_.key_id()); } virtual std::string binary_key_id() const {
return a2bs_hex(config_.key_id());
}
// Returns true if the test program should continue, if false, the caller // Returns true if the test program should continue, if false, the caller
// should exit. This should be called by main() to allow the user to pass in // should exit. This should be called by main() to allow the user to pass in
@@ -77,7 +79,7 @@ class WvCdmTestBase : public ::testing::Test {
bool binary_provisioning_; bool binary_provisioning_;
}; };
class TestCryptoSession : public CryptoSession { class TestCryptoSession : public CryptoSession {
public: public:
explicit TestCryptoSession(metrics::CryptoMetrics* crypto_metrics); explicit TestCryptoSession(metrics::CryptoMetrics* crypto_metrics);
// This intercepts nonce flood errors, which is useful for tests that request // This intercepts nonce flood errors, which is useful for tests that request
@@ -93,7 +95,7 @@ class TestCryptoSession : public CryptoSession {
class TestLicenseHolder { class TestLicenseHolder {
public: public:
// cdm_engine must exist and outlive the TestLicenseHolder. // cdm_engine must exist and outlive the TestLicenseHolder.
TestLicenseHolder(CdmEngine *cdm_engine); TestLicenseHolder(CdmEngine* cdm_engine);
~TestLicenseHolder(); ~TestLicenseHolder();
// Caller must ensure device already provisioned. // Caller must ensure device already provisioned.
void OpenSession(const std::string& key_system); void OpenSession(const std::string& key_system);