Commit 4fa9fb7b authored by John Rummell's avatar John Rummell Committed by Commit Bot

media: Pass back correct message type for MediaKeyMessageEvent

Also update the browser_tests for renewal messages to verify that at least
one renewal message was actually received.

BUG=
TEST=browser_tests for renewal still work

Change-Id: Idad0059aec02dae4f0910fd9f39846c0a4ac660f
Reviewed-on: https://chromium-review.googlesource.com/569198Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Commit-Queue: John Rummell <jrummell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488467}
parent d0ecf5e9
...@@ -781,6 +781,15 @@ IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, PlatformVerificationTest) { ...@@ -781,6 +781,15 @@ IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, PlatformVerificationTest) {
IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, Renewal) { IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, Renewal) {
TestPlaybackCase(kExternalClearKeyRenewalKeySystem, kNoSessionToLoad, kEnded); TestPlaybackCase(kExternalClearKeyRenewalKeySystem, kNoSessionToLoad, kEnded);
// Check renewal message received.
bool receivedRenewalMessage = false;
EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
browser()->tab_strip_model()->GetActiveWebContents(),
"window.domAutomationController.send("
"document.querySelector('video').receivedRenewalMessage);",
&receivedRenewalMessage));
EXPECT_TRUE(receivedRenewalMessage);
} }
IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, LoadLoadableSession) { IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, LoadLoadableSession) {
......
...@@ -195,6 +195,20 @@ cdm::KeyStatus ConvertKeyStatus(media::CdmKeyInformation::KeyStatus status) { ...@@ -195,6 +195,20 @@ cdm::KeyStatus ConvertKeyStatus(media::CdmKeyInformation::KeyStatus status) {
return cdm::kInternalError; return cdm::kInternalError;
} }
cdm::MessageType ConvertMessageType(media::CdmMessageType message_type) {
switch (message_type) {
case media::CdmMessageType::LICENSE_REQUEST:
return cdm::kLicenseRequest;
case media::CdmMessageType::LICENSE_RENEWAL:
return cdm::kLicenseRenewal;
case media::CdmMessageType::LICENSE_RELEASE:
return cdm::kLicenseRelease;
}
NOTREACHED();
return cdm::kLicenseRequest;
}
// Shallow copy all the key information from |keys_info| into |keys_vector|. // Shallow copy all the key information from |keys_info| into |keys_vector|.
// |keys_vector| is only valid for the lifetime of |keys_info| because it // |keys_vector| is only valid for the lifetime of |keys_info| because it
// contains pointers into the latter. // contains pointers into the latter.
...@@ -709,7 +723,7 @@ void ClearKeyCdm::ScheduleNextRenewal() { ...@@ -709,7 +723,7 @@ void ClearKeyCdm::ScheduleNextRenewal() {
// Prepare the next renewal message and set timer. // Prepare the next renewal message and set timer.
std::ostringstream msg_stream; std::ostringstream msg_stream;
msg_stream << "Renewal from ClearKey CDM set at time " msg_stream << "Renewal from ClearKey CDM set at time "
<< host_->GetCurrentWallTime() << "."; << base::Time::FromDoubleT(host_->GetCurrentWallTime()) << ".";
next_renewal_message_ = msg_stream.str(); next_renewal_message_ = msg_stream.str();
host_->SetTimer(timer_delay_ms_, &next_renewal_message_[0]); host_->SetTimer(timer_delay_ms_, &next_renewal_message_[0]);
...@@ -822,7 +836,7 @@ void ClearKeyCdm::OnSessionMessage(const std::string& session_id, ...@@ -822,7 +836,7 @@ void ClearKeyCdm::OnSessionMessage(const std::string& session_id,
DVLOG(1) << __func__ << ": size = " << message.size(); DVLOG(1) << __func__ << ": size = " << message.size();
host_->OnSessionMessage( host_->OnSessionMessage(
session_id.data(), session_id.length(), cdm::kLicenseRequest, session_id.data(), session_id.length(), ConvertMessageType(message_type),
reinterpret_cast<const char*>(message.data()), message.size()); reinterpret_cast<const char*>(message.data()), message.size());
} }
......
...@@ -123,6 +123,7 @@ PlayerUtils.registerEMEEventListeners = function(player) { ...@@ -123,6 +123,7 @@ PlayerUtils.registerEMEEventListeners = function(player) {
this.registerDefaultEventListeners(player); this.registerDefaultEventListeners(player);
player.video.receivedKeyMessage = false; player.video.receivedKeyMessage = false;
player.video.receivedRenewalMessage = false;
Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem); Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem);
var config = { var config = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment