resolved conflicts for merge of 7eea20df to master
Change-Id: Ibd8b16745d36b24041856f315fbb09a6c25cf4fb
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#if defined(CHROMIUM_BUILD)
|
||||
#include "base/at_exit.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
@@ -10,6 +12,7 @@
|
||||
#include "cdm_engine.h"
|
||||
#include "config_test_env.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "initialization_data.h"
|
||||
#include "license_request.h"
|
||||
#include "log.h"
|
||||
#include "properties.h"
|
||||
@@ -84,6 +87,10 @@ static wvcdm::CdmProvisioningResponse kValidJsonProvisioningResponse =
|
||||
"gZYLHnFiQLZekZUbUUlWY_CwU9Cv0UtxqQ6Oa835_Ug8_n1BwX6BPbmbcWe2Y19laSnDWg4JBNl"
|
||||
"F2CyP9N75jPtW9rVfjUSqKEPOwaIgwzNDkyMjM3NDcAAAA=\","
|
||||
"\"signature\": \"r-LpoZcbbr2KtoPaFnuWTVBh4Gup1k8vn0ClW2qm32A=\"}}";
|
||||
|
||||
const std::string kCencMimeType = "video/mp4";
|
||||
const std::string kWebmMimeType = "video/webm";
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace wvcdm {
|
||||
@@ -99,23 +106,26 @@ class WvCdmEngineTest : public testing::Test {
|
||||
}
|
||||
|
||||
protected:
|
||||
void GenerateKeyRequest(const std::string& key_system,
|
||||
const std::string& key_id,
|
||||
const std::string& mime_type) {
|
||||
void GenerateKeyRequest(const std::string& key_id,
|
||||
const std::string& init_data_type_string) {
|
||||
CdmAppParameterMap app_parameters;
|
||||
std::string server_url;
|
||||
std::string init_data = key_id;
|
||||
CdmKeySetId key_set_id;
|
||||
|
||||
// TODO(rfrias): Temporary change till b/9465346 is addressed
|
||||
if (!Properties::extract_pssh_data() || mime_type != ISO_BMFF_MIME_TYPE) {
|
||||
EXPECT_TRUE(CdmEngine::ExtractWidevinePssh(key_id, &init_data));
|
||||
CdmInitData extracted_init_data = key_id;
|
||||
InitializationData init_data_type(init_data_type_string);
|
||||
if (!Properties::extract_pssh_data() || !init_data_type.is_cenc()) {
|
||||
EXPECT_TRUE(InitializationData::ExtractWidevinePssh(
|
||||
key_id,
|
||||
&extracted_init_data));
|
||||
}
|
||||
|
||||
InitializationData init_data(init_data_type_string, extracted_init_data);
|
||||
|
||||
EXPECT_EQ(KEY_MESSAGE,
|
||||
cdm_engine_.GenerateKeyRequest(session_id_,
|
||||
key_set_id,
|
||||
mime_type,
|
||||
init_data,
|
||||
kLicenseTypeStreaming,
|
||||
app_parameters,
|
||||
@@ -123,8 +133,7 @@ class WvCdmEngineTest : public testing::Test {
|
||||
&server_url));
|
||||
}
|
||||
|
||||
void GenerateRenewalRequest(const std::string& key_system,
|
||||
const std::string& init_data) {
|
||||
void GenerateRenewalRequest() {
|
||||
EXPECT_EQ(KEY_MESSAGE,
|
||||
cdm_engine_.GenerateRenewalRequest(session_id_,
|
||||
&key_msg_,
|
||||
@@ -163,8 +172,7 @@ class WvCdmEngineTest : public testing::Test {
|
||||
}
|
||||
|
||||
void VerifyNewKeyResponse(const std::string& server_url,
|
||||
const std::string& client_auth,
|
||||
std::string& init_data){
|
||||
const std::string& client_auth){
|
||||
std::string resp = GetKeyRequestResponse(server_url,
|
||||
client_auth);
|
||||
CdmKeySetId key_set_id;
|
||||
@@ -172,8 +180,7 @@ class WvCdmEngineTest : public testing::Test {
|
||||
}
|
||||
|
||||
void VerifyRenewalKeyResponse(const std::string& server_url,
|
||||
const std::string& client_auth,
|
||||
std::string& init_data) {
|
||||
const std::string& client_auth) {
|
||||
std::string resp = GetKeyRequestResponse(server_url,
|
||||
client_auth);
|
||||
EXPECT_EQ(wvcdm::KEY_ADDED, cdm_engine_.RenewKey(session_id_, resp));
|
||||
@@ -200,19 +207,19 @@ TEST(WvCdmProvisioningTest, ProvisioningTest) {
|
||||
}
|
||||
|
||||
TEST_F(WvCdmEngineTest, BaseIsoBmffMessageTest) {
|
||||
GenerateKeyRequest(g_key_system, g_key_id, "video/mp4");
|
||||
GenerateKeyRequest(g_key_id, kCencMimeType);
|
||||
GetKeyRequestResponse(g_license_server, g_client_auth);
|
||||
}
|
||||
|
||||
// TODO(juce): Set up with correct test data.
|
||||
TEST_F(WvCdmEngineTest, DISABLED_BaseWebmMessageTest) {
|
||||
GenerateKeyRequest(g_key_system, g_key_id, "video/webm");
|
||||
GenerateKeyRequest(g_key_id, kWebmMimeType);
|
||||
GetKeyRequestResponse(g_license_server, g_client_auth);
|
||||
}
|
||||
|
||||
TEST_F(WvCdmEngineTest, WrongMessageTest) {
|
||||
std::string wrong_message = a2bs_hex(g_wrong_key_id);
|
||||
GenerateKeyRequest(g_key_system, wrong_message, "video/mp4");
|
||||
GenerateKeyRequest(wrong_message, kCencMimeType);
|
||||
|
||||
// We should receive a response with no license, i.e. the extracted license
|
||||
// response message should be empty.
|
||||
@@ -220,24 +227,23 @@ TEST_F(WvCdmEngineTest, WrongMessageTest) {
|
||||
}
|
||||
|
||||
TEST_F(WvCdmEngineTest, NormalDecryptionIsoBmff) {
|
||||
GenerateKeyRequest(g_key_system, g_key_id, "video/mp4");
|
||||
VerifyNewKeyResponse(g_license_server, g_client_auth, g_key_id);
|
||||
GenerateKeyRequest(g_key_id, kCencMimeType);
|
||||
VerifyNewKeyResponse(g_license_server, g_client_auth);
|
||||
}
|
||||
|
||||
// TODO(juce): Set up with correct test data.
|
||||
TEST_F(WvCdmEngineTest, DISABLED_NormalDecryptionWebm) {
|
||||
GenerateKeyRequest(g_key_system, g_key_id, "video/webm");
|
||||
VerifyNewKeyResponse(g_license_server, g_client_auth, g_key_id);
|
||||
GenerateKeyRequest(g_key_id, kWebmMimeType);
|
||||
VerifyNewKeyResponse(g_license_server, g_client_auth);
|
||||
}
|
||||
|
||||
TEST_F(WvCdmEngineTest, LicenseRenewal) {
|
||||
GenerateKeyRequest(g_key_system, g_key_id, "video/mp4");
|
||||
VerifyNewKeyResponse(g_license_server, g_client_auth, g_key_id);
|
||||
GenerateKeyRequest(g_key_id, kCencMimeType);
|
||||
VerifyNewKeyResponse(g_license_server, g_client_auth);
|
||||
|
||||
GenerateRenewalRequest(g_key_system, g_key_id);
|
||||
GenerateRenewalRequest();
|
||||
VerifyRenewalKeyResponse(server_url_.empty() ? g_license_server : server_url_,
|
||||
g_client_auth,
|
||||
g_key_id);
|
||||
g_client_auth);
|
||||
}
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "crypto_session.h"
|
||||
#include "license.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "initialization_data.h"
|
||||
#include "policy_engine.h"
|
||||
#include "string_conversions.h"
|
||||
|
||||
@@ -41,6 +42,10 @@ static const char* kInvalidResponse =
|
||||
"2E4A47A24C06AC1B1A2061F21836A04E558BEE0244EF41C165F60CF23C580275"
|
||||
"3175D48BAF1C6CA5759F200220A2BCCA86051A203FD4671075D9DEC6486A9317"
|
||||
"70669993306831EDD57D77F34EFEB467470BA364";
|
||||
|
||||
const std::string kCencMimeType = "video/mp4";
|
||||
const std::string kWebmMimeType = "video/webm";
|
||||
|
||||
}
|
||||
|
||||
namespace wvcdm {
|
||||
@@ -79,8 +84,8 @@ TEST_F(LicenseTest, DISABLED_PrepareIsoBmffKeyRequest) {
|
||||
CdmAppParameterMap app_parameters;
|
||||
std::string server_url;
|
||||
CdmSessionId session_id;
|
||||
license_.PrepareKeyRequest("video/mp4",
|
||||
a2bs_hex(kInitData),
|
||||
InitializationData init_data(kCencMimeType, a2bs_hex(kInitData));
|
||||
license_.PrepareKeyRequest(init_data,
|
||||
kLicenseTypeStreaming,
|
||||
app_parameters,
|
||||
session_id,
|
||||
@@ -95,8 +100,8 @@ TEST_F(LicenseTest, DISABLED_PrepareWebmKeyRequest) {
|
||||
CdmAppParameterMap app_parameters;
|
||||
std::string server_url;
|
||||
CdmSessionId session_id;
|
||||
license_.PrepareKeyRequest("video/webm",
|
||||
a2bs_hex(kInitData),
|
||||
InitializationData init_data(kWebmMimeType, a2bs_hex(kInitData));
|
||||
license_.PrepareKeyRequest(init_data,
|
||||
kLicenseTypeStreaming,
|
||||
app_parameters,
|
||||
session_id,
|
||||
@@ -111,8 +116,8 @@ TEST_F(LicenseTest, DISABLED_HandleKeyResponseValid) {
|
||||
CdmAppParameterMap app_parameters;
|
||||
CdmSessionId session_id;
|
||||
std::string server_url;
|
||||
license_.PrepareKeyRequest("video/mp4",
|
||||
a2bs_hex(kInitData),
|
||||
InitializationData init_data(kCencMimeType, a2bs_hex(kInitData));
|
||||
license_.PrepareKeyRequest(init_data,
|
||||
kLicenseTypeStreaming,
|
||||
app_parameters,
|
||||
session_id,
|
||||
@@ -128,8 +133,8 @@ TEST_F(LicenseTest, DISABLED_HandleKeyResponseInvalid) {
|
||||
CdmAppParameterMap app_parameters;
|
||||
CdmSessionId session_id;
|
||||
std::string server_url;
|
||||
license_.PrepareKeyRequest("video/mp4",
|
||||
a2bs_hex(kInitData),
|
||||
InitializationData init_data(kCencMimeType, a2bs_hex(kInitData));
|
||||
license_.PrepareKeyRequest(init_data,
|
||||
kLicenseTypeStreaming,
|
||||
app_parameters,
|
||||
session_id,
|
||||
|
||||
Reference in New Issue
Block a user