Test for creating and reloading usage entries. am: 927c2f628b
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11988032 Change-Id: Iee1d1cc5fe6b597bcf3746f5f3e7df47441faf59
This commit is contained in:
@@ -6021,6 +6021,38 @@ TEST_P(OEMCryptoUsageTableTest, ReloadUsageTableWithSkew) {
|
|||||||
ASSERT_EQ(OEMCrypto_SUCCESS, entry.license_messages().LoadResponse());
|
ASSERT_EQ(OEMCrypto_SUCCESS, entry.license_messages().LoadResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_P(OEMCryptoUsageTableTest, LoadAndReloadEntries) {
|
||||||
|
constexpr size_t kEntryCount = 10;
|
||||||
|
std::vector<LicenseWithUsageEntry> entries(kEntryCount);
|
||||||
|
|
||||||
|
for (LicenseWithUsageEntry& entry : entries) {
|
||||||
|
entry.license_messages().set_api_version(license_api_version_);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < kEntryCount; ++i) {
|
||||||
|
const std::string create_description =
|
||||||
|
"Creating entry #" + std::to_string(i);
|
||||||
|
// Create and update a new entry.
|
||||||
|
LicenseWithUsageEntry& new_entry = entries[i];
|
||||||
|
ASSERT_NO_FATAL_FAILURE(new_entry.MakeOfflineAndClose(this))
|
||||||
|
<< create_description;
|
||||||
|
// Reload all entries, starting with the most recently created.
|
||||||
|
for (size_t j = 0; j <= i; ++j) {
|
||||||
|
const std::string reload_description =
|
||||||
|
"Reloading entry #" + std::to_string(i - j) +
|
||||||
|
", after creating entry #" + std::to_string(i);
|
||||||
|
LicenseWithUsageEntry& old_entry = entries[i - j];
|
||||||
|
ASSERT_NO_FATAL_FAILURE(old_entry.session().open());
|
||||||
|
ASSERT_NO_FATAL_FAILURE(old_entry.ReloadUsageEntry())
|
||||||
|
<< reload_description;
|
||||||
|
ASSERT_NO_FATAL_FAILURE(
|
||||||
|
old_entry.session().UpdateUsageEntry(&encrypted_usage_header_))
|
||||||
|
<< reload_description;
|
||||||
|
ASSERT_NO_FATAL_FAILURE(old_entry.session().close());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// A usage report with the wrong pst should fail.
|
// A usage report with the wrong pst should fail.
|
||||||
TEST_P(OEMCryptoUsageTableTest, GenerateReportWrongPST) {
|
TEST_P(OEMCryptoUsageTableTest, GenerateReportWrongPST) {
|
||||||
LicenseWithUsageEntry entry;
|
LicenseWithUsageEntry entry;
|
||||||
|
|||||||
Reference in New Issue
Block a user