Add SRM integration tests

[ Merge of http://go/wvgerrit/30582 ]

Bug: 34285383

Test: WV unit, integration tests, cdm_feature_test.sh

Change-Id: I725150a12a589144e58ab04470d50ba9317a4c46
This commit is contained in:
Rahul Frias
2017-08-23 09:24:06 -07:00
parent 481a1effcb
commit 0c66866902
5 changed files with 756 additions and 38 deletions

View File

@@ -2,6 +2,8 @@
#include "config_test_env.h"
#include "string_conversions.h"
namespace wvcdm {
namespace {
@@ -24,7 +26,7 @@ const std::string kCpKeyId =
"00000022" // pssh data size
// pssh data:
"08011a0d7769646576696e655f746573"
"74220f73747265616d696e675f636c69"
"74220f73747265616d696e675f636c69" // "streaming_clip1"
"7031";
const std::string kCpOfflineKeyId =
"00000040" // blob size
@@ -34,7 +36,26 @@ const std::string kCpOfflineKeyId =
"00000020" // pssh data size
// pssh data:
"08011a0d7769646576696e655f746573"
"74220d6f66666c696e655f636c697032";
"74220d6f66666c696e655f636c697032"; // "offline_clip2"
const CdmInitData kCpStagingSrmOuputProtectionRequired =
"0000003d" // blob size
"70737368" // "pssh"
"00000000" // flags
"edef8ba979d64acea3c827dcd51d21ed" // Widevine system id
"0000001d" // pssh data size
// pssh data:
"08011a0d7769646576696e655f746573"
"74220a74656172735f73726d32"; // "tears_srm2"
const CdmInitData kCpStagingSrmOuputProtectionRequested =
"0000003d" // blob size
"70737368" // "pssh"
"00000000" // flags
"edef8ba979d64acea3c827dcd51d21ed" // Widevine system id
"0000001d" // pssh data size
// pssh data:
"08011a0d7769646576696e655f746573"
"74220a74656172735f73726d32"; // "tears_srm1"
const CdmInitData kEmptyData;
const std::string kCpUatServiceCertificate =
"0ABF020803121028703454C008F63618ADE7443DB6C4C8188BE7F99005228E023082010A02"
"82010100B52112B8D05D023FCC5D95E2C251C1C649B4177CD8D2BEEF355BB06743DE661E3D"
@@ -92,7 +113,7 @@ const std::string kCpProductionServiceCertificate =
// Content Protection license server (staging) data
const std::string kCpStagingLicenseServer =
"http://wv-staging-proxy.appspot.com/proxy";
"https://proxy.staging.widevine.com/proxy";
const std::string kStagingProvisioningServerUrl =
"https://staging-www.sandbox.googleapis.com/"
"certificateprovisioning/v1/devicecertificates/create"
@@ -198,6 +219,7 @@ ConfigTestEnv::ConfigTestEnv(LicenseServerId server_id, bool streaming,
}
void ConfigTestEnv::Init(LicenseServerId server_id) {
server_id_ = server_id;
client_auth_ = license_servers[server_id].client_tag;
key_id_ = license_servers[server_id].key_id;
key_system_ = kWidevineKeySystem;
@@ -207,4 +229,35 @@ void ConfigTestEnv::Init(LicenseServerId server_id) {
wrong_key_id_ = kWrongKeyId;
}
const CdmInitData ConfigTestEnv::GetInitData(ContentId content_id) {
switch (content_id) {
case kContentIdStreaming:
return wvcdm::a2bs_hex(kCpKeyId);
case kContentIdOffline:
return wvcdm::a2bs_hex(kCpOfflineKeyId);
case kContentIdStagingSrmOuputProtectionRequested:
return wvcdm::a2bs_hex(kCpStagingSrmOuputProtectionRequested);
case kContentIdStagingSrmOuputProtectionRequired:
return wvcdm::a2bs_hex(kCpStagingSrmOuputProtectionRequired);
default:
return kEmptyData;
}
}
const std::string& ConfigTestEnv::GetLicenseServerUrl(
LicenseServerId license_server_id) {
switch (license_server_id) {
case kGooglePlayServer:
return kGpLicenseServer;
case kContentProtectionUatServer:
return kCpUatLicenseServer;
case kContentProtectionStagingServer:
return kCpStagingLicenseServer;
case kContentProtectionProductionServer:
return kCpProductionLicenseServer;
default:
return kEmptyData;
}
}
} // namespace wvcdm

View File

@@ -14,9 +14,19 @@ typedef enum {
kContentProtectionProductionServer,
} LicenseServerId;
// Identifies content used in tests. Specify Prod/Uat/Staging if content
// has been registered across license services.
enum ContentId {
kContentIdStreaming,
kContentIdOffline,
kContentIdStagingSrmOuputProtectionRequested,
kContentIdStagingSrmOuputProtectionRequired,
};
// Configures default test environment.
class ConfigTestEnv {
public:
typedef struct {
LicenseServerId id;
std::string license_server_url;
@@ -45,6 +55,10 @@ class ConfigTestEnv {
}
const KeyId& wrong_key_id() const { return wrong_key_id_; }
static const CdmInitData GetInitData(ContentId content_id);
static const std::string& GetLicenseServerUrl(
LicenseServerId license_server_id);
void set_key_id(KeyId& key_id) { key_id_.assign(key_id); }
void set_key_system(CdmKeySystem& key_system) {
key_system_.assign(key_system);
@@ -66,6 +80,7 @@ class ConfigTestEnv {
std::string provisioning_server_url_;
std::string service_certificate_;
KeyId wrong_key_id_;
LicenseServerId server_id_;
CORE_DISALLOW_COPY_AND_ASSIGN(ConfigTestEnv);
};