Merge "Segfault When Running Jenkins Tests... Sometimes"

This commit is contained in:
John Bruce
2019-01-26 17:31:32 +00:00
committed by Android (Google) Code Review
2 changed files with 36 additions and 13 deletions

View File

@@ -41,6 +41,11 @@ const std::string kTestSignedCertificate = a2bs_hex(
"D2E8D5986104AACC4DD475FD96EE9CE4E326F21B83C7058577B38732CDDABC6A6BED13FB0D"
"49D38A45EB87A5F4");
class PropertiesTestPeer : public Properties {
public:
using Properties::ForceReinit;
};
} // unnamed namespace
class ServiceCertificateTest : public ::testing::Test {
@@ -75,7 +80,9 @@ class StubCdmClientPropertySet : public CdmClientPropertySet {
uint32_t session_sharing_id() const override { return session_sharing_id_; }
void set_session_sharing_id(uint32_t id) override { session_sharing_id_ = id; }
void set_session_sharing_id(uint32_t id) override {
session_sharing_id_ = id;
}
const std::string& app_id() const override { return app_id_; }
@@ -100,8 +107,9 @@ TEST_F(ServiceCertificateTest, InitPrivacyModeRequired) {
property_set.enable_privacy_mode();
Properties::Init();
Properties::AddSessionPropertySet(kTestSessionId1, &property_set);
PropertiesTestPeer::ForceReinit();
ASSERT_TRUE(PropertiesTestPeer::AddSessionPropertySet(kTestSessionId1,
&property_set));
service_certificate_.Init(kTestSessionId1);
EXPECT_FALSE(service_certificate_.has_certificate());
@@ -113,14 +121,14 @@ TEST_F(ServiceCertificateTest, InitServiceCertificatePresent) {
property_set.enable_privacy_mode();
property_set.set_service_certificate(kTestSignedCertificate);
Properties::Init();
Properties::AddSessionPropertySet(kTestSessionId1, &property_set);
PropertiesTestPeer::ForceReinit();
ASSERT_TRUE(PropertiesTestPeer::AddSessionPropertySet(kTestSessionId1,
&property_set));
std::string raw_service_certificate;
EXPECT_TRUE(Properties::GetServiceCertificate(kTestSessionId1,
&raw_service_certificate));
EXPECT_EQ(NO_ERROR,
service_certificate_.Init(raw_service_certificate));
EXPECT_TRUE(PropertiesTestPeer::GetServiceCertificate(
kTestSessionId1, &raw_service_certificate));
EXPECT_EQ(NO_ERROR, service_certificate_.Init(raw_service_certificate));
EXPECT_TRUE(service_certificate_.has_certificate());
}
@@ -129,11 +137,12 @@ TEST_F(ServiceCertificateTest, SetServiceCertificate) {
property_set.enable_privacy_mode();
Properties::Init();
Properties::AddSessionPropertySet(kTestSessionId1, &property_set);
PropertiesTestPeer::ForceReinit();
ASSERT_TRUE(PropertiesTestPeer::AddSessionPropertySet(kTestSessionId1,
&property_set));
EXPECT_EQ(NO_ERROR, service_certificate_.Init(kTestSignedCertificate));
EXPECT_TRUE(service_certificate_.has_certificate());
}
}
} // namespace wvcdm