Store key set ID with usage info
[ Merge of http://go/wvgerrit/16241 and http://go/wvgerrit/16364 ] This will allow a usage session to be loaded later by key set ID. This is needed for EME-style secure stop in the new CE CDM API. b/25816911 Change-Id: I916340047492fbc0556d0e90bd2eac0f3eafe597
This commit is contained in:
@@ -21,6 +21,7 @@ const uint32_t kProtobufEstimatedOverhead = 75;
|
||||
const uint32_t kLicenseRequestLen = 300;
|
||||
const uint32_t kLicenseLen = 500;
|
||||
const uint32_t kProviderSessionTokenLen = 128;
|
||||
const uint32_t kKeySetIdLen = 20;
|
||||
|
||||
// Structurally valid test certificate.
|
||||
// The data elements in this module are used to test the storage and
|
||||
@@ -1536,6 +1537,16 @@ MATCHER_P4(Contains, str1, str2, str3, size, "") {
|
||||
data.find(str2) != std::string::npos &&
|
||||
data.find(str3) != std::string::npos);
|
||||
}
|
||||
MATCHER_P5(Contains, str1, str2, str3, str4, size, "") {
|
||||
// Estimating the length of data. We can have gmock provide length
|
||||
// as well as pointer to data but that will introduce a dependency on tr1
|
||||
std::string data(arg, size + str1.size() + str2.size() + str3.size() +
|
||||
str4.size() + kProtobufEstimatedOverhead);
|
||||
return (data.find(str1) != std::string::npos &&
|
||||
data.find(str2) != std::string::npos &&
|
||||
data.find(str3) != std::string::npos &&
|
||||
data.find(str4) != std::string::npos);
|
||||
}
|
||||
MATCHER_P6(Contains, str1, str2, str3, str4, str5, str6, "") {
|
||||
// Estimating the length of data. We can have gmock provide length
|
||||
// as well as pointer to data but that will introduce a dependency on tr1
|
||||
@@ -1549,7 +1560,6 @@ MATCHER_P6(Contains, str1, str2, str3, str4, str5, str6, "") {
|
||||
data.find(str5) != std::string::npos &&
|
||||
data.find(str6) != std::string::npos);
|
||||
}
|
||||
|
||||
MATCHER_P7(Contains, str1, str2, str3, str4, str5, str6, map7, "") {
|
||||
// Estimating the length of data. We can have gmock provide length
|
||||
// as well as pointer to data but that will introduce a dependency on tr1
|
||||
@@ -2207,6 +2217,7 @@ TEST_P(DeviceFilesUsageInfoTest, Store) {
|
||||
std::string pst(GenerateRandomData(kProviderSessionTokenLen));
|
||||
std::string license_request(GenerateRandomData(kLicenseRequestLen));
|
||||
std::string license(GenerateRandomData(kLicenseLen));
|
||||
std::string key_set_id(GenerateRandomData(kKeySetIdLen));
|
||||
std::string path =
|
||||
device_base_path_ + DeviceFiles::GetUsageInfoFileName(app_id);
|
||||
|
||||
@@ -2236,8 +2247,10 @@ TEST_P(DeviceFilesUsageInfoTest, Store) {
|
||||
}
|
||||
|
||||
EXPECT_CALL(file,
|
||||
Write(Contains(pst, license_request, license, data.size()),
|
||||
Gt(pst.size() + license_request.size() + license.size())))
|
||||
Write(Contains(pst, license_request, license, key_set_id,
|
||||
data.size()),
|
||||
Gt(pst.size() + license_request.size() + license.size() +
|
||||
key_set_id.size())))
|
||||
.WillOnce(ReturnArg<1>());
|
||||
|
||||
DeviceFiles device_files;
|
||||
@@ -2245,7 +2258,8 @@ TEST_P(DeviceFilesUsageInfoTest, Store) {
|
||||
device_files.SetTestFile(&file);
|
||||
|
||||
ASSERT_TRUE(
|
||||
device_files.StoreUsageInfo(pst, license_request, license, app_id));
|
||||
device_files.StoreUsageInfo(pst, license_request, license, app_id,
|
||||
key_set_id));
|
||||
}
|
||||
|
||||
TEST_P(DeviceFilesUsageInfoTest, Delete) {
|
||||
|
||||
Reference in New Issue
Block a user