|
|
|
|
@@ -1,4 +1,6 @@
|
|
|
|
|
// Copyright 2015 Google Inc. All Rights Reserved.
|
|
|
|
|
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
|
|
|
|
// source code may only be used and distributed under the Widevine Master
|
|
|
|
|
// License Agreement.
|
|
|
|
|
//
|
|
|
|
|
// This source file provides a basic set of unit tests for the Content
|
|
|
|
|
// Decryption Module (CDM).
|
|
|
|
|
@@ -943,8 +945,7 @@ TEST_F(CdmTest, LoadTemporary) {
|
|
|
|
|
EXPECT_EQ(Cdm::kSessionNotFound, status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(fredgc,rfrias): turn this on after big usage tables work.
|
|
|
|
|
TEST_F(CdmTest, DISABLED_LoadPersistent) {
|
|
|
|
|
TEST_F(CdmTest, LoadPersistent) {
|
|
|
|
|
std::string session_id;
|
|
|
|
|
std::string response;
|
|
|
|
|
Cdm::Status status;
|
|
|
|
|
@@ -983,8 +984,7 @@ TEST_F(CdmTest, DISABLED_LoadPersistent) {
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(fredgc,rfrias): turn this on after big usage tables work.
|
|
|
|
|
TEST_F(CdmTest, DISABLED_LoadWillFireExpiration) {
|
|
|
|
|
TEST_F(CdmTest, LoadWillFireExpiration) {
|
|
|
|
|
// There was a bug where calling load() would not start the PolicyEngine timer
|
|
|
|
|
// because it was only started in update().
|
|
|
|
|
std::string session_id;
|
|
|
|
|
@@ -1005,7 +1005,7 @@ TEST_F(CdmTest, DISABLED_LoadWillFireExpiration) {
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(fredgc,rfrias): turn this on after big usage tables work.
|
|
|
|
|
// TODO(b/110802394): Fix this test or remove auto-provisioning.
|
|
|
|
|
TEST_F(CdmTest, DISABLED_PerOriginLoadPersistent) {
|
|
|
|
|
std::string session_id;
|
|
|
|
|
std::string response;
|
|
|
|
|
@@ -1038,7 +1038,7 @@ TEST_F(CdmTest, DISABLED_PerOriginLoadPersistent) {
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(fredgc,rfrias): turn this on after big usage tables work.
|
|
|
|
|
// TODO(b/34949512): Fix this test so it can be re-enabled.
|
|
|
|
|
TEST_F(CdmTest, DISABLED_LoadUsageRecord) {
|
|
|
|
|
std::string session_id;
|
|
|
|
|
std::string response;
|
|
|
|
|
@@ -1082,7 +1082,7 @@ TEST_F(CdmTest, DISABLED_LoadUsageRecord) {
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(gmorgan): temporarily disabled - pending cdm_partner_3.2 merges
|
|
|
|
|
// TODO(b/109897011): Temporarily Disabled
|
|
|
|
|
TEST_F(CdmTest, DISABLED_DestroyUsageRecord) {
|
|
|
|
|
std::string session_id;
|
|
|
|
|
std::string response;
|
|
|
|
|
@@ -1117,7 +1117,7 @@ TEST_F(CdmTest, DISABLED_DestroyUsageRecord) {
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(gmorgan): temporarily disabled - pending cdm_partner_3.2 merges
|
|
|
|
|
// TODO(b/109897011): Temporarily Disabled
|
|
|
|
|
TEST_F(CdmTest, DISABLED_DestroyAllUsageRecords) {
|
|
|
|
|
std::string session_id;
|
|
|
|
|
std::string response;
|
|
|
|
|
@@ -1152,7 +1152,7 @@ TEST_F(CdmTest, DISABLED_DestroyAllUsageRecords) {
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(gmorgan): temporarily disabled - pending cdm_partner_3.2 merges
|
|
|
|
|
// TODO(b/109897011): Temporarily Disabled
|
|
|
|
|
TEST_F(CdmTest, DISABLED_ListUsageRecords) {
|
|
|
|
|
std::string session_id;
|
|
|
|
|
std::string response;
|
|
|
|
|
@@ -1267,8 +1267,7 @@ TEST_F(CdmTest, GetExpiration) {
|
|
|
|
|
ASSERT_EQ(Cdm::kSessionNotFound, status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(fredgc,rfrias): turn this on after big usage tables work.
|
|
|
|
|
TEST_F(CdmTest, DISABLED_Remove) {
|
|
|
|
|
TEST_F(CdmTest, Remove) {
|
|
|
|
|
std::string session_id;
|
|
|
|
|
ASSERT_NO_FATAL_FAILURE(CreateSessionAndUpdate(
|
|
|
|
|
Cdm::kPersistentLicense, Cdm::kCenc, &session_id));
|
|
|
|
|
@@ -1322,8 +1321,43 @@ TEST_F(CdmTest, DISABLED_Remove) {
|
|
|
|
|
EXPECT_EQ(Cdm::kRangeError, status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(fredgc,rfrias): turn this on after big usage tables work.
|
|
|
|
|
TEST_F(CdmTest, DISABLED_RemoveUsageRecord) {
|
|
|
|
|
TEST_F(CdmTest, ForceRemove) {
|
|
|
|
|
std::string session_id;
|
|
|
|
|
ASSERT_NO_FATAL_FAILURE(CreateSessionAndUpdate(
|
|
|
|
|
Cdm::kPersistentLicense, Cdm::kCenc, &session_id));
|
|
|
|
|
|
|
|
|
|
// Forcibly remove the session. This should immediately trigger a removal
|
|
|
|
|
// callback and should *not* cause a release message to be generated.
|
|
|
|
|
EXPECT_CALL(*this, onRemoveComplete(session_id)).Times(1);
|
|
|
|
|
EXPECT_CALL(*this, onMessage(session_id, Cdm::kLicenseRelease, _)).Times(0);
|
|
|
|
|
Cdm::Status status = cdm_->forceRemove(session_id);
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
|
|
|
|
|
// The session is now completely gone.
|
|
|
|
|
status = cdm_->close(session_id);
|
|
|
|
|
ASSERT_EQ(Cdm::kSessionNotFound, status);
|
|
|
|
|
status = cdm_->load(session_id);
|
|
|
|
|
ASSERT_EQ(Cdm::kSessionNotFound, status);
|
|
|
|
|
|
|
|
|
|
// Try a bogus session ID.
|
|
|
|
|
status = cdm_->forceRemove(kBogusSessionId);
|
|
|
|
|
EXPECT_EQ(Cdm::kSessionNotFound, status);
|
|
|
|
|
|
|
|
|
|
// Try a new session.
|
|
|
|
|
status = cdm_->createSession(Cdm::kPersistentLicense, &session_id);
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
status = cdm_->forceRemove(session_id);
|
|
|
|
|
EXPECT_EQ(Cdm::kInvalidState, status);
|
|
|
|
|
|
|
|
|
|
// Try a temporary session.
|
|
|
|
|
ASSERT_NO_FATAL_FAILURE(CreateSessionAndUpdate(
|
|
|
|
|
Cdm::kTemporary, Cdm::kCenc, &session_id));
|
|
|
|
|
status = cdm_->forceRemove(session_id);
|
|
|
|
|
EXPECT_EQ(Cdm::kRangeError, status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(CdmTest, RemoveUsageRecord) {
|
|
|
|
|
std::string session_id;
|
|
|
|
|
ASSERT_NO_FATAL_FAILURE(CreateSessionAndUpdate(
|
|
|
|
|
Cdm::kPersistentUsageRecord, Cdm::kCenc, &session_id));
|
|
|
|
|
@@ -1359,8 +1393,7 @@ TEST_F(CdmTest, DISABLED_RemoveUsageRecord) {
|
|
|
|
|
ASSERT_EQ(Cdm::kSessionNotFound, status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(fredgc,rfrias): turn this on after big usage tables work.
|
|
|
|
|
TEST_F(CdmTest, DISABLED_RemoveIncomplete) {
|
|
|
|
|
TEST_F(CdmTest, RemoveIncomplete) {
|
|
|
|
|
std::string session_id;
|
|
|
|
|
ASSERT_NO_FATAL_FAILURE(CreateSessionAndUpdate(
|
|
|
|
|
Cdm::kPersistentLicense, Cdm::kCenc, &session_id));
|
|
|
|
|
@@ -1423,8 +1456,7 @@ TEST_F(CdmTest, DISABLED_RemoveIncomplete) {
|
|
|
|
|
ASSERT_EQ(Cdm::kSessionNotFound, status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(fredgc,rfrias): turn this on after big usage tables work.
|
|
|
|
|
TEST_F(CdmTest, DISABLED_RemoveUsageRecordIncomplete) {
|
|
|
|
|
TEST_F(CdmTest, RemoveUsageRecordIncomplete) {
|
|
|
|
|
std::string session_id;
|
|
|
|
|
ASSERT_NO_FATAL_FAILURE(CreateSessionAndUpdate(
|
|
|
|
|
Cdm::kPersistentUsageRecord, Cdm::kCenc, &session_id));
|
|
|
|
|
@@ -1487,8 +1519,7 @@ TEST_F(CdmTest, DISABLED_RemoveUsageRecordIncomplete) {
|
|
|
|
|
ASSERT_EQ(Cdm::kSessionNotFound, status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(fredgc,rfrias): turn this on after big usage tables work.
|
|
|
|
|
TEST_F(CdmTest, DISABLED_RemoveNotLoaded) {
|
|
|
|
|
TEST_F(CdmTest, RemoveNotLoaded) {
|
|
|
|
|
// Create a persistent session and then close it.
|
|
|
|
|
std::string session_id;
|
|
|
|
|
ASSERT_NO_FATAL_FAILURE(CreateSessionAndUpdate(
|
|
|
|
|
@@ -1523,7 +1554,7 @@ TEST_F(CdmTest, RequestPersistentLicenseWithWrongInitData) {
|
|
|
|
|
FetchLicenseFailure(message, 500);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(fredgc,rfrias): turn this on after big usage tables work.
|
|
|
|
|
// TODO(b/34949512): Fix this test so it can be re-enabled.
|
|
|
|
|
TEST_F(CdmTest, DISABLED_RequestTemporaryLicenseWithWrongInitData) {
|
|
|
|
|
// Generate a request for a temporary license using persistent init data.
|
|
|
|
|
std::string session_id;
|
|
|
|
|
@@ -1790,6 +1821,14 @@ TEST_F(CdmTest, HandlesKeyRotationWithOnlyOneLicenseRequest) {
|
|
|
|
|
input.iv_length = kIvEntitlement2.size();
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess, cdm_->decrypt(input, output));
|
|
|
|
|
EXPECT_EQ(kOutputEntitlement2, output_buffer);
|
|
|
|
|
|
|
|
|
|
// Attempt decrypt with a key from the first license again.
|
|
|
|
|
input.key_id = kKeyIdEntitlement1.data();
|
|
|
|
|
input.key_id_length = kKeyIdEntitlement1.size();
|
|
|
|
|
input.iv = kIvEntitlement1.data();
|
|
|
|
|
input.iv_length = kIvEntitlement1.size();
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess, cdm_->decrypt(input, output));
|
|
|
|
|
EXPECT_EQ(kOutputEntitlement1, output_buffer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(http://b/37286053): Fix this test.
|
|
|
|
|
@@ -1892,32 +1931,22 @@ TEST_F(CdmIndividualizationTest, BasicFlow) {
|
|
|
|
|
// Clear any existing certificates.
|
|
|
|
|
g_host->remove("cert.bin");
|
|
|
|
|
|
|
|
|
|
// Creating a session should succeed.
|
|
|
|
|
std::string session_id;
|
|
|
|
|
Cdm::Status status;
|
|
|
|
|
status = cdm_->setServiceCertificate(g_license_service_certificate);
|
|
|
|
|
// Provision the device
|
|
|
|
|
Cdm::Status status =
|
|
|
|
|
cdm_->setServiceCertificate(g_provisioning_service_certificate);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
status = cdm_->createSession(Cdm::kTemporary, &session_id);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
|
|
|
|
|
// Should get an individualization request when we generate request.
|
|
|
|
|
std::string message;
|
|
|
|
|
EXPECT_CALL(*this, onDirectIndividualizationRequest(session_id, _))
|
|
|
|
|
.WillOnce(SaveArg<1>(&message));
|
|
|
|
|
status = generateRequestWithRetry(session_id, Cdm::kCenc, kCencInitData);
|
|
|
|
|
status = cdm_->getProvisioningRequest(&message);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
|
|
|
|
|
// Complete the provisioning request.
|
|
|
|
|
std::string reply = GetProvisioningResponse(message);
|
|
|
|
|
ASSERT_FALSE(reply.empty());
|
|
|
|
|
EXPECT_CALL(*this, onMessage(session_id, Cdm::kLicenseRequest, _)).Times(1);
|
|
|
|
|
EXPECT_CALL(*this, onDeferredComplete(_, _)).Times(0);
|
|
|
|
|
status = updateWithRetry(session_id, reply);
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
status = cdm_->handleProvisioningResponse(reply);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
|
|
|
|
|
// We should now be able to create a session and generate a request.
|
|
|
|
|
std::string session_id;
|
|
|
|
|
status = cdm_->setServiceCertificate(g_license_service_certificate);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
ASSERT_NO_FATAL_FAILURE(CreateSessionAndGenerateRequest(
|
|
|
|
|
Cdm::kTemporary, Cdm::kCenc, &session_id, &message));
|
|
|
|
|
|
|
|
|
|
@@ -1938,27 +1967,17 @@ TEST_F(CdmIndividualizationTest, IsProvisioned) {
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(cdm_->isProvisioned());
|
|
|
|
|
|
|
|
|
|
// Creating a session should succeed.
|
|
|
|
|
std::string session_id;
|
|
|
|
|
Cdm::Status status = cdm_->createSession(Cdm::kTemporary, &session_id);
|
|
|
|
|
// Provision the device
|
|
|
|
|
Cdm::Status status =
|
|
|
|
|
cdm_->setServiceCertificate(g_provisioning_service_certificate);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
|
|
|
|
|
// Should get an individualization request when we generate request.
|
|
|
|
|
std::string message;
|
|
|
|
|
EXPECT_CALL(*this, onDirectIndividualizationRequest(session_id, _))
|
|
|
|
|
.WillOnce(SaveArg<1>(&message));
|
|
|
|
|
status = generateRequestWithRetry(session_id, Cdm::kCenc, kCencInitData);
|
|
|
|
|
status = cdm_->getProvisioningRequest(&message);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
|
|
|
|
|
// Complete the provisioning request.
|
|
|
|
|
std::string reply = GetProvisioningResponse(message);
|
|
|
|
|
ASSERT_FALSE(reply.empty());
|
|
|
|
|
EXPECT_CALL(*this, onMessage(session_id, Cdm::kLicenseRequest, _)).Times(1);
|
|
|
|
|
EXPECT_CALL(*this, onDeferredComplete(_, _)).Times(0);
|
|
|
|
|
status = updateWithRetry(session_id, reply);
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
status = cdm_->handleProvisioningResponse(reply);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(cdm_->isProvisioned());
|
|
|
|
|
}
|
|
|
|
|
@@ -1972,27 +1991,17 @@ TEST_F(CdmIndividualizationTest, RemoveProvisioning) {
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(cdm_->isProvisioned());
|
|
|
|
|
|
|
|
|
|
// Creating a session should succeed.
|
|
|
|
|
std::string session_id;
|
|
|
|
|
Cdm::Status status = cdm_->createSession(Cdm::kTemporary, &session_id);
|
|
|
|
|
// Provision the device
|
|
|
|
|
Cdm::Status status =
|
|
|
|
|
cdm_->setServiceCertificate(g_provisioning_service_certificate);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
|
|
|
|
|
// Should get an individualization request when we generate request.
|
|
|
|
|
std::string message;
|
|
|
|
|
EXPECT_CALL(*this, onDirectIndividualizationRequest(session_id, _))
|
|
|
|
|
.WillOnce(SaveArg<1>(&message));
|
|
|
|
|
status = generateRequestWithRetry(session_id, Cdm::kCenc, kCencInitData);
|
|
|
|
|
status = cdm_->getProvisioningRequest(&message);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
|
|
|
|
|
// Complete the provisioning request.
|
|
|
|
|
std::string reply = GetProvisioningResponse(message);
|
|
|
|
|
ASSERT_FALSE(reply.empty());
|
|
|
|
|
EXPECT_CALL(*this, onMessage(session_id, Cdm::kLicenseRequest, _)).Times(1);
|
|
|
|
|
EXPECT_CALL(*this, onDeferredComplete(_, _)).Times(0);
|
|
|
|
|
status = updateWithRetry(session_id, reply);
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
status = cdm_->handleProvisioningResponse(reply);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(cdm_->isProvisioned());
|
|
|
|
|
|
|
|
|
|
@@ -2001,6 +2010,49 @@ TEST_F(CdmIndividualizationTest, RemoveProvisioning) {
|
|
|
|
|
EXPECT_FALSE(cdm_->isProvisioned());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(CdmIndividualizationTest, HandlesAutomaticProvisioning) {
|
|
|
|
|
if (!CheckProvisioningSupport()) return;
|
|
|
|
|
|
|
|
|
|
// Clear any existing certificates.
|
|
|
|
|
g_host->remove("cert.bin");
|
|
|
|
|
|
|
|
|
|
// Creating a session should succeed.
|
|
|
|
|
std::string session_id;
|
|
|
|
|
Cdm::Status status =
|
|
|
|
|
cdm_->setServiceCertificate(g_provisioning_service_certificate);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess, cdm_->createSession(Cdm::kTemporary, &session_id));
|
|
|
|
|
|
|
|
|
|
// Should get an individualization request when we generate request.
|
|
|
|
|
std::string message;
|
|
|
|
|
EXPECT_CALL(*this, onDirectIndividualizationRequest(session_id, _))
|
|
|
|
|
.WillOnce(SaveArg<1>(&message));
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess,
|
|
|
|
|
generateRequestWithRetry(session_id, Cdm::kCenc, kCencInitData));
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
|
|
|
|
|
// Complete the provisioning request.
|
|
|
|
|
std::string reply = GetProvisioningResponse(message);
|
|
|
|
|
ASSERT_FALSE(reply.empty());
|
|
|
|
|
EXPECT_CALL(*this, onMessage(session_id, Cdm::kLicenseRequest, _)).Times(1);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, updateWithRetry(session_id, reply));
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
|
|
|
|
|
// We should now be able to create a session and generate a request.
|
|
|
|
|
status = cdm_->setServiceCertificate(g_license_service_certificate);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
ASSERT_NO_FATAL_FAILURE(CreateSessionAndGenerateRequest(
|
|
|
|
|
Cdm::kTemporary, Cdm::kCenc, &session_id, &message));
|
|
|
|
|
|
|
|
|
|
// Acquire a license and update the session.
|
|
|
|
|
ASSERT_NO_FATAL_FAILURE(FetchLicense(
|
|
|
|
|
g_license_server, message, &reply));
|
|
|
|
|
EXPECT_CALL(*this, onKeyStatusesChange(session_id, true));
|
|
|
|
|
status = updateWithRetry(session_id, reply);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(CdmIndividualizationTest, WillNotSendRequestTwice) {
|
|
|
|
|
if (!CheckProvisioningSupport()) return;
|
|
|
|
|
|
|
|
|
|
@@ -2008,6 +2060,9 @@ TEST_F(CdmIndividualizationTest, WillNotSendRequestTwice) {
|
|
|
|
|
g_host->remove("cert.bin");
|
|
|
|
|
|
|
|
|
|
// Creating a session should succeed.
|
|
|
|
|
Cdm::Status status =
|
|
|
|
|
cdm_->setServiceCertificate(g_provisioning_service_certificate);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
std::string session_id;
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess, cdm_->createSession(Cdm::kTemporary, &session_id));
|
|
|
|
|
|
|
|
|
|
@@ -2048,6 +2103,9 @@ TEST_F(CdmIndividualizationTest,
|
|
|
|
|
g_host->remove("cert.bin");
|
|
|
|
|
|
|
|
|
|
// Creating a session should succeed.
|
|
|
|
|
Cdm::Status status =
|
|
|
|
|
cdm_->setServiceCertificate(g_provisioning_service_certificate);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
std::string session_id;
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess, cdm_->createSession(Cdm::kTemporary, &session_id));
|
|
|
|
|
|
|
|
|
|
@@ -2074,6 +2132,8 @@ TEST_F(CdmIndividualizationTest,
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
|
|
|
|
|
// We should get a license message for the second session.
|
|
|
|
|
status = cdm_->setServiceCertificate(g_license_service_certificate);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
EXPECT_CALL(*this, onMessage(session_id2, Cdm::kLicenseRequest, _)).Times(1);
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess,
|
|
|
|
|
generateRequestWithRetry(session_id2, Cdm::kCenc, kCencInitData));
|
|
|
|
|
@@ -2087,6 +2147,9 @@ TEST_F(CdmIndividualizationTest, PropagatesErrorsInUpdate) {
|
|
|
|
|
g_host->remove("cert.bin");
|
|
|
|
|
|
|
|
|
|
// Creating a session should succeed.
|
|
|
|
|
Cdm::Status status =
|
|
|
|
|
cdm_->setServiceCertificate(g_provisioning_service_certificate);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
std::string session_id;
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess, cdm_->createSession(Cdm::kTemporary, &session_id));
|
|
|
|
|
|
|
|
|
|
@@ -2114,6 +2177,9 @@ TEST_F(CdmIndividualizationTest, OnlyPropagatesErrorsForThisSession) {
|
|
|
|
|
g_host->remove("cert.bin");
|
|
|
|
|
|
|
|
|
|
// Creating a session should succeed.
|
|
|
|
|
Cdm::Status status =
|
|
|
|
|
cdm_->setServiceCertificate(g_provisioning_service_certificate);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
std::string session_id;
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess, cdm_->createSession(Cdm::kTemporary, &session_id));
|
|
|
|
|
|
|
|
|
|
@@ -2143,7 +2209,7 @@ TEST_F(CdmIndividualizationTest, OnlyPropagatesErrorsForThisSession) {
|
|
|
|
|
Mock::VerifyAndClear(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(fredgc,rfrias): turn this on after big usage tables work.
|
|
|
|
|
// TODO(b/34949512): Fix this test so it can be re-enabled.
|
|
|
|
|
TEST_F(CdmIndividualizationTest, DISABLED_WorksWithLoad) {
|
|
|
|
|
if (!CheckProvisioningSupport()) return;
|
|
|
|
|
|
|
|
|
|
@@ -2189,6 +2255,9 @@ TEST_F(CdmIndividualizationTest, WillResendOnProvisioningError) {
|
|
|
|
|
g_host->remove("cert.bin");
|
|
|
|
|
|
|
|
|
|
// Creating a session should succeed.
|
|
|
|
|
Cdm::Status status =
|
|
|
|
|
cdm_->setServiceCertificate(g_provisioning_service_certificate);
|
|
|
|
|
EXPECT_EQ(Cdm::kSuccess, status);
|
|
|
|
|
std::string session_id;
|
|
|
|
|
ASSERT_EQ(Cdm::kSuccess, cdm_->createSession(Cdm::kTemporary, &session_id));
|
|
|
|
|
|
|
|
|
|
|