Integrate OnExpirationUpdate and OnSessionKeysChange with Android

Also removes OnSessionExpiration which is no longer needed with
OnSessionKeysChange.

Bug: 19771612
Bug: 19771431

Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/13951/

Change-Id: I0603e808e8d50ff7bb1fb1d5e44fabd8d268ee8a
This commit is contained in:
Kongqun Yang
2015-04-01 15:02:38 -07:00
parent 4621028434
commit f7c449e93a
8 changed files with 142 additions and 102 deletions

View File

@@ -24,9 +24,12 @@
#include "wv_content_decryption_module.h"
using ::testing::_;
using ::testing::AllOf;
using ::testing::AtLeast;
using ::testing::Each;
using ::testing::Field;
using ::testing::IsEmpty;
using ::testing::Not;
using ::testing::Pair;
using ::testing::StrictMock;
namespace {
@@ -449,11 +452,9 @@ class TestWvCdmEventListener : public WvCdmEventListener {
TestWvCdmEventListener() : WvCdmEventListener() {}
MOCK_METHOD1(OnSessionRenewalNeeded, void(const CdmSessionId& session_id));
MOCK_METHOD1(OnSessionExpiration, void(const CdmSessionId& session_id));
MOCK_METHOD3(OnSessionKeysChange,
void(const CdmSessionId& session_id,
const std::vector<CdmKeyInformation>& cdm_keys_info,
bool has_new_usable_key));
MOCK_METHOD3(OnSessionKeysChange, void(const CdmSessionId& session_id,
const CdmKeyStatusMap& keys_status,
bool has_new_usable_key));
MOCK_METHOD2(OnExpirationUpdate,
void(const CdmSessionId& session_id, int64_t new_expiry_time));
};
@@ -1171,8 +1172,8 @@ TEST_F(WvCdmRequestLicenseTest, ExpiryOnReleaseOfflineKeyTest) {
CdmSessionId restore_session_id = session_id_;
EXPECT_CALL(listener,
OnSessionKeysChange(restore_session_id,
Each(Field(&CdmKeyInformation::key_status,
kKeyStatusUsable)),
AllOf(Each(Pair(_, kKeyStatusUsable)),
Not(IsEmpty())),
true));
EXPECT_CALL(listener, OnExpirationUpdate(restore_session_id, _));
EXPECT_EQ(wvcdm::KEY_ADDED,
@@ -1185,10 +1186,9 @@ TEST_F(WvCdmRequestLicenseTest, ExpiryOnReleaseOfflineKeyTest) {
.Times(AtLeast(0));
EXPECT_CALL(listener,
OnSessionKeysChange(restore_session_id,
Each(Field(&CdmKeyInformation::key_status,
kKeyStatusExpired)),
AllOf(Each(Pair(_, kKeyStatusExpired)),
Not(IsEmpty())),
false));
EXPECT_CALL(listener, OnSessionExpiration(restore_session_id));
GenerateKeyRelease(key_set_id);
key_set_id_ = key_set_id;
VerifyKeyRequestResponse(g_license_server, client_auth, false);