Source release 15.1.0
This commit is contained in:
@@ -620,11 +620,7 @@ TEST_F(CdmTest, Initialize) {
|
||||
status =
|
||||
Cdm::initialize(Cdm::kOpaqueHandle, working_client_info, g_host, g_host,
|
||||
g_host, static_cast<Cdm::LogLevel>(g_cutoff));
|
||||
if (wvoec::global_features.supports_level_1) {
|
||||
EXPECT_EQ(Cdm::kSuccess, status);
|
||||
} else {
|
||||
EXPECT_EQ(Cdm::kNotSupported, status);
|
||||
}
|
||||
EXPECT_EQ(Cdm::kSuccess, status);
|
||||
|
||||
// One last init with everything correct and working.
|
||||
status =
|
||||
@@ -751,6 +747,27 @@ TEST_F(CdmTest, SetServiceCertificate) {
|
||||
EXPECT_EQ(Cdm::kTypeError, status);
|
||||
}
|
||||
|
||||
TEST_F(CdmTest, GetRobustnessLevel) {
|
||||
Cdm::RobustnessLevel level;
|
||||
Cdm::Status status = cdm_->getRobustnessLevel(&level);
|
||||
ASSERT_EQ(Cdm::kSuccess, status);
|
||||
LOGI("Got robustness level %d", level);
|
||||
}
|
||||
|
||||
TEST_F(CdmTest, GetResourceRatingTier) {
|
||||
uint32_t tier;
|
||||
Cdm::Status status = cdm_->getResourceRatingTier(&tier);
|
||||
ASSERT_EQ(Cdm::kSuccess, status);
|
||||
LOGI("Got resource rating tier %lu", tier);
|
||||
}
|
||||
|
||||
TEST_F(CdmTest, GetOemCryptoBuildInfo) {
|
||||
std::string build_info;
|
||||
Cdm::Status status = cdm_->getOemCryptoBuildInfo(&build_info);
|
||||
ASSERT_EQ(Cdm::kSuccess, status);
|
||||
LOGI("Got OEMCrypto build info: %s", build_info.c_str());
|
||||
}
|
||||
|
||||
TEST_F(CdmTest, CreateSession) {
|
||||
EnsureProvisioned();
|
||||
|
||||
@@ -1096,8 +1113,8 @@ TEST_F(CdmTest, PerOriginLoadPersistent) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(b/34949512): Fix this test so it can be re-enabled.
|
||||
TEST_F(CdmTest, DISABLED_LoadUsageRecord) {
|
||||
TEST_F(CdmTest, LoadUsageRecord) {
|
||||
EnsureProvisioned();
|
||||
std::string session_id;
|
||||
std::string response;
|
||||
|
||||
@@ -1133,6 +1150,7 @@ TEST_F(CdmTest, DISABLED_LoadUsageRecord) {
|
||||
status = cdm_->close(session_id);
|
||||
ASSERT_EQ(Cdm::kSuccess, status);
|
||||
g_host->Reset();
|
||||
EnsureProvisioned();
|
||||
EXPECT_CALL(*this, onKeyStatusesChange(session_id, _)).Times(0);
|
||||
EXPECT_CALL(*this, onMessage(session_id, Cdm::kLicenseRelease, _)).Times(0);
|
||||
status = cdm_->load(session_id);
|
||||
@@ -1140,8 +1158,8 @@ TEST_F(CdmTest, DISABLED_LoadUsageRecord) {
|
||||
Mock::VerifyAndClear(this);
|
||||
}
|
||||
|
||||
// TODO(b/109897011): Temporarily Disabled
|
||||
TEST_F(CdmTest, DISABLED_DestroyUsageRecord) {
|
||||
TEST_F(CdmTest, DestroyUsageRecord) {
|
||||
EnsureProvisioned();
|
||||
std::string session_id;
|
||||
std::string response;
|
||||
ASSERT_NO_FATAL_FAILURE(CreateSessionAndFetchLicense(
|
||||
@@ -1175,8 +1193,8 @@ TEST_F(CdmTest, DISABLED_DestroyUsageRecord) {
|
||||
Mock::VerifyAndClear(this);
|
||||
}
|
||||
|
||||
// TODO(b/109897011): Temporarily Disabled
|
||||
TEST_F(CdmTest, DISABLED_DestroyAllUsageRecords) {
|
||||
TEST_F(CdmTest, DestroyAllUsageRecords) {
|
||||
EnsureProvisioned();
|
||||
std::string session_id;
|
||||
std::string response;
|
||||
ASSERT_NO_FATAL_FAILURE(CreateSessionAndFetchLicense(
|
||||
@@ -1210,8 +1228,8 @@ TEST_F(CdmTest, DISABLED_DestroyAllUsageRecords) {
|
||||
Mock::VerifyAndClear(this);
|
||||
}
|
||||
|
||||
// TODO(b/109897011): Temporarily Disabled
|
||||
TEST_F(CdmTest, DISABLED_ListUsageRecords) {
|
||||
TEST_F(CdmTest, ListUsageRecords) {
|
||||
EnsureProvisioned();
|
||||
std::string session_id;
|
||||
std::string response;
|
||||
ASSERT_NO_FATAL_FAILURE(CreateSessionAndFetchLicense(
|
||||
@@ -1474,6 +1492,125 @@ TEST_F(CdmTest, RemoveUsageRecord) {
|
||||
ASSERT_EQ(Cdm::kSessionNotFound, status);
|
||||
}
|
||||
|
||||
TEST_F(CdmTest, RemoveThreeUsageRecords) {
|
||||
EnsureProvisioned();
|
||||
std::string session_id1, session_id2, session_id3;
|
||||
ASSERT_NO_FATAL_FAILURE(CreateSessionAndUpdate(Cdm::kPersistentUsageRecord,
|
||||
Cdm::kCenc, &session_id1));
|
||||
ASSERT_NO_FATAL_FAILURE(CreateSessionAndUpdate(Cdm::kPersistentUsageRecord,
|
||||
Cdm::kCenc, &session_id2));
|
||||
ASSERT_NO_FATAL_FAILURE(CreateSessionAndUpdate(Cdm::kPersistentUsageRecord,
|
||||
Cdm::kCenc, &session_id3));
|
||||
|
||||
// Close, reload and remove the middle session first
|
||||
EXPECT_EQ(Cdm::kSuccess, cdm_->close(session_id2));
|
||||
|
||||
EXPECT_CALL(*this, onKeyStatusesChange(session_id2, _)).Times(0);
|
||||
EXPECT_CALL(*this, onMessage(session_id2, Cdm::kLicenseRelease, _)).Times(0);
|
||||
Cdm::Status status = cdm_->load(session_id2);
|
||||
EXPECT_EQ(Cdm::kSuccess, status);
|
||||
Mock::VerifyAndClear(this);
|
||||
|
||||
// Remove the session. This causes a release message to be generated.
|
||||
std::string message;
|
||||
EXPECT_CALL(*this, onMessage(session_id2, Cdm::kLicenseRelease, _))
|
||||
.WillOnce(SaveArg<2>(&message));
|
||||
status = cdm_->remove(session_id2);
|
||||
ASSERT_EQ(Cdm::kSuccess, status);
|
||||
Mock::VerifyAndClear(this);
|
||||
|
||||
// The keys should already be unusable.
|
||||
Cdm::KeyStatusMap map;
|
||||
status = cdm_->getKeyStatuses(session_id2, &map);
|
||||
ASSERT_EQ(Cdm::kSuccess, status);
|
||||
EXPECT_TRUE(map.empty());
|
||||
|
||||
// Post the release message to the license server.
|
||||
std::string response;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
FetchLicense(config_.license_server(), message, &response));
|
||||
|
||||
// Update the session.
|
||||
EXPECT_CALL(*this, onRemoveComplete(session_id2));
|
||||
status = updateWithRetry(session_id2, response);
|
||||
ASSERT_EQ(Cdm::kSuccess, status);
|
||||
Mock::VerifyAndClear(this);
|
||||
|
||||
// The session is now completely gone.
|
||||
status = cdm_->close(session_id2);
|
||||
ASSERT_EQ(Cdm::kSessionNotFound, status);
|
||||
|
||||
// Close, reload and remove the last session next
|
||||
EXPECT_EQ(Cdm::kSuccess, cdm_->close(session_id3));
|
||||
|
||||
EXPECT_CALL(*this, onKeyStatusesChange(session_id3, _)).Times(0);
|
||||
EXPECT_CALL(*this, onMessage(session_id3, Cdm::kLicenseRelease, _)).Times(0);
|
||||
status = cdm_->load(session_id3);
|
||||
EXPECT_EQ(Cdm::kSuccess, status);
|
||||
Mock::VerifyAndClear(this);
|
||||
|
||||
// Remove the session. This causes a release message to be generated.
|
||||
EXPECT_CALL(*this, onMessage(session_id3, Cdm::kLicenseRelease, _))
|
||||
.WillOnce(SaveArg<2>(&message));
|
||||
status = cdm_->remove(session_id3);
|
||||
ASSERT_EQ(Cdm::kSuccess, status);
|
||||
Mock::VerifyAndClear(this);
|
||||
|
||||
// The keys should already be unusable.
|
||||
status = cdm_->getKeyStatuses(session_id3, &map);
|
||||
ASSERT_EQ(Cdm::kSuccess, status);
|
||||
EXPECT_TRUE(map.empty());
|
||||
|
||||
// Post the release message to the license server.
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
FetchLicense(config_.license_server(), message, &response));
|
||||
|
||||
// Update the session.
|
||||
EXPECT_CALL(*this, onRemoveComplete(session_id3));
|
||||
status = updateWithRetry(session_id3, response);
|
||||
ASSERT_EQ(Cdm::kSuccess, status);
|
||||
Mock::VerifyAndClear(this);
|
||||
|
||||
// The session is now completely gone.
|
||||
status = cdm_->close(session_id3);
|
||||
ASSERT_EQ(Cdm::kSessionNotFound, status);
|
||||
|
||||
// Close, reload and remove the first session next
|
||||
EXPECT_EQ(Cdm::kSuccess, cdm_->close(session_id1));
|
||||
|
||||
EXPECT_CALL(*this, onKeyStatusesChange(session_id1, _)).Times(0);
|
||||
EXPECT_CALL(*this, onMessage(session_id1, Cdm::kLicenseRelease, _)).Times(0);
|
||||
status = cdm_->load(session_id1);
|
||||
EXPECT_EQ(Cdm::kSuccess, status);
|
||||
Mock::VerifyAndClear(this);
|
||||
|
||||
// Remove the session. This causes a release message to be generated.
|
||||
EXPECT_CALL(*this, onMessage(session_id1, Cdm::kLicenseRelease, _))
|
||||
.WillOnce(SaveArg<2>(&message));
|
||||
status = cdm_->remove(session_id1);
|
||||
ASSERT_EQ(Cdm::kSuccess, status);
|
||||
Mock::VerifyAndClear(this);
|
||||
|
||||
// The keys should already be unusable.
|
||||
status = cdm_->getKeyStatuses(session_id1, &map);
|
||||
ASSERT_EQ(Cdm::kSuccess, status);
|
||||
EXPECT_TRUE(map.empty());
|
||||
|
||||
// Post the release message to the license server.
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
FetchLicense(config_.license_server(), message, &response));
|
||||
|
||||
// Update the session.
|
||||
EXPECT_CALL(*this, onRemoveComplete(session_id1));
|
||||
status = updateWithRetry(session_id1, response);
|
||||
ASSERT_EQ(Cdm::kSuccess, status);
|
||||
Mock::VerifyAndClear(this);
|
||||
|
||||
// The session is now completely gone.
|
||||
status = cdm_->close(session_id1);
|
||||
ASSERT_EQ(Cdm::kSessionNotFound, status);
|
||||
}
|
||||
|
||||
TEST_F(CdmTest, RemoveIncomplete) {
|
||||
EnsureProvisioned();
|
||||
std::string session_id;
|
||||
|
||||
Reference in New Issue
Block a user