Source release 19.4.0
This commit is contained in:
@@ -131,6 +131,7 @@ namespace wvcdm {
|
||||
using ::testing::_;
|
||||
using ::testing::ByMove;
|
||||
using ::testing::DoAll;
|
||||
using ::testing::HasSubstr;
|
||||
using ::testing::NiceMock;
|
||||
using ::testing::NotNull;
|
||||
using ::testing::Return;
|
||||
@@ -468,7 +469,7 @@ TEST_P(CertificateProvisioningTest, ProvisioningResponseSuccess) {
|
||||
.WillOnce(DoAll(SaveArg<0>(&stored_certificate), ReturnArg<1>()));
|
||||
|
||||
MockFileSystem file_system;
|
||||
EXPECT_CALL(file_system, Open(StrEq(wvutil::kLegacyCertificateFileName), _))
|
||||
EXPECT_CALL(file_system, Open(HasSubstr(wvutil::kLegacyCertificateFileName), _))
|
||||
.Times(1)
|
||||
.WillOnce(Return(ByMove(std::unique_ptr<File>(file))));
|
||||
|
||||
|
||||
@@ -145,8 +145,11 @@ TEST_F(CoreIntegrationTest, ProvisioningStableSpoidTest) {
|
||||
cdm_engine_.QueryStatus(kLevelDefault, QUERY_KEY_SECURITY_LEVEL, &level)
|
||||
.code());
|
||||
|
||||
ASSERT_TRUE(level == QUERY_VALUE_SECURITY_LEVEL_L1 ||
|
||||
level == QUERY_VALUE_SECURITY_LEVEL_L3)
|
||||
if (level == QUERY_VALUE_SECURITY_LEVEL_L3) {
|
||||
GTEST_SKIP(); // SPOID is not expected to be stable for L3
|
||||
}
|
||||
|
||||
ASSERT_TRUE(level == QUERY_VALUE_SECURITY_LEVEL_L1)
|
||||
<< "Unknown security level: " << level;
|
||||
|
||||
CdmSecurityLevel security_level = level == QUERY_VALUE_SECURITY_LEVEL_L1
|
||||
|
||||
@@ -1046,9 +1046,12 @@ class CdmUseCase_LicenseWithRenewal : public RenewalTest {
|
||||
initial_policy_.renewal_recovery_duration;
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
void SetUp() override final {
|
||||
RenewalTest::SetUp();
|
||||
if(Test::IsSkipped()) return;
|
||||
if (Test::IsSkipped()) return;
|
||||
if (!wvoec::global_features.usage_table) {
|
||||
GTEST_SKIP() << "Usage tables are not supported.";
|
||||
}
|
||||
const uint64_t next_renewal =
|
||||
start_of_playback_ + initial_policy_.renewal_delay;
|
||||
// Allow playback within the initial renewal window.
|
||||
@@ -1252,9 +1255,12 @@ class CdmUseCase_LicenseWithRenewalPlayback : public RenewalTest {
|
||||
initial_policy_.renewal_recovery_duration;
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
void SetUp() override final {
|
||||
RenewalTest::SetUp();
|
||||
if(Test::IsSkipped()) return;
|
||||
if (Test::IsSkipped()) return;
|
||||
if (!wvoec::global_features.usage_table) {
|
||||
GTEST_SKIP() << "Usage tables are not supported.";
|
||||
}
|
||||
uint64_t next_renewal = start_of_playback_ + initial_policy_.renewal_delay;
|
||||
// Allow playback within the initial renewal window.
|
||||
SleepUntil(start_of_playback_);
|
||||
@@ -1466,6 +1472,14 @@ class CdmUseCase_LimitedDurationLicense : public RenewalTest {
|
||||
renewal_load_time_ =
|
||||
start_of_playback_ + renewal_delay_ + renewal_recovery_ - 1;
|
||||
}
|
||||
|
||||
void SetUp() override final {
|
||||
RenewalTest::SetUp();
|
||||
if (!wvoec::global_features.usage_table) {
|
||||
GTEST_SKIP() << "Usage tables are not supported.";
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t renewal_delay_;
|
||||
uint64_t renewal_load_time_;
|
||||
uint64_t renewal_recovery_;
|
||||
@@ -1718,9 +1732,12 @@ class CdmUseCase_Heartbeat : public RenewalTest {
|
||||
initial_policy_.renewal_recovery_duration;
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
void SetUp() override final {
|
||||
RenewalTest::SetUp();
|
||||
if(Test::IsSkipped()) return;
|
||||
if (Test::IsSkipped()) return;
|
||||
if (!wvoec::global_features.usage_table) {
|
||||
GTEST_SKIP() << "Usage tables are not supported.";
|
||||
}
|
||||
const uint64_t next_renewal =
|
||||
start_of_playback_ + initial_policy_.renewal_delay;
|
||||
// Allow playback within the initial renewal window.
|
||||
@@ -1818,6 +1835,13 @@ class CdmUseCase_LicenseDuration : public CdmDurationTest {
|
||||
timer_limits_.soft_enforce_playback_duration = false;
|
||||
timer_limits_.total_playback_duration_seconds = 40u;
|
||||
}
|
||||
|
||||
void SetUp() override final {
|
||||
CdmDurationTest::SetUp();
|
||||
if (!wvoec::global_features.usage_table) {
|
||||
GTEST_SKIP() << "Usage tables are not supported.";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Playback within rental duration.
|
||||
@@ -1876,6 +1900,13 @@ class CdmUseCase_InfiniteRenewal : public RenewalTest {
|
||||
timer_limits_.rental_duration_seconds = 50u;
|
||||
timer_limits_.total_playback_duration_seconds = 0;
|
||||
}
|
||||
|
||||
void SetUp() override final {
|
||||
RenewalTest::SetUp();
|
||||
if (!wvoec::global_features.usage_table) {
|
||||
GTEST_SKIP() << "Usage tables are not supported.";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// The renewal interval is infinite. We never need to load the renewal.
|
||||
@@ -1918,6 +1949,13 @@ class CdmUseCase_LicenseDurationWithRenewal : public RenewalTest {
|
||||
timer_limits_.rental_duration_seconds = 30u;
|
||||
timer_limits_.total_playback_duration_seconds = 0;
|
||||
}
|
||||
|
||||
void SetUp() override final {
|
||||
RenewalTest::SetUp();
|
||||
if (!wvoec::global_features.usage_table) {
|
||||
GTEST_SKIP() << "Usage tables are not supported.";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// If we do load the renewal, we may continue playback past original window.
|
||||
|
||||
@@ -869,4 +869,27 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
HlsAttributeVariant(kHlsAttributeListInvalidIv, HLS_IV_ATTRIBUTE,
|
||||
kHlsTestHexValueWithOddBytes, false)));
|
||||
|
||||
TEST_F(HlsParseTest, BadHlsData_InvalidContentId) {
|
||||
std::ostringstream hls_uri_json_stream;
|
||||
hls_uri_json_stream << "{";
|
||||
hls_uri_json_stream << "\"provider\": \"HlsParseTest.BadHlsData\", ";
|
||||
// Intentionally bad Base64 content ID.
|
||||
hls_uri_json_stream << "\"content_id\": \"$$$$\", ";
|
||||
hls_uri_json_stream << "\"key_ids\": [\"00000000000000000000000000000000\"]";
|
||||
hls_uri_json_stream << "}";
|
||||
const std::string hls_uri_json = hls_uri_json_stream.str();
|
||||
|
||||
std::ostringstream hls_stream;
|
||||
hls_stream << "#EXT-X-KEY:";
|
||||
hls_stream << "METHOD=AES-128,";
|
||||
hls_stream << "URI=\"data:text/plain;base64,"
|
||||
<< wvutil::Base64Encode(hls_uri_json) << "\",";
|
||||
hls_stream << "IV=0x00000000000000000000000000000000,";
|
||||
hls_stream << "KEYFORMAT=\"com.widevine\",";
|
||||
hls_stream << "KEYFORMATVERSIONS=\"1\"";
|
||||
const std::string hls_data = hls_stream.str();
|
||||
// std::cout << "HLS Data:" << std::endl << hls_data << std::endl;
|
||||
InitializationData init_data(HLS_INIT_DATA_FORMAT, hls_data);
|
||||
EXPECT_TRUE(init_data.is_hls());
|
||||
}
|
||||
} // namespace wvcdm
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "license_request.h"
|
||||
#include "message_dumper.h"
|
||||
#include "oec_device_features.h"
|
||||
#include "properties.h"
|
||||
#include "test_base.h"
|
||||
|
||||
namespace wvcdm {
|
||||
@@ -126,10 +127,27 @@ void LicenseHolder::GenerateAndPostReleaseRequest(
|
||||
const std::string init_data_string = MakePSSH(pssh);
|
||||
const InitializationData init_data(kCencMimeType, init_data_string);
|
||||
init_data.DumpToLogs();
|
||||
const CdmResponseType result = cdm_engine_->GenerateKeyRequest(
|
||||
session_id_, key_set_id_, init_data, kLicenseTypeRelease,
|
||||
empty_app_parameters, &request);
|
||||
|
||||
CdmSessionId session_id;
|
||||
CdmKeySetId key_set_id;
|
||||
CdmResponseType result;
|
||||
// For Android when key set IDs are used, the key set ID passed in should have
|
||||
// a value and the session ID should be empty.
|
||||
if (!Properties::AlwaysUseKeySetIds()) {
|
||||
key_set_id = key_set_id_;
|
||||
result = cdm_engine_->OpenKeySetSession(key_set_id_, nullptr, nullptr);
|
||||
ASSERT_EQ(NO_ERROR, result) << "Failed for " << content_id();
|
||||
// For CE CDM, we only need the session ID to be valid.
|
||||
} else {
|
||||
session_id = session_id_;
|
||||
}
|
||||
result = cdm_engine_->GenerateKeyRequest(session_id, key_set_id, init_data,
|
||||
kLicenseTypeRelease,
|
||||
empty_app_parameters, &request);
|
||||
ASSERT_EQ(KEY_MESSAGE, result) << "Failed for " << content_id();
|
||||
if (!Properties::AlwaysUseKeySetIds()) {
|
||||
cdm_engine_->CloseKeySetSession(key_set_id_);
|
||||
}
|
||||
if (config_.dump_golden_data()) {
|
||||
// TODO (b/295956275) vickymin: write DumpReleaseRequest function
|
||||
// MessageDumper::DumpReleaseRequest(request);
|
||||
|
||||
@@ -201,12 +201,15 @@ class CdmLicenseTestPeer : public CdmLicense {
|
||||
CdmLicenseTestPeer(const CdmSessionId& session_id, wvutil::Clock* clock)
|
||||
: CdmLicense(session_id, clock) {}
|
||||
|
||||
using CdmLicense::HandleNewEntitledKeys;
|
||||
CdmResponseType HandleNewEntitledKeys(
|
||||
const std::vector<PsshEntitledKey>& packaged_entitled_keys) {
|
||||
return HandleNewEntitledKeysForTest(packaged_entitled_keys);
|
||||
}
|
||||
|
||||
void set_entitlement_keys(const License& license) {
|
||||
void SetEntitlementKeys(const License& license) {
|
||||
for (const auto& key_container : license.key()) {
|
||||
if (key_container.type() != KeyContainer::ENTITLEMENT) continue;
|
||||
entitlement_key_ids_.insert(key_container.id());
|
||||
InsertEntitlementKeyIdForTest(key_container.id());
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -608,10 +611,11 @@ TEST_P(CdmLicenseEntitledKeyTest, LoadsEntitledKeys) {
|
||||
// Set up the CdmLicense with the mocks and fake entitlement key
|
||||
ASSERT_TRUE(cdm_license_->Init(true, kDefaultServiceCertificate,
|
||||
crypto_session_.get(), policy_engine_.get()));
|
||||
cdm_license_->set_entitlement_keys(entitlement_license);
|
||||
cdm_license_->SetEntitlementKeys(entitlement_license);
|
||||
|
||||
// Call the function under test and check its return value
|
||||
CdmResponseType ret = cdm_license_->HandleNewEntitledKeys(entitled_keys);
|
||||
const CdmResponseType ret =
|
||||
cdm_license_->HandleNewEntitledKeys(entitled_keys);
|
||||
|
||||
if (variant.should_succeed) {
|
||||
EXPECT_EQ(KEY_ADDED, ret);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "license_holder.h"
|
||||
#include "log.h"
|
||||
#include "oec_device_features.h"
|
||||
#include "properties.h"
|
||||
#include "provisioning_holder.h"
|
||||
#include "test_base.h"
|
||||
#include "test_printers.h"
|
||||
@@ -193,13 +194,24 @@ TEST_F(CorePIGTest, LicenseRelease1) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder.FetchLicense());
|
||||
ASSERT_NO_FATAL_FAILURE(holder.LoadLicense());
|
||||
EXPECT_EQ(NO_ERROR, holder.Decrypt(key_id));
|
||||
// For Android where AlwaysUseKeySetIds() is false, the CDM engine generates
|
||||
// a session separately. Thus, we close the session and only for CE CDM reopen
|
||||
// it for the license release.
|
||||
ASSERT_NO_FATAL_FAILURE(holder.CloseSession());
|
||||
if (Properties::AlwaysUseKeySetIds()) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder.OpenSession());
|
||||
ASSERT_NO_FATAL_FAILURE(holder.ReloadLicense());
|
||||
}
|
||||
ASSERT_NO_FATAL_FAILURE(holder.GenerateAndPostReleaseRequest(
|
||||
"CDM_UnlimitedStreaming_can_persist"));
|
||||
EXPECT_NE(NO_ERROR, holder.Decrypt(key_id));
|
||||
ASSERT_NO_FATAL_FAILURE(holder.FetchRelease());
|
||||
ASSERT_NO_FATAL_FAILURE(holder.LoadRelease());
|
||||
EXPECT_NE(NO_ERROR, holder.Decrypt(key_id));
|
||||
ASSERT_NO_FATAL_FAILURE(holder.CloseSession());
|
||||
// For CE CDM, we can close the session after we have gotten the release.
|
||||
if (Properties::AlwaysUseKeySetIds()) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder.CloseSession());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,11 +231,22 @@ TEST_F(CorePIGTest, LicenseRelease2) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder.FetchLicense());
|
||||
ASSERT_NO_FATAL_FAILURE(holder.LoadLicense());
|
||||
wvutil::TestSleep::Sleep(10);
|
||||
// For Android where AlwaysUseKeySetIds() is false, the CDM engine generates
|
||||
// a session separately. Thus, we close the session and only for CE CDM reopen
|
||||
// it for the license release.
|
||||
ASSERT_NO_FATAL_FAILURE(holder.CloseSession());
|
||||
if (Properties::AlwaysUseKeySetIds()) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder.OpenSession());
|
||||
ASSERT_NO_FATAL_FAILURE(holder.ReloadLicense());
|
||||
}
|
||||
ASSERT_NO_FATAL_FAILURE(holder.GenerateAndPostReleaseRequest(
|
||||
"CDM_UnlimitedStreaming_can_persist"));
|
||||
ASSERT_NO_FATAL_FAILURE(holder.FetchRelease());
|
||||
ASSERT_NO_FATAL_FAILURE(holder.LoadRelease());
|
||||
ASSERT_NO_FATAL_FAILURE(holder.CloseSession());
|
||||
// For CE CDM, we can close the session after we have gotten the release.
|
||||
if (Properties::AlwaysUseKeySetIds()) {
|
||||
ASSERT_NO_FATAL_FAILURE(holder.CloseSession());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(CorePIGTest, CastReceiverProvisioningUsingCdm) {
|
||||
|
||||
Reference in New Issue
Block a user