Reject session clobbering and namespace fixes

* Reject session clobbering.

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

  This fixes a bug in I17de92b3e682c9c731f755e69466bdae7f560393 in which
  sessions can be clobbered by a forced session ID.  This bug manifested
  in subtle test failures which involved repeatedly creating sessions.
  This was traced to OEMCrypto not being terminated, then upward to a
  leaked CryptoSession and CdmSession, and then finally to clobbered
  session IDs.

  To avoid the bug in future, first, reject duplicate session IDs.
  Second, change the OpenSession API to make forced IDs explicit.

* Fix unit test namespaces.

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

  This fixes some odd errors that occur when linking multiple test
  suites into one executable.  When two object files both contain
  a definition of wvcdm::MockCryptoSession, for example, one will win
  silently and cause the other's tests to misbehave and/or crash.

  The solution is to put all mocks into an anonymous namespace, since
  each wvcdm::(anonymous)::MockCryptoSession is separate.

  In order to avoid lots of repetitions of wvcdm:: in the anonymous
  namespaces, all anonymous namespaces in unit tests now live inside
  or the wvcdm namespace.  This has been done even for tests which
  are not currently using mocks.

* Move timer and timer_unittest to Android.

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

  These are not used anywhere else.

Change-Id: I234f31e9b5c79061205728783596ebaff65e0aff
This commit is contained in:
Rahul Frias
2015-09-28 15:18:12 -07:00
parent 39f2fa2ab0
commit cdf309b9f4
25 changed files with 191 additions and 174 deletions

View File

@@ -34,6 +34,7 @@ class CdmEngine {
const CdmClientPropertySet* property_set, const CdmClientPropertySet* property_set,
const std::string& origin, const std::string& origin,
WvCdmEventListener* event_listener, WvCdmEventListener* event_listener,
const CdmSessionId* forced_session_id,
CdmSessionId* session_id); CdmSessionId* session_id);
virtual CdmResponseType CloseSession(const CdmSessionId& session_id); virtual CdmResponseType CloseSession(const CdmSessionId& session_id);
virtual bool IsOpenSession(const CdmSessionId& session_id); virtual bool IsOpenSession(const CdmSessionId& session_id);

View File

@@ -24,7 +24,7 @@ class CdmSession {
public: public:
CdmSession(const CdmClientPropertySet* cdm_client_property_set, CdmSession(const CdmClientPropertySet* cdm_client_property_set,
const std::string& origin, WvCdmEventListener* event_listener, const std::string& origin, WvCdmEventListener* event_listener,
CdmSessionId* forced_session_id); const CdmSessionId* forced_session_id);
virtual ~CdmSession(); virtual ~CdmSession();
virtual CdmResponseType Init(); virtual CdmResponseType Init();

View File

@@ -203,6 +203,7 @@ enum CdmResponseType {
LICENSE_REQUEST_SIGNING_ERROR, LICENSE_REQUEST_SIGNING_ERROR,
EMPTY_LICENSE_REQUEST, EMPTY_LICENSE_REQUEST,
SECURE_BUFFER_REQUIRED, SECURE_BUFFER_REQUIRED,
DUPLICATE_SESSION_ID_SPECIFIED,
LICENSE_RENEWAL_PROHIBITED, LICENSE_RENEWAL_PROHIBITED,
}; };

View File

@@ -78,6 +78,7 @@ CdmResponseType CdmEngine::OpenSession(const CdmKeySystem& key_system,
const CdmClientPropertySet* property_set, const CdmClientPropertySet* property_set,
const std::string& origin, const std::string& origin,
WvCdmEventListener* event_listener, WvCdmEventListener* event_listener,
const CdmSessionId* forced_session_id,
CdmSessionId* session_id) { CdmSessionId* session_id) {
LOGI("CdmEngine::OpenSession"); LOGI("CdmEngine::OpenSession");
@@ -91,9 +92,10 @@ CdmResponseType CdmEngine::OpenSession(const CdmKeySystem& key_system,
return INVALID_PARAMETERS_ENG_1; return INVALID_PARAMETERS_ENG_1;
} }
CdmSessionId* forced_session_id = NULL; if (forced_session_id) {
if (Properties::AlwaysUseKeySetIds() && !session_id->empty()) { if (sessions_.find(*forced_session_id) != sessions_.end()) {
forced_session_id = session_id; return DUPLICATE_SESSION_ID_SPECIFIED;
}
} }
scoped_ptr<CdmSession> new_session( scoped_ptr<CdmSession> new_session(
@@ -132,7 +134,7 @@ CdmResponseType CdmEngine::OpenKeySetSession(
CdmSessionId session_id; CdmSessionId session_id;
CdmResponseType sts = CdmResponseType sts =
OpenSession(KEY_SYSTEM, property_set, origin, event_listener, OpenSession(KEY_SYSTEM, property_set, origin, event_listener,
&session_id); NULL /* forced_session_id */, &session_id);
if (sts != NO_ERROR) return sts; if (sts != NO_ERROR) return sts;

View File

@@ -26,7 +26,7 @@ namespace wvcdm {
CdmSession::CdmSession(const CdmClientPropertySet* cdm_client_property_set, CdmSession::CdmSession(const CdmClientPropertySet* cdm_client_property_set,
const std::string& origin, const std::string& origin,
WvCdmEventListener* event_listener, WvCdmEventListener* event_listener,
CdmSessionId* forced_session_id) const CdmSessionId* forced_session_id)
: initialized_(false), : initialized_(false),
session_id_(GenerateSessionId()), session_id_(GenerateSessionId()),
origin_(origin), origin_(origin),

View File

@@ -7,6 +7,8 @@
#include "log.h" #include "log.h"
#include "string_conversions.h" #include "string_conversions.h"
namespace wvcdm {
namespace { namespace {
// Test vectors as suggested by http://tools.ietf.org/html/rfc4648#section-10 // Test vectors as suggested by http://tools.ietf.org/html/rfc4648#section-10
@@ -53,8 +55,6 @@ const std::pair<const std::string*, const std::string*> kBase64TestVectors[] = {
} // namespace } // namespace
namespace wvcdm {
class Base64EncodeDecodeTest class Base64EncodeDecodeTest
: public ::testing::TestWithParam< : public ::testing::TestWithParam<
std::pair<const std::string*, const std::string*> > {}; std::pair<const std::string*, const std::string*> > {};

View File

@@ -24,6 +24,8 @@
#include "wv_cdm_constants.h" #include "wv_cdm_constants.h"
#include "wv_cdm_types.h" #include "wv_cdm_types.h"
namespace wvcdm {
namespace { namespace {
// Http OK response code. // Http OK response code.
const int kHttpOk = 200; const int kHttpOk = 200;
@@ -31,28 +33,26 @@ const int kHttpOk = 200;
// Default license server, can be configured using --server command line option // Default license server, can be configured using --server command line option
// Default key id (pssh), can be configured using --keyid command line option // Default key id (pssh), can be configured using --keyid command line option
std::string g_client_auth; std::string g_client_auth;
wvcdm::KeyId g_key_id_pssh; KeyId g_key_id_pssh;
wvcdm::KeyId g_key_id_unwrapped; KeyId g_key_id_unwrapped;
wvcdm::CdmKeySystem g_key_system; CdmKeySystem g_key_system;
std::string g_license_server; std::string g_license_server;
wvcdm::KeyId g_wrong_key_id; KeyId g_wrong_key_id;
const std::string kCencMimeType = "video/mp4"; const std::string kCencMimeType = "video/mp4";
const std::string kWebmMimeType = "video/webm"; const std::string kWebmMimeType = "video/webm";
} // namespace } // namespace
namespace wvcdm {
class WvCdmEngineTest : public testing::Test { class WvCdmEngineTest : public testing::Test {
public: public:
virtual void SetUp() { virtual void SetUp() {
CdmResponseType status = CdmResponseType status =
cdm_engine_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL, cdm_engine_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL,
&session_id_); NULL /* forced_session_id */, &session_id_);
if (status == NEED_PROVISIONING) { if (status == NEED_PROVISIONING) {
Provision(); Provision();
status = cdm_engine_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL, status = cdm_engine_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL,
NULL /* forced_session_id */,
&session_id_); &session_id_);
} }
ASSERT_EQ(NO_ERROR, status); ASSERT_EQ(NO_ERROR, status);
@@ -149,14 +149,14 @@ class WvCdmEngineTest : public testing::Test {
const std::string& client_auth) { const std::string& client_auth) {
std::string resp = GetKeyRequestResponse(server_url, client_auth); std::string resp = GetKeyRequestResponse(server_url, client_auth);
CdmKeySetId key_set_id; CdmKeySetId key_set_id;
EXPECT_EQ(wvcdm::KEY_ADDED, EXPECT_EQ(KEY_ADDED,
cdm_engine_.AddKey(session_id_, resp, &key_set_id)); cdm_engine_.AddKey(session_id_, resp, &key_set_id));
} }
void VerifyRenewalKeyResponse(const std::string& server_url, void VerifyRenewalKeyResponse(const std::string& server_url,
const std::string& client_auth) { const std::string& client_auth) {
std::string resp = GetKeyRequestResponse(server_url, client_auth); std::string resp = GetKeyRequestResponse(server_url, client_auth);
EXPECT_EQ(wvcdm::KEY_ADDED, cdm_engine_.RenewKey(session_id_, resp)); EXPECT_EQ(KEY_ADDED, cdm_engine_.RenewKey(session_id_, resp));
} }
CdmEngine cdm_engine_; CdmEngine cdm_engine_;
@@ -213,10 +213,12 @@ TEST_F(WvCdmEngineTest, LicenseRenewal) {
} // namespace wvcdm } // namespace wvcdm
int main(int argc, char** argv) { int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv); using namespace wvcdm;
wvcdm::InitLogging(argc, argv);
wvcdm::ConfigTestEnv config(wvcdm::kContentProtectionUatServer); ::testing::InitGoogleTest(&argc, argv);
InitLogging(argc, argv);
ConfigTestEnv config(kContentProtectionUatServer);
g_client_auth.assign(config.client_auth()); g_client_auth.assign(config.client_auth());
g_key_system.assign(config.key_system()); g_key_system.assign(config.key_system());
g_wrong_key_id.assign(config.wrong_key_id()); g_wrong_key_id.assign(config.wrong_key_id());

View File

@@ -10,8 +10,11 @@
#include "test_printers.h" #include "test_printers.h"
#include "wv_cdm_constants.h" #include "wv_cdm_constants.h"
namespace wvcdm {
namespace { namespace {
const std::string kToken = wvcdm::a2bs_hex(
const std::string kToken = a2bs_hex(
"0AAE02080212107E0A892DEEB021E7AF696B938BB1D5B1188B85AD9D05228E023082010A02" "0AAE02080212107E0A892DEEB021E7AF696B938BB1D5B1188B85AD9D05228E023082010A02"
"82010100DBEDF2BFB0EC98213766E65049B9AB176FA4B1FBFBB2A0C96C87D9F2B895E0ED77" "82010100DBEDF2BFB0EC98213766E65049B9AB176FA4B1FBFBB2A0C96C87D9F2B895E0ED77"
"93BDA057E6BC3E0CA2348BC6831E03609445CA4D418CB98EAC98FFC87AB2364CE76BA26BEE" "93BDA057E6BC3E0CA2348BC6831E03609445CA4D418CB98EAC98FFC87AB2364CE76BA26BEE"
@@ -47,7 +50,7 @@ const std::string kToken = wvcdm::a2bs_hex(
"8CD5A9DF6E3D3A99B806F6D60991358C5BE77117D4F3168F3348E9A048539F892F4D783152" "8CD5A9DF6E3D3A99B806F6D60991358C5BE77117D4F3168F3348E9A048539F892F4D783152"
"C7A8095224AA56B78C5CF7BD1AB1B179C0C0D11E3C3BAC84C141A00191321E3ACC17242E68" "C7A8095224AA56B78C5CF7BD1AB1B179C0C0D11E3C3BAC84C141A00191321E3ACC17242E68"
"3C"); "3C");
const std::string kWrappedKey = wvcdm::a2bs_hex( const std::string kWrappedKey = a2bs_hex(
"3B84252DD84F1A710365014A114507FFFA3DD404625D61D1EEC7C3A39D72CB8D9318ADE9DA" "3B84252DD84F1A710365014A114507FFFA3DD404625D61D1EEC7C3A39D72CB8D9318ADE9DA"
"05D69F9776DAFDA49A97BC30E84CA275925DFD98CA04F7DB23465103A224852192DE232902" "05D69F9776DAFDA49A97BC30E84CA275925DFD98CA04F7DB23465103A224852192DE232902"
"99FF82024F5CCA7716ACA9BE0B56348BA16B9E3136D73789C842CB2ECA4820DDAAF59CCB9B" "99FF82024F5CCA7716ACA9BE0B56348BA16B9E3136D73789C842CB2ECA4820DDAAF59CCB9B"
@@ -87,19 +90,6 @@ const std::string kWrappedKey = wvcdm::a2bs_hex(
const std::string kTestOrigin = "com.google"; const std::string kTestOrigin = "com.google";
} // namespace
namespace wvcdm {
// gmock methods
using ::testing::_;
using ::testing::Eq;
using ::testing::NotNull;
using ::testing::Return;
using ::testing::SetArgPointee;
using ::testing::Sequence;
using ::testing::StrEq;
class MockDeviceFiles : public DeviceFiles { class MockDeviceFiles : public DeviceFiles {
public: public:
MOCK_METHOD1(Init, bool(CdmSecurityLevel)); MOCK_METHOD1(Init, bool(CdmSecurityLevel));
@@ -129,6 +119,17 @@ class MockCdmLicense : public CdmLicense {
MOCK_METHOD3(Init, bool(const std::string&, CryptoSession*, PolicyEngine*)); MOCK_METHOD3(Init, bool(const std::string&, CryptoSession*, PolicyEngine*));
}; };
} // namespace
// gmock methods
using ::testing::_;
using ::testing::Eq;
using ::testing::NotNull;
using ::testing::Return;
using ::testing::SetArgPointee;
using ::testing::Sequence;
using ::testing::StrEq;
class CdmSessionTest : public ::testing::Test { class CdmSessionTest : public ::testing::Test {
protected: protected:
virtual void SetUp() { virtual void SetUp() {
@@ -254,4 +255,4 @@ TEST_F(CdmSessionTest, InitNeedsProvisioning) {
ASSERT_EQ(NEED_PROVISIONING, cdm_session_->Init()); ASSERT_EQ(NEED_PROVISIONING, cdm_session_->Init());
} }
} // wvcdm } // namespace wvcdm

View File

@@ -146,7 +146,7 @@ ConfigTestEnv::ConfigTestEnv(LicenseServerId server_id, bool streaming,
if (!streaming) { if (!streaming) {
key_id_ = license_servers[server_id].offline_key_id; key_id_ = license_servers[server_id].offline_key_id;
if (wvcdm::kGooglePlayServer == server_id) { if (kGooglePlayServer == server_id) {
if (renew) { if (renew) {
client_auth_.append(kGpClientOfflineRenewalQueryParameters); client_auth_.append(kGpClientOfflineRenewalQueryParameters);
} else if (release) { } else if (release) {

View File

@@ -12,21 +12,8 @@
namespace wvcdm { namespace wvcdm {
// gmock methods
using ::testing::_;
using ::testing::AllOf;
using ::testing::Eq;
using ::testing::Gt;
using ::testing::HasSubstr;
using ::testing::InSequence;
using ::testing::NotNull;
using ::testing::Return;
using ::testing::ReturnArg;
using ::testing::SetArgPointee;
using ::testing::SetArrayArgument;
using ::testing::StrEq;
namespace { namespace {
const uint32_t kCertificateLen = 700; const uint32_t kCertificateLen = 700;
const uint32_t kWrappedKeyLen = 500; const uint32_t kWrappedKeyLen = 500;
@@ -143,8 +130,8 @@ LicenseInfo license_test_data[] = {
// license 0 // license 0
{"ksid54C57C966E23CEF5", DeviceFiles::kLicenseStateActive, {"ksid54C57C966E23CEF5", DeviceFiles::kLicenseStateActive,
wvcdm::a2bs_hex("0801121030313233343536373839414243444546"), a2bs_hex("0801121030313233343536373839414243444546"),
wvcdm::a2bs_hex( a2bs_hex(
"080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591B" "080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591B"
"C4D07A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD" "C4D07A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD"
"55FB685FDB3025574517CCCC74EE4FEAF6629D5179A52FF85CE7409528EF" "55FB685FDB3025574517CCCC74EE4FEAF6629D5179A52FF85CE7409528EF"
@@ -206,7 +193,7 @@ LicenseInfo license_test_data[] = {
"39FA1E7AE925B494B361F6F7116F20BE8EE6E446146027F4FD4300F4A0B0" "39FA1E7AE925B494B361F6F7116F20BE8EE6E446146027F4FD4300F4A0B0"
"A3361EE34925F338D0AACF20AE919B4BAE81C1D57A8D2B8FA38732A57697" "A3361EE34925F338D0AACF20AE919B4BAE81C1D57A8D2B8FA38732A57697"
"C316C180717C182A971C94E4AC4C7DF8F161CB8CC1"), "C316C180717C182A971C94E4AC4C7DF8F161CB8CC1"),
wvcdm::a2bs_hex( a2bs_hex(
"080212CC020A190A0939383736353433323112084B9F26DAB8B06E112002" "080212CC020A190A0939383736353433323112084B9F26DAB8B06E112002"
"2800124108011801301E4239687474703A2F2F6B69723033666370673137" "2800124108011801301E4239687474703A2F2F6B69723033666370673137"
"342E7769646576696E652E6E65742F7769646576696E652F6367692D6269" "342E7769646576696E652E6E65742F7769646576696E652F6367692D6269"
@@ -228,17 +215,17 @@ LicenseInfo license_test_data[] = {
"6294860DFB4F4C42D57D9542B76179E179DD4AA23F9F7B2AE432B39E4CE8" "6294860DFB4F4C42D57D9542B76179E179DD4AA23F9F7B2AE432B39E4CE8"
"F156E84877DDA781AAAAFC797FF75AFE2019ADC3A2E419BF0253C705BD47" "F156E84877DDA781AAAAFC797FF75AFE2019ADC3A2E419BF0253C705BD47"
"97A96866AC4C059AD8F2E9C6B617C60C6ADCDB894C25F0C7D29252F52FD5"), "97A96866AC4C059AD8F2E9C6B617C60C6ADCDB894C25F0C7D29252F52FD5"),
wvcdm::a2bs_hex( a2bs_hex(
"08011231121D1A1B0A190A0939383736353433323112084B9F26DAB8B06E" "08011231121D1A1B0A190A0939383736353433323112084B9F26DAB8B06E"
"112002280018022A0C31353532333030360000000030151A20C30375683C" "112002280018022A0C31353532333030360000000030151A20C30375683C"
"4D2033E05DCC95DDFB278CFB5125A021C3C043A16ACC933A768A27"), "4D2033E05DCC95DDFB278CFB5125A021C3C043A16ACC933A768A27"),
wvcdm::a2bs_hex( a2bs_hex(
"0802123B0A190A0939383736353433323112084B9F26DAB8B06E11200228" "0802123B0A190A0939383736353433323112084B9F26DAB8B06E11200228"
"0112001A16200342120A106B63746C0000000000ECDCBE0000000020DBDF" "0112001A16200342120A106B63746C0000000000ECDCBE0000000020DBDF"
"A68F051A20182F029E35047A3841FA176C74E5B387350E8D58DEA6878FF0" "A68F051A20182F029E35047A3841FA176C74E5B387350E8D58DEA6878FF0"
"BEA6CABACA1C2C"), "BEA6CABACA1C2C"),
"https://test.google.com/license/GetCencLicense", 0x0, 0x0, "", "https://test.google.com/license/GetCencLicense", 0x0, 0x0, "",
wvcdm::a2bs_hex( a2bs_hex(
"0AA8150802100122A1150801121408011210303132333435363738394142434445461" "0AA8150802100122A1150801121408011210303132333435363738394142434445461"
"A9D0E080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591BC4D0" "A9D0E080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591BC4D0"
"7A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD55FB685FDB302" "7A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD55FB685FDB302"
@@ -323,8 +310,8 @@ LicenseInfo license_test_data[] = {
// license 1 // license 1
{"ksidC8EAA2579A282EB0", DeviceFiles::kLicenseStateReleasing, {"ksidC8EAA2579A282EB0", DeviceFiles::kLicenseStateReleasing,
wvcdm::a2bs_hex("0801121030313233343536373839414243444546"), a2bs_hex("0801121030313233343536373839414243444546"),
wvcdm::a2bs_hex( a2bs_hex(
"080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591B" "080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591B"
"C4D07A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD" "C4D07A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD"
"55FB685FDB3025574517CCCC74EE4FEAF6629D5179A52FF85CE7409528EF" "55FB685FDB3025574517CCCC74EE4FEAF6629D5179A52FF85CE7409528EF"
@@ -386,7 +373,7 @@ LicenseInfo license_test_data[] = {
"0D1706B0B851B3FCAF7AC2370EAD80C5D1620887633A42024862FCEA9F95" "0D1706B0B851B3FCAF7AC2370EAD80C5D1620887633A42024862FCEA9F95"
"A719AAB989C1923C6452ECB0B75AF1CAFBFB06C5EC31BBF0EE4D16ACCC9A" "A719AAB989C1923C6452ECB0B75AF1CAFBFB06C5EC31BBF0EE4D16ACCC9A"
"F05B77D61C4855491B3D4AC150F3BCB7AE536AF333"), "F05B77D61C4855491B3D4AC150F3BCB7AE536AF333"),
wvcdm::a2bs_hex( a2bs_hex(
"080212CC020A190A093938373635343332311208F97F2B3856CBB3DD2002" "080212CC020A190A093938373635343332311208F97F2B3856CBB3DD2002"
"2800124108011801301E4239687474703A2F2F6B69723033666370673137" "2800124108011801301E4239687474703A2F2F6B69723033666370673137"
"342E7769646576696E652E6E65742F7769646576696E652F6367692D6269" "342E7769646576696E652E6E65742F7769646576696E652F6367692D6269"
@@ -408,18 +395,18 @@ LicenseInfo license_test_data[] = {
"87CF9841D186BC95A65956BAD48F3C9E43F027CC03B73DFF5CAFC0B64727" "87CF9841D186BC95A65956BAD48F3C9E43F027CC03B73DFF5CAFC0B64727"
"E2D7B3A9CF25F97C475207C8A9DF091A585288A71AE64B7B2089871F7272" "E2D7B3A9CF25F97C475207C8A9DF091A585288A71AE64B7B2089871F7272"
"381CCBEF55EBF3DCB21B134FE48BFD5299DCCA6B01B55EEA61F9F990D0AF"), "381CCBEF55EBF3DCB21B134FE48BFD5299DCCA6B01B55EEA61F9F990D0AF"),
wvcdm::a2bs_hex( a2bs_hex(
"08011231121D1A1B0A190A093938373635343332311208F97F2B3856CBB3" "08011231121D1A1B0A190A093938373635343332311208F97F2B3856CBB3"
"DD2002280018022A0C33333932383235393733000030151A209ADE9B0A41" "DD2002280018022A0C33333932383235393733000030151A209ADE9B0A41"
"1583962BDA31BE5BE937E589BB3DCC06F6F4C48FBE4FAE86DC9ABA"), "1583962BDA31BE5BE937E589BB3DCC06F6F4C48FBE4FAE86DC9ABA"),
wvcdm::a2bs_hex( a2bs_hex(
"0802123B0A190A093938373635343332311208F97F2B3856CBB3DD200228" "0802123B0A190A093938373635343332311208F97F2B3856CBB3DD200228"
"0112001A16200342120A106B63746C00000000CA3A6A75000000002083E5" "0112001A16200342120A106B63746C00000000CA3A6A75000000002083E5"
"A68F051A20BDA6A56F7CBFD0942198F87C23A34AA5CBD64AFEB134277774" "A68F051A20BDA6A56F7CBFD0942198F87C23A34AA5CBD64AFEB134277774"
"CCF8E789D815DD"), "CCF8E789D815DD"),
"https://test.google.com/license/GetCencLicense", 0x12345678, 0x12348765, "https://test.google.com/license/GetCencLicense", 0x12345678, 0x12348765,
"Name1 Value1", "Name1 Value1",
wvcdm::a2bs_hex( a2bs_hex(
"0AC1150802100122BA150802121408011210303132333435363738394142434445461" "0AC1150802100122BA150802121408011210303132333435363738394142434445461"
"A9D0E080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591BC4D0" "A9D0E080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591BC4D0"
"7A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD55FB685FDB302" "7A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD55FB685FDB302"
@@ -504,8 +491,8 @@ LicenseInfo license_test_data[] = {
// license 2 // license 2
{"ksidE8C37662C88DC673", DeviceFiles::kLicenseStateReleasing, {"ksidE8C37662C88DC673", DeviceFiles::kLicenseStateReleasing,
wvcdm::a2bs_hex("0801121030313233343536373839414243444546"), a2bs_hex("0801121030313233343536373839414243444546"),
wvcdm::a2bs_hex( a2bs_hex(
"080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591B" "080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591B"
"C4D07A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD" "C4D07A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD"
"55FB685FDB3025574517CCCC74EE4FEAF6629D5179A52FF85CE7409528EF" "55FB685FDB3025574517CCCC74EE4FEAF6629D5179A52FF85CE7409528EF"
@@ -567,7 +554,7 @@ LicenseInfo license_test_data[] = {
"0615A55523305BC64DDFF52A87BD0DE9EEAB6445C5A1847E5E6FE8D640C7" "0615A55523305BC64DDFF52A87BD0DE9EEAB6445C5A1847E5E6FE8D640C7"
"B07F3B066B911793F06E973A02FA6EDD274570C4CA982D353F1E72A5B776" "B07F3B066B911793F06E973A02FA6EDD274570C4CA982D353F1E72A5B776"
"95D554B4FB554B46F5FA5B3B00805C136A9ED21FC2"), "95D554B4FB554B46F5FA5B3B00805C136A9ED21FC2"),
wvcdm::a2bs_hex( a2bs_hex(
"080212CC020A190A0939383736353433323112087AD49366C8D919132002" "080212CC020A190A0939383736353433323112087AD49366C8D919132002"
"2800124108011801301E4239687474703A2F2F6B69723033666370673137" "2800124108011801301E4239687474703A2F2F6B69723033666370673137"
"342E7769646576696E652E6E65742F7769646576696E652F6367692D6269" "342E7769646576696E652E6E65742F7769646576696E652F6367692D6269"
@@ -589,18 +576,18 @@ LicenseInfo license_test_data[] = {
"222AC08DCBD36077E0459D940BAE84ABA584700C02E70F3AE034ED7B764C" "222AC08DCBD36077E0459D940BAE84ABA584700C02E70F3AE034ED7B764C"
"6EE5E85663D657270C9AB40D3109920AB1C1C5DA1358E384EDF673253C04" "6EE5E85663D657270C9AB40D3109920AB1C1C5DA1358E384EDF673253C04"
"F20AA6B0CC98F421A4CD86C4C88042B0DE9902D5D00B6AD817B1A313ED5B"), "F20AA6B0CC98F421A4CD86C4C88042B0DE9902D5D00B6AD817B1A313ED5B"),
wvcdm::a2bs_hex( a2bs_hex(
"08011231121D1A1B0A190A0939383736353433323112087AD49366C8D919" "08011231121D1A1B0A190A0939383736353433323112087AD49366C8D919"
"132002280018022A0C35333631323234343600000030151A208CC3C7D328" "132002280018022A0C35333631323234343600000030151A208CC3C7D328"
"DFACD43764C9FB582B858C8FF1D9863FF59C4D983478DB858AC32A"), "DFACD43764C9FB582B858C8FF1D9863FF59C4D983478DB858AC32A"),
wvcdm::a2bs_hex( a2bs_hex(
"0802123B0A190A0939383736353433323112087AD49366C8D91913200228" "0802123B0A190A0939383736353433323112087AD49366C8D91913200228"
"0112001A16200342120A106B63746C000000001FF4944E000000002082E7" "0112001A16200342120A106B63746C000000001FF4944E000000002082E7"
"A68F051A2041EF0A9267D613D17AA90E1D1DA5BE091860E5E296D41D6D0F" "A68F051A2041EF0A9267D613D17AA90E1D1DA5BE091860E5E296D41D6D0F"
"75E73660C279B3"), "75E73660C279B3"),
"https://test.google.com/license/GetCencLicense", 0x0123456789abcdef, "https://test.google.com/license/GetCencLicense", 0x0123456789abcdef,
0x123456789abfedc, "Name1 Value1 Name2 Param2", 0x123456789abfedc, "Name1 Value1 Name2 Param2",
wvcdm::a2bs_hex( a2bs_hex(
"0AE7150802100122E0150802121408011210303132333435363738394142434445461" "0AE7150802100122E0150802121408011210303132333435363738394142434445461"
"A9D0E080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591BC4D0" "A9D0E080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591BC4D0"
"7A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD55FB685FDB302" "7A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD55FB685FDB302"
@@ -691,8 +678,8 @@ LicenseInfo license_test_data[] = {
LicenseInfo license_update_test_data[] = { LicenseInfo license_update_test_data[] = {
// active license // active license
{"key_set_id_: ksid2A048BC7FAEC885A", DeviceFiles::kLicenseStateActive, {"key_set_id_: ksid2A048BC7FAEC885A", DeviceFiles::kLicenseStateActive,
wvcdm::a2bs_hex("0801121030313233343536373839414243444546"), a2bs_hex("0801121030313233343536373839414243444546"),
wvcdm::a2bs_hex( a2bs_hex(
"080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591B" "080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591B"
"C4D07A7D5076189EDFB68F05228E023082010A0282010100CC1715C81AD3" "C4D07A7D5076189EDFB68F05228E023082010A0282010100CC1715C81AD3"
"F6F279C686F826E6D7C8961EB13318367D06B4061BBC57E3C616A226A10F" "F6F279C686F826E6D7C8961EB13318367D06B4061BBC57E3C616A226A10F"
@@ -754,7 +741,7 @@ LicenseInfo license_update_test_data[] = {
"EC3AA5881FF433E80838E1E1FA23CE7F22346DDDF7FEC3DB0CE2C3F845CF" "EC3AA5881FF433E80838E1E1FA23CE7F22346DDDF7FEC3DB0CE2C3F845CF"
"9471088A022C8D0A63860764AE558BD0B5F66D78881ADBF2D398F9BA349E" "9471088A022C8D0A63860764AE558BD0B5F66D78881ADBF2D398F9BA349E"
"FB2532C61E243DD45BB11C99422D13A82B7AAE9671"), "FB2532C61E243DD45BB11C99422D13A82B7AAE9671"),
wvcdm::a2bs_hex( a2bs_hex(
"080212CC020A190A09393837363534333231120892BE96420F0D5BF32002" "080212CC020A190A09393837363534333231120892BE96420F0D5BF32002"
"2800124108011801301E4239687474703A2F2F6B69723033666370673137" "2800124108011801301E4239687474703A2F2F6B69723033666370673137"
"342E7769646576696E652E6E65742F7769646576696E652F6367692D6269" "342E7769646576696E652E6E65742F7769646576696E652F6367692D6269"
@@ -776,18 +763,18 @@ LicenseInfo license_update_test_data[] = {
"B161F4D198A0279DA19D7001EB2D20C70ABAA04B3760CB165006F6CBA4BE" "B161F4D198A0279DA19D7001EB2D20C70ABAA04B3760CB165006F6CBA4BE"
"0A2628C0C8398C122FF0DCF9292590E3C37BC7DB20F3B0921268F41FE76B" "0A2628C0C8398C122FF0DCF9292590E3C37BC7DB20F3B0921268F41FE76B"
"D3EE764EBA13A22FDABC170860503FB93CC4A08D61102519D56A25EB9E30"), "D3EE764EBA13A22FDABC170860503FB93CC4A08D61102519D56A25EB9E30"),
wvcdm::a2bs_hex( a2bs_hex(
"08011231121D1A1B0A190A09393837363534333231120892BE96420F0D5B" "08011231121D1A1B0A190A09393837363534333231120892BE96420F0D5B"
"F32002280018022A0C31393132353333373731000030151A20F4FDBECE54" "F32002280018022A0C31393132353333373731000030151A20F4FDBECE54"
"7252D12BB9D488DAD50C76577A2FBCCC73F36D3C6B35096B8A3DC6"), "7252D12BB9D488DAD50C76577A2FBCCC73F36D3C6B35096B8A3DC6"),
wvcdm::a2bs_hex( a2bs_hex(
"0802123B0A190A09393837363534333231120892BE96420F0D5BF3200228" "0802123B0A190A09393837363534333231120892BE96420F0D5BF3200228"
"0112001A16200342120A106B63746C0000000071FEF30B0000000020F4DF" "0112001A16200342120A106B63746C0000000071FEF30B0000000020F4DF"
"B68F051A2000351030900858FCFD6977B67803ADFD1280AA661E6B0BD30B" "B68F051A2000351030900858FCFD6977B67803ADFD1280AA661E6B0BD30B"
"08B2C467355129"), "08B2C467355129"),
"https://test.google.com/license/GetCencLicense", 0x0123456789abcdef, "https://test.google.com/license/GetCencLicense", 0x0123456789abcdef,
0x123456789abfedc, "Name1 Value1 Name2 Value2 Name3 Value3", 0x123456789abfedc, "Name1 Value1 Name2 Value2 Name3 Value3",
wvcdm::a2bs_hex( a2bs_hex(
"0AB8150802100122B1150801121408011210303132333435363738394142434445461" "0AB8150802100122B1150801121408011210303132333435363738394142434445461"
"A9D0E080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591BC4D0" "A9D0E080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591BC4D0"
"7A7D5076189EDFB68F05228E023082010A0282010100CC1715C81AD3F6F279C686F82" "7A7D5076189EDFB68F05228E023082010A0282010100CC1715C81AD3F6F279C686F82"
@@ -872,7 +859,7 @@ LicenseInfo license_update_test_data[] = {
// license being released. all fields are identical except for license // license being released. all fields are identical except for license
// state and hashed file data // state and hashed file data
{"", DeviceFiles::kLicenseStateReleasing, "", "", "", "", "", "", 0, 0, "", {"", DeviceFiles::kLicenseStateReleasing, "", "", "", "", "", "", 0, 0, "",
wvcdm::a2bs_hex( a2bs_hex(
"0AB8150802100122B1150802121408011210303132333435363738394142434445461" "0AB8150802100122B1150802121408011210303132333435363738394142434445461"
"A9D0E080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591BC4D0" "A9D0E080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591BC4D0"
"7A7D5076189EDFB68F05228E023082010A0282010100CC1715C81AD3F6F279C686F82" "7A7D5076189EDFB68F05228E023082010A0282010100CC1715C81AD3F6F279C686F82"
@@ -961,8 +948,8 @@ LicenseInfo license_update_test_data[] = {
LicenseInfo license_app_parameters_backwards_compatibility_test_data = { LicenseInfo license_app_parameters_backwards_compatibility_test_data = {
"ksid54C57C966E23CEF5", DeviceFiles::kLicenseStateActive, "ksid54C57C966E23CEF5", DeviceFiles::kLicenseStateActive,
wvcdm::a2bs_hex("0801121030313233343536373839414243444546"), a2bs_hex("0801121030313233343536373839414243444546"),
wvcdm::a2bs_hex( a2bs_hex(
"080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591B" "080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591B"
"C4D07A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD" "C4D07A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD"
"55FB685FDB3025574517CCCC74EE4FEAF6629D5179A52FF85CE7409528EF" "55FB685FDB3025574517CCCC74EE4FEAF6629D5179A52FF85CE7409528EF"
@@ -1024,7 +1011,7 @@ LicenseInfo license_app_parameters_backwards_compatibility_test_data = {
"39FA1E7AE925B494B361F6F7116F20BE8EE6E446146027F4FD4300F4A0B0" "39FA1E7AE925B494B361F6F7116F20BE8EE6E446146027F4FD4300F4A0B0"
"A3361EE34925F338D0AACF20AE919B4BAE81C1D57A8D2B8FA38732A57697" "A3361EE34925F338D0AACF20AE919B4BAE81C1D57A8D2B8FA38732A57697"
"C316C180717C182A971C94E4AC4C7DF8F161CB8CC1"), "C316C180717C182A971C94E4AC4C7DF8F161CB8CC1"),
wvcdm::a2bs_hex( a2bs_hex(
"080212CC020A190A0939383736353433323112084B9F26DAB8B06E112002" "080212CC020A190A0939383736353433323112084B9F26DAB8B06E112002"
"2800124108011801301E4239687474703A2F2F6B69723033666370673137" "2800124108011801301E4239687474703A2F2F6B69723033666370673137"
"342E7769646576696E652E6E65742F7769646576696E652F6367692D6269" "342E7769646576696E652E6E65742F7769646576696E652F6367692D6269"
@@ -1046,17 +1033,17 @@ LicenseInfo license_app_parameters_backwards_compatibility_test_data = {
"6294860DFB4F4C42D57D9542B76179E179DD4AA23F9F7B2AE432B39E4CE8" "6294860DFB4F4C42D57D9542B76179E179DD4AA23F9F7B2AE432B39E4CE8"
"F156E84877DDA781AAAAFC797FF75AFE2019ADC3A2E419BF0253C705BD47" "F156E84877DDA781AAAAFC797FF75AFE2019ADC3A2E419BF0253C705BD47"
"97A96866AC4C059AD8F2E9C6B617C60C6ADCDB894C25F0C7D29252F52FD5"), "97A96866AC4C059AD8F2E9C6B617C60C6ADCDB894C25F0C7D29252F52FD5"),
wvcdm::a2bs_hex( a2bs_hex(
"08011231121D1A1B0A190A0939383736353433323112084B9F26DAB8B06E" "08011231121D1A1B0A190A0939383736353433323112084B9F26DAB8B06E"
"112002280018022A0C31353532333030360000000030151A20C30375683C" "112002280018022A0C31353532333030360000000030151A20C30375683C"
"4D2033E05DCC95DDFB278CFB5125A021C3C043A16ACC933A768A27"), "4D2033E05DCC95DDFB278CFB5125A021C3C043A16ACC933A768A27"),
wvcdm::a2bs_hex( a2bs_hex(
"0802123B0A190A0939383736353433323112084B9F26DAB8B06E11200228" "0802123B0A190A0939383736353433323112084B9F26DAB8B06E11200228"
"0112001A16200342120A106B63746C0000000000ECDCBE0000000020DBDF" "0112001A16200342120A106B63746C0000000000ECDCBE0000000020DBDF"
"A68F051A20182F029E35047A3841FA176C74E5B387350E8D58DEA6878FF0" "A68F051A20182F029E35047A3841FA176C74E5B387350E8D58DEA6878FF0"
"BEA6CABACA1C2C"), "BEA6CABACA1C2C"),
"https://test.google.com/license/GetCencLicense", 0x0, 0x0, "", "https://test.google.com/license/GetCencLicense", 0x0, 0x0, "",
wvcdm::a2bs_hex( a2bs_hex(
"0AA8150802100122A1150801121408011210303132333435363738394142434445461" "0AA8150802100122A1150801121408011210303132333435363738394142434445461"
"A9D0E080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591BC4D0" "A9D0E080112950C0AD70B080112EF090AB002080212103E560EC5335E346F591BC4D0"
"7A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD55FB685FDB302" "7A7D507618A5D3A68F05228E023082010A0282010100A947904B8DBD55FB685FDB302"
@@ -1148,16 +1135,16 @@ struct UsageInfo {
UsageInfo kUsageInfoTestData[] = { UsageInfo kUsageInfoTestData[] = {
{"", "", "", // 0 usage info records {"", "", "", // 0 usage info records
wvcdm::a2bs_hex( a2bs_hex(
"0A06080210012A00122095053501C5FA405B7EF01DA94685C6B20CB36493" "0A06080210012A00122095053501C5FA405B7EF01DA94685C6B20CB36493"
"A9CF1653B720E2BEA3B77929")}, "A9CF1653B720E2BEA3B77929")},
{// 1 usage info record {// 1 usage info record
wvcdm::a2bs_hex( a2bs_hex(
"924B035FBDA56AE5EF0ED05A08DE7AECC8ABE1835E0C4A548F7803937F4C3B4520EB7" "924B035FBDA56AE5EF0ED05A08DE7AECC8ABE1835E0C4A548F7803937F4C3B4520EB7"
"F3334FFCDFA00DE56408F09D5019FCE87072D0DC6789817468974B2EA51EE3944B8D7" "F3334FFCDFA00DE56408F09D5019FCE87072D0DC6789817468974B2EA51EE3944B8D7"
"E0A88E4F16EBB80F03BD845231A01E6146841CBAEF0134DCD9300DB2D92732992C0F2" "E0A88E4F16EBB80F03BD845231A01E6146841CBAEF0134DCD9300DB2D92732992C0F2"
"310D8E386FB31C67B9477010DEF9D99C4272589572A26A17E"), "310D8E386FB31C67B9477010DEF9D99C4272589572A26A17E"),
wvcdm::a2bs_hex( a2bs_hex(
"1E6FFBE66FC6153E7749906EC8F684E819467E16CAF317F315DB32B6D3FDD1A8E8A09" "1E6FFBE66FC6153E7749906EC8F684E819467E16CAF317F315DB32B6D3FDD1A8E8A09"
"4174D92D063B88E4835EAB78BD09541EA7FE72F132EB7364E154BC1548FC40EC70927" "4174D92D063B88E4835EAB78BD09541EA7FE72F132EB7364E154BC1548FC40EC70927"
"75531508C95F9ED5D76F36BC0C198C3A33A1F9415B343905D6BE37645E6800F053B1D" "75531508C95F9ED5D76F36BC0C198C3A33A1F9415B343905D6BE37645E6800F053B1D"
@@ -1167,7 +1154,7 @@ UsageInfo kUsageInfoTestData[] = {
"151827086EADE71C138B972CC3992CF9ADA944C063816352ED8658D3FA07BE0F32239" "151827086EADE71C138B972CC3992CF9ADA944C063816352ED8658D3FA07BE0F32239"
"E74A65932B069AAC4E8386DB59154AF9AEF71448128C66E510445294F44E511BD9B1A" "E74A65932B069AAC4E8386DB59154AF9AEF71448128C66E510445294F44E511BD9B1A"
"F19D4D67E99363093BE888D4B2AB841CAFF252CAD13EDF8E"), "F19D4D67E99363093BE888D4B2AB841CAFF252CAD13EDF8E"),
wvcdm::a2bs_hex( a2bs_hex(
"40FC62339728520E6C0C09907C26F3FB78287231661952A8B699E47AE241B999C029F" "40FC62339728520E6C0C09907C26F3FB78287231661952A8B699E47AE241B999C029F"
"D2067836DC4BC64F66998A3ECD197DAE36F808A2E5A4C5BF25DD580E52B1C39A8B037" "D2067836DC4BC64F66998A3ECD197DAE36F808A2E5A4C5BF25DD580E52B1C39A8B037"
"72BF82D58929766F2DA04F0E616F92B3A0EB75661B8FF5DE1EB807C990F9E6BA991C8" "72BF82D58929766F2DA04F0E616F92B3A0EB75661B8FF5DE1EB807C990F9E6BA991C8"
@@ -1183,7 +1170,7 @@ UsageInfo kUsageInfoTestData[] = {
"E103904BBE4C031A6483858FBAD74DACD01711F7B882749FFFBA0DB6C7D7109D82989" "E103904BBE4C031A6483858FBAD74DACD01711F7B882749FFFBA0DB6C7D7109D82989"
"C7D4DB5A0F1E7506AC24C89CECAF231EFF99F96AD76E57DABDD3C2DFBA7BAA869A771" "C7D4DB5A0F1E7506AC24C89CECAF231EFF99F96AD76E57DABDD3C2DFBA7BAA869A771"
"F561B165987E552824B0C914E708E425C3"), "F561B165987E552824B0C914E708E425C3"),
wvcdm::a2bs_hex( a2bs_hex(
"0AB307080210012AAC070AA9070A8001924B035FBDA56AE5EF0ED05A08DE7AECC8ABE" "0AB307080210012AAC070AA9070A8001924B035FBDA56AE5EF0ED05A08DE7AECC8ABE"
"1835E0C4A548F7803937F4C3B4520EB7F3334FFCDFA00DE56408F09D5019FCE87072D" "1835E0C4A548F7803937F4C3B4520EB7F3334FFCDFA00DE56408F09D5019FCE87072D"
"0DC6789817468974B2EA51EE3944B8D7E0A88E4F16EBB80F03BD845231A01E6146841" "0DC6789817468974B2EA51EE3944B8D7E0A88E4F16EBB80F03BD845231A01E6146841"
@@ -1214,12 +1201,12 @@ UsageInfo kUsageInfoTestData[] = {
"771F561B165987E552824B0C914E708E425C3122051C8F84C5713500997DC5B325BAE" "771F561B165987E552824B0C914E708E425C3122051C8F84C5713500997DC5B325BAE"
"D208B224DFAEB2B034E58046A62F503FED6E")}, "D208B224DFAEB2B034E58046A62F503FED6E")},
{// 2 usage info records {// 2 usage info records
wvcdm::a2bs_hex( a2bs_hex(
"7290396E183156BDF830B7BF31BA762CB2675528C9004FD24A61DAFB587ABCF1D36F8" "7290396E183156BDF830B7BF31BA762CB2675528C9004FD24A61DAFB587ABCF1D36F8"
"7795EE0B3DA0B425616A66C82349B2E3BB8841C1335536865F919ED2AE671487B608B" "7795EE0B3DA0B425616A66C82349B2E3BB8841C1335536865F919ED2AE671487B608B"
"21A362D888E0AB4F7AB7175B82F108617C3503F175435788AECAF7FFBFE76995D93CD" "21A362D888E0AB4F7AB7175B82F108617C3503F175435788AECAF7FFBFE76995D93CD"
"79424A843A247A8D8A6054A5B5404C9C057AACAD91A203229"), "79424A843A247A8D8A6054A5B5404C9C057AACAD91A203229"),
wvcdm::a2bs_hex( a2bs_hex(
"3478A2D76DEB90BE713B03A11037EA7C305D1AF65099E3F2B92C4D4443A8F481C1177" "3478A2D76DEB90BE713B03A11037EA7C305D1AF65099E3F2B92C4D4443A8F481C1177"
"DEF0A3CB49BA5F1448A10AF1207AD2D361B4A1F961B4B1F215B76A9A5005B414EF45E" "DEF0A3CB49BA5F1448A10AF1207AD2D361B4A1F961B4B1F215B76A9A5005B414EF45E"
"AFBCF2636ABFC01413B27DD11871103579F8C041A799E22888D9ADB798E92A5E29BC4" "AFBCF2636ABFC01413B27DD11871103579F8C041A799E22888D9ADB798E92A5E29BC4"
@@ -1229,7 +1216,7 @@ UsageInfo kUsageInfoTestData[] = {
"D0FBAF284C64FFD97A146B76B3F37B576FC091C03E2222FBD24C2211344B7E2417EFC" "D0FBAF284C64FFD97A146B76B3F37B576FC091C03E2222FBD24C2211344B7E2417EFC"
"36C4A54DCCC460CF810E7EA8AC6386D6AB567C819FED88A22CE55EF9BBE62C2CBC7AE" "36C4A54DCCC460CF810E7EA8AC6386D6AB567C819FED88A22CE55EF9BBE62C2CBC7AE"
"EDE5E5A69FF3472418CE2F4514496C59D26E72F3BFE0131F"), "EDE5E5A69FF3472418CE2F4514496C59D26E72F3BFE0131F"),
wvcdm::a2bs_hex( a2bs_hex(
"C45FDCB3296A0EBE24FF381E027E6E2EF1AC289C67D3B858330669A81E8131583D2F1" "C45FDCB3296A0EBE24FF381E027E6E2EF1AC289C67D3B858330669A81E8131583D2F1"
"40FD64615BDED0ED8316ABFD9C7E887433E1CAA6EA8E0C4F87ADB2A7FC3CF6FF87A7F" "40FD64615BDED0ED8316ABFD9C7E887433E1CAA6EA8E0C4F87ADB2A7FC3CF6FF87A7F"
"02AFF03BF5DB640AD8DDB572C41532E673618DCD8C33EF2BFE4E25EE821DF7D742B09" "02AFF03BF5DB640AD8DDB572C41532E673618DCD8C33EF2BFE4E25EE821DF7D742B09"
@@ -1245,7 +1232,7 @@ UsageInfo kUsageInfoTestData[] = {
"9D4D0AA2B358990F244BA76C8E40791D29A0C63C9EF620B97FDFFA9B671E5A65AFCC1" "9D4D0AA2B358990F244BA76C8E40791D29A0C63C9EF620B97FDFFA9B671E5A65AFCC1"
"C94CAACE0443E9D91F14028935BEA3988831BEBBFD3EB7C3A5AC9605B3534712A0912" "C94CAACE0443E9D91F14028935BEA3988831BEBBFD3EB7C3A5AC9605B3534712A0912"
"4345ACB09665E357E58946871BC140D365"), "4345ACB09665E357E58946871BC140D365"),
wvcdm::a2bs_hex( a2bs_hex(
"0ADF0E080210012AD80E0AA9070A8001924B035FBDA56AE5EF0ED05A08DE7AECC8ABE" "0ADF0E080210012AD80E0AA9070A8001924B035FBDA56AE5EF0ED05A08DE7AECC8ABE"
"1835E0C4A548F7803937F4C3B4520EB7F3334FFCDFA00DE56408F09D5019FCE87072D" "1835E0C4A548F7803937F4C3B4520EB7F3334FFCDFA00DE56408F09D5019FCE87072D"
"0DC6789817468974B2EA51EE3944B8D7E0A88E4F16EBB80F03BD845231A01E6146841" "0DC6789817468974B2EA51EE3944B8D7E0A88E4F16EBB80F03BD845231A01E6146841"
@@ -1303,12 +1290,12 @@ UsageInfo kUsageInfoTestData[] = {
"5AC9605B3534712A09124345ACB09665E357E58946871BC140D3651220464E4A1BB23" "5AC9605B3534712A09124345ACB09665E357E58946871BC140D3651220464E4A1BB23"
"1A5B0287888B34CA0A8CF5396EB2B8313377DC5ED5C41A9B389A9")}, "1A5B0287888B34CA0A8CF5396EB2B8313377DC5ED5C41A9B389A9")},
{// 3 usage info records {// 3 usage info records
wvcdm::a2bs_hex( a2bs_hex(
"983358221FB8DBF892047F00AA661F217EEC4E7A1626E8F98E025509E4D65A685E7D9" "983358221FB8DBF892047F00AA661F217EEC4E7A1626E8F98E025509E4D65A685E7D9"
"B169B98B16934F6E43E0E0E854A3FA9EB8E9A9D08E9D9B3A6C766AA44F7C655879BA2" "B169B98B16934F6E43E0E0E854A3FA9EB8E9A9D08E9D9B3A6C766AA44F7C655879BA2"
"DF5F38732FB7EDCA66D8C13A855B15E32CC9389B7DD119BA1F2417825FF1F52970F8E" "DF5F38732FB7EDCA66D8C13A855B15E32CC9389B7DD119BA1F2417825FF1F52970F8E"
"985D34DD353D2AC8B24267353E5B8406C098427C4559A90CC"), "985D34DD353D2AC8B24267353E5B8406C098427C4559A90CC"),
wvcdm::a2bs_hex( a2bs_hex(
"483EAC68243092009D06FAB41DB594ACB22E068C9524810758ECFF8BAB7E1B1ACA988" "483EAC68243092009D06FAB41DB594ACB22E068C9524810758ECFF8BAB7E1B1ACA988"
"C3987023F01EFEC11529C7326279742E805E755A08EBBD9AA322F305805BE1166AB45" "C3987023F01EFEC11529C7326279742E805E755A08EBBD9AA322F305805BE1166AB45"
"CB156FB0A9E6734371F4028707EE01CF2FB08465707E7E5613DD90D74B0D02536E26C" "CB156FB0A9E6734371F4028707EE01CF2FB08465707E7E5613DD90D74B0D02536E26C"
@@ -1318,7 +1305,7 @@ UsageInfo kUsageInfoTestData[] = {
"6FC6C9F86255FBF70DF233F2665D604355BF9740A3B755521102E0B485C5CCCA607A9" "6FC6C9F86255FBF70DF233F2665D604355BF9740A3B755521102E0B485C5CCCA607A9"
"A1BEB757BEDEF12327C637D17D6401E3756719F99BBE69B9CE4C8E47C2AC771F35A8E" "A1BEB757BEDEF12327C637D17D6401E3756719F99BBE69B9CE4C8E47C2AC771F35A8E"
"E3FC4D58B2B2269CF85728E4DA7231BC8F0FD7C50E2A1EE9"), "E3FC4D58B2B2269CF85728E4DA7231BC8F0FD7C50E2A1EE9"),
wvcdm::a2bs_hex( a2bs_hex(
"5826D3A95F78879292612BCE06D845D64285CD45A7EAA6C87A9DBC3290B0B6AC95315" "5826D3A95F78879292612BCE06D845D64285CD45A7EAA6C87A9DBC3290B0B6AC95315"
"809F8CC7938768F9BD342C62CD4CE055866394489D955247CB0535001D50EFF4FEDF0" "809F8CC7938768F9BD342C62CD4CE055866394489D955247CB0535001D50EFF4FEDF0"
"9501C58569B1EB9AA2305A113A5F4D4524AD34148A2DC48D2F522937F44A57FC76F57" "9501C58569B1EB9AA2305A113A5F4D4524AD34148A2DC48D2F522937F44A57FC76F57"
@@ -1334,7 +1321,7 @@ UsageInfo kUsageInfoTestData[] = {
"0FF37DF85BE23D58C17379FEC08DC0648236A107AE66178EEBF78F05F3B898424FA02" "0FF37DF85BE23D58C17379FEC08DC0648236A107AE66178EEBF78F05F3B898424FA02"
"668B51F838AFA90D367B5CB425372D8CC3790BEA8AFB8795251FA09340D85A7F0B003" "668B51F838AFA90D367B5CB425372D8CC3790BEA8AFB8795251FA09340D85A7F0B003"
"134C838F08BB1054D18404C3F69130700E"), "134C838F08BB1054D18404C3F69130700E"),
wvcdm::a2bs_hex( a2bs_hex(
"0A8B16080210012A84160AA9070A8001924B035FBDA56AE5EF0ED05A08DE7AECC8ABE" "0A8B16080210012A84160AA9070A8001924B035FBDA56AE5EF0ED05A08DE7AECC8ABE"
"1835E0C4A548F7803937F4C3B4520EB7F3334FFCDFA00DE56408F09D5019FCE87072D" "1835E0C4A548F7803937F4C3B4520EB7F3334FFCDFA00DE56408F09D5019FCE87072D"
"0DC6789817468974B2EA51EE3944B8D7E0A88E4F16EBB80F03BD845231A01E6146841" "0DC6789817468974B2EA51EE3944B8D7E0A88E4F16EBB80F03BD845231A01E6146841"
@@ -1422,8 +1409,6 @@ UsageInfo kUsageInfoTestData[] = {
const std::string kTestOrigin = "com.google"; const std::string kTestOrigin = "com.google";
} // namespace
class MockFile : public File { class MockFile : public File {
public: public:
MOCK_METHOD2(Open, bool(const std::string&, int flags)); MOCK_METHOD2(Open, bool(const std::string&, int flags));
@@ -1442,6 +1427,22 @@ class MockFile : public File {
MOCK_METHOD1(FileSize, ssize_t(const std::string&)); MOCK_METHOD1(FileSize, ssize_t(const std::string&));
}; };
} // namespace
// gmock methods
using ::testing::_;
using ::testing::AllOf;
using ::testing::Eq;
using ::testing::Gt;
using ::testing::HasSubstr;
using ::testing::InSequence;
using ::testing::NotNull;
using ::testing::Return;
using ::testing::ReturnArg;
using ::testing::SetArgPointee;
using ::testing::SetArrayArgument;
using ::testing::StrEq;
class DeviceFilesTest : public ::testing::Test { class DeviceFilesTest : public ::testing::Test {
protected: protected:
virtual void SetUp() { virtual void SetUp() {
@@ -2129,7 +2130,6 @@ TEST_F(DeviceFilesTest, ReserveLicenseIdsDoesNotUseFileSystem) {
MockFile file; MockFile file;
EXPECT_CALL(file, IsDirectory(StrEq(device_base_path_))).Times(0); EXPECT_CALL(file, IsDirectory(StrEq(device_base_path_))).Times(0);
EXPECT_CALL(file, CreateDirectory(_)).Times(0); EXPECT_CALL(file, CreateDirectory(_)).Times(0);
EXPECT_CALL(file, Open(_, _)).Times(0); EXPECT_CALL(file, Open(_, _)).Times(0);
EXPECT_CALL(file, Write(_, _)).Times(0); EXPECT_CALL(file, Write(_, _)).Times(0);
EXPECT_CALL(file, Close()).Times(0); EXPECT_CALL(file, Close()).Times(0);

View File

@@ -6,6 +6,8 @@
#include "properties.h" #include "properties.h"
#include "test_vectors.h" #include "test_vectors.h"
namespace wvcdm {
namespace { namespace {
const std::string kTestDirName = "test_dir"; const std::string kTestDirName = "test_dir";
const std::string kTestFileName = "test.txt"; const std::string kTestFileName = "test.txt";
@@ -14,8 +16,6 @@ const std::string kTestFileNameExt = ".txt";
const std::string kWildcard = "*"; const std::string kWildcard = "*";
} // namespace } // namespace
namespace wvcdm {
class FileTest : public testing::Test { class FileTest : public testing::Test {
protected: protected:
virtual void SetUp() { CreateTestDir(); } virtual void SetUp() { CreateTestDir(); }

View File

@@ -16,6 +16,8 @@
#include "log.h" #include "log.h"
namespace wvcdm {
namespace { namespace {
// Helper function to tokenize a string. This makes it easier to avoid silly // Helper function to tokenize a string. This makes it easier to avoid silly
@@ -99,8 +101,6 @@ bool SocketWait(int fd, bool for_read, int timeout_in_ms) {
} // namespace } // namespace
namespace wvcdm {
// Parses the URL and extracts all relevant information. // Parses the URL and extracts all relevant information.
// static // static
bool HttpSocket::ParseUrl(const std::string& url, std::string* scheme, bool HttpSocket::ParseUrl(const std::string& url, std::string* scheme,

View File

@@ -8,6 +8,8 @@
#include "string_conversions.h" #include "string_conversions.h"
#include "url_request.h" #include "url_request.h"
namespace wvcdm {
namespace { namespace {
// Arbitrary URL for tests. // Arbitrary URL for tests.
const std::string kHttpsTestServer("https://www.google.com"); const std::string kHttpsTestServer("https://www.google.com");
@@ -21,8 +23,6 @@ const int kHttpBufferSize = 4096;
const int kTimeout = 3000; const int kTimeout = 3000;
} }
namespace wvcdm {
class HttpSocketTest : public testing::Test { class HttpSocketTest : public testing::Test {
public: public:
HttpSocketTest() {} HttpSocketTest() {}
@@ -204,6 +204,7 @@ TEST_F(HttpSocketTest, RoundTripTest) {
} // namespace wvcdm } // namespace wvcdm
int main(int argc, char** argv) { int main(int argc, char** argv) {
using namespace wvcdm;
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
std::string temp; std::string temp;

View File

@@ -10,9 +10,11 @@
// [1] http://dashif.org/identifiers/content-protection/ // [1] http://dashif.org/identifiers/content-protection/
// [2] http://www.w3.org/TR/encrypted-media/cenc-format.html#common-system // [2] http://www.w3.org/TR/encrypted-media/cenc-format.html#common-system
namespace wvcdm {
namespace { namespace {
const std::string kWidevinePssh = wvcdm::a2bs_hex( const std::string kWidevinePssh = a2bs_hex(
// Widevine PSSH box // Widevine PSSH box
"00000042" // atom size "00000042" // atom size
"70737368" // atom type="pssh" "70737368" // atom type="pssh"
@@ -22,7 +24,7 @@ const std::string kWidevinePssh = wvcdm::a2bs_hex(
// data: // data:
"08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031"); "08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031");
const std::string kWidevinePsshFirst = wvcdm::a2bs_hex( const std::string kWidevinePsshFirst = a2bs_hex(
// first PSSH box, Widevine // first PSSH box, Widevine
"00000042" // atom size "00000042" // atom size
"70737368" // atom type "pssh" "70737368" // atom type "pssh"
@@ -41,7 +43,7 @@ const std::string kWidevinePsshFirst = wvcdm::a2bs_hex(
// arbitrary data: // arbitrary data:
"0102030405060708"); "0102030405060708");
const std::string kWidevinePsshAfterV0Pssh = wvcdm::a2bs_hex( const std::string kWidevinePsshAfterV0Pssh = a2bs_hex(
// first PSSH box, Playready [1] // first PSSH box, Playready [1]
"00000028" // atom size "00000028" // atom size
"70737368" // atom type "pssh" "70737368" // atom type "pssh"
@@ -60,7 +62,7 @@ const std::string kWidevinePsshAfterV0Pssh = wvcdm::a2bs_hex(
// data: // data:
"08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031"); "08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031");
const std::string kWidevinePsshAfterNonZeroFlags = wvcdm::a2bs_hex( const std::string kWidevinePsshAfterNonZeroFlags = a2bs_hex(
// first PSSH box, Playready [1] // first PSSH box, Playready [1]
"00000028" // atom size "00000028" // atom size
"70737368" // atom type "pssh" "70737368" // atom type "pssh"
@@ -79,7 +81,7 @@ const std::string kWidevinePsshAfterNonZeroFlags = wvcdm::a2bs_hex(
// data: // data:
"08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031"); "08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031");
const std::string kWidevinePsshAfterV1Pssh = wvcdm::a2bs_hex( const std::string kWidevinePsshAfterV1Pssh = a2bs_hex(
// first PSSH box, generic CENC [2] // first PSSH box, generic CENC [2]
"00000044" // atom size "00000044" // atom size
"70737368" // atom type "pssh" "70737368" // atom type "pssh"
@@ -99,7 +101,7 @@ const std::string kWidevinePsshAfterV1Pssh = wvcdm::a2bs_hex(
// data: // data:
"08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031"); "08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031");
const std::string kWidevineV1Pssh = wvcdm::a2bs_hex( const std::string kWidevineV1Pssh = a2bs_hex(
// Widevine PSSH box, v1 format // Widevine PSSH box, v1 format
"00000044" // atom size "00000044" // atom size
"70737368" // atom type "pssh" "70737368" // atom type "pssh"
@@ -112,7 +114,7 @@ const std::string kWidevineV1Pssh = wvcdm::a2bs_hex(
// data: // data:
"08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031"); "08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031");
const std::string kOtherBoxFirst = wvcdm::a2bs_hex( const std::string kOtherBoxFirst = a2bs_hex(
// first box, not a PSSH box // first box, not a PSSH box
"00000018" // atom size "00000018" // atom size
"77686174" // atom type "what" "77686174" // atom type "what"
@@ -127,7 +129,7 @@ const std::string kOtherBoxFirst = wvcdm::a2bs_hex(
// data: // data:
"08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031"); "08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031");
const std::string kZeroSizedPsshBox = wvcdm::a2bs_hex( const std::string kZeroSizedPsshBox = a2bs_hex(
// Widevine PSSH box // Widevine PSSH box
"00000000" // atom size (whole buffer) "00000000" // atom size (whole buffer)
"70737368" // atom type="pssh" "70737368" // atom type="pssh"
@@ -141,8 +143,6 @@ class InitializationDataTest : public ::testing::TestWithParam<std::string> {};
} // namespace } // namespace
namespace wvcdm {
TEST_P(InitializationDataTest, Parse) { TEST_P(InitializationDataTest, Parse) {
InitializationData init_data(ISO_BMFF_VIDEO_MIME_TYPE, GetParam()); InitializationData init_data(ISO_BMFF_VIDEO_MIME_TYPE, GetParam());
EXPECT_FALSE(init_data.IsEmpty()); EXPECT_FALSE(init_data.IsEmpty());

View File

@@ -5,7 +5,9 @@
namespace wvcdm { namespace wvcdm {
static const std::string kTwoBlankLines("\r\n\r\n"); namespace {
const std::string kTwoBlankLines("\r\n\r\n");
} // namespace
size_t LicenseRequest::FindHeaderEndPosition( size_t LicenseRequest::FindHeaderEndPosition(
const std::string& response) const { const std::string& response) const {

View File

@@ -12,26 +12,28 @@
#include "string_conversions.h" #include "string_conversions.h"
#include "wv_cdm_constants.h" #include "wv_cdm_constants.h"
namespace wvcdm {
namespace { namespace {
const uint32_t kAesBlockSize = 16; const uint32_t kAesBlockSize = 16;
const std::string kAesKey = wvcdm::a2bs_hex("000102030405060708090a0b0c0d0e0f"); const std::string kAesKey = a2bs_hex("000102030405060708090a0b0c0d0e0f");
const std::string kAesIv = wvcdm::a2bs_hex("000102030405060708090a0b0c0d0e0f"); const std::string kAesIv = a2bs_hex("000102030405060708090a0b0c0d0e0f");
const std::string kCencInitDataHdr = wvcdm::a2bs_hex( const std::string kCencInitDataHdr = a2bs_hex(
"00000042" // blob size "00000042" // blob size
"70737368" // "pssh" "70737368" // "pssh"
"00000000" // flags "00000000" // flags
"edef8ba979d64acea3c827dcd51d21ed" // Widevine system id "edef8ba979d64acea3c827dcd51d21ed" // Widevine system id
"00000022"); // pssh data size "00000022"); // pssh data size
const std::string kCencPssh = wvcdm::a2bs_hex( const std::string kCencPssh = a2bs_hex(
"08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031"); "08011a0d7769646576696e655f74657374220f73747265616d696e675f636c697031");
const std::string kCdmSessionId = "sid2"; const std::string kCdmSessionId = "sid2";
const std::string kCryptoSessionId = "id2"; const std::string kCryptoSessionId = "id2";
const std::string kCryptoRequestId = wvcdm::a2bs_hex( const std::string kCryptoRequestId = a2bs_hex(
"4341444542353737444337393044394330313030303030303030303030303030"); "4341444542353737444337393044394330313030303030303030303030303030");
const uint32_t kNonce = 0x49e81305; const uint32_t kNonce = 0x49e81305;
const int64_t kLicenseStartTime = 1413517500; // ~ 01/01/2013 const int64_t kLicenseStartTime = 1413517500; // ~ 01/01/2013
const std::string kToken = wvcdm::a2bs_hex( const std::string kToken = a2bs_hex(
"0AAE02080212107E0A892DEEB021E7AF696B938BB1D5B1188B85AD9D05228E023082010A02" "0AAE02080212107E0A892DEEB021E7AF696B938BB1D5B1188B85AD9D05228E023082010A02"
"82010100DBEDF2BFB0EC98213766E65049B9AB176FA4B1FBFBB2A0C96C87D9F2B895E0ED77" "82010100DBEDF2BFB0EC98213766E65049B9AB176FA4B1FBFBB2A0C96C87D9F2B895E0ED77"
"93BDA057E6BC3E0CA2348BC6831E03609445CA4D418CB98EAC98FFC87AB2364CE76BA26BEE" "93BDA057E6BC3E0CA2348BC6831E03609445CA4D418CB98EAC98FFC87AB2364CE76BA26BEE"
@@ -67,7 +69,7 @@ const std::string kToken = wvcdm::a2bs_hex(
"8CD5A9DF6E3D3A99B806F6D60991358C5BE77117D4F3168F3348E9A048539F892F4D783152" "8CD5A9DF6E3D3A99B806F6D60991358C5BE77117D4F3168F3348E9A048539F892F4D783152"
"C7A8095224AA56B78C5CF7BD1AB1B179C0C0D11E3C3BAC84C141A00191321E3ACC17242E68" "C7A8095224AA56B78C5CF7BD1AB1B179C0C0D11E3C3BAC84C141A00191321E3ACC17242E68"
"3C"); "3C");
const std::string kLicenseRequestSignature = wvcdm::a2bs_hex( const std::string kLicenseRequestSignature = a2bs_hex(
"4A560ACFED04787BE0D29D7396234FA2E11D6DD0B22F87FD77AEAEDAA6C8FE54AD9859AE4E" "4A560ACFED04787BE0D29D7396234FA2E11D6DD0B22F87FD77AEAEDAA6C8FE54AD9859AE4E"
"C9F12BCB947892D906DAEC1AD78CABD6F9D479CCF91AF5587DB6FC29CBEBF9C338BAF17790" "C9F12BCB947892D906DAEC1AD78CABD6F9D479CCF91AF5587DB6FC29CBEBF9C338BAF17790"
"90980B1F3333BC901CDBF877490C7B85DB2BF9BC559C98450C6F1E8B2E192959F59CC53BD4" "90980B1F3333BC901CDBF877490C7B85DB2BF9BC559C98450C6F1E8B2E192959F59CC53BD4"
@@ -75,22 +77,6 @@ const std::string kLicenseRequestSignature = wvcdm::a2bs_hex(
"8D24103EB15C63C227A0D57A9D90F5A409D2D55147EE10A35AE291D2D725C7F161FF827221" "8D24103EB15C63C227A0D57A9D90F5A409D2D55147EE10A35AE291D2D725C7F161FF827221"
"9AE18B91516E0CDD0B581590DDDEA2A2527E2C9ABA273629B586A9D22D451A827E332CFC3E" "9AE18B91516E0CDD0B581590DDDEA2A2527E2C9ABA273629B586A9D22D451A827E332CFC3E"
"9BEDB6CF3D8713F9E11675DF1F5DB9038DBBECAB9D1683F8722CAF6E18EC8C04AEE5"); "9BEDB6CF3D8713F9E11675DF1F5DB9038DBBECAB9D1683F8722CAF6E18EC8C04AEE5");
} // namespace
namespace wvcdm {
// Protobuf generated classes
using video_widevine_server::sdk::LicenseRequest_ContentIdentification;
using video_widevine_server::sdk::ClientIdentification;
using video_widevine_server::sdk::LicenseRequest;
using video_widevine_server::sdk::SignedMessage;
// gmock methods
using ::testing::_;
using ::testing::Eq;
using ::testing::NotNull;
using ::testing::Return;
using ::testing::SetArgPointee;
class MockCryptoSession : public CryptoSession { class MockCryptoSession : public CryptoSession {
public: public:
@@ -122,6 +108,21 @@ class MockInitializationData : public InitializationData {
MOCK_METHOD0(is_cenc, bool()); MOCK_METHOD0(is_cenc, bool());
}; };
} // namespace
// Protobuf generated classes
using video_widevine_server::sdk::LicenseRequest_ContentIdentification;
using video_widevine_server::sdk::ClientIdentification;
using video_widevine_server::sdk::LicenseRequest;
using video_widevine_server::sdk::SignedMessage;
// gmock methods
using ::testing::_;
using ::testing::Eq;
using ::testing::NotNull;
using ::testing::Return;
using ::testing::SetArgPointee;
class CdmLicenseTest : public ::testing::Test { class CdmLicenseTest : public ::testing::Test {
protected: protected:
virtual void SetUp() { virtual void SetUp() {
@@ -281,4 +282,5 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
license_request.protocol_version()); license_request.protocol_version());
EXPECT_EQ(kNonce, license_request.key_control_nonce()); EXPECT_EQ(kNonce, license_request.key_control_nonce());
} }
}
} // namespace wvcdm

View File

@@ -45,13 +45,13 @@ const OutputProtection::HDCP kHdcpConstraint = OutputProtection::HDCP_V2_1;
const int64_t kHdcpInterval = 10; const int64_t kHdcpInterval = 10;
} // namespace
class HdcpOnlyMockCryptoSession : public CryptoSession { class HdcpOnlyMockCryptoSession : public CryptoSession {
public: public:
MOCK_METHOD2(GetHdcpCapabilities, bool(HdcpCapability*, HdcpCapability*)); MOCK_METHOD2(GetHdcpCapabilities, bool(HdcpCapability*, HdcpCapability*));
}; };
} // namespace
ACTION_P2(IncrementAndReturnPointee, p, a) { ACTION_P2(IncrementAndReturnPointee, p, a) {
*p += a; *p += a;
return *p; return *p;

View File

@@ -16,6 +16,8 @@
#include "wv_cdm_event_listener.h" #include "wv_cdm_event_listener.h"
#include "wv_cdm_constants.h" #include "wv_cdm_constants.h"
namespace wvcdm {
namespace { namespace {
const int64_t kDurationUnlimited = 0; const int64_t kDurationUnlimited = 0;
const int64_t kLicenseStartTime = 1413517500; // ~ 01/01/2013 const int64_t kLicenseStartTime = 1413517500; // ~ 01/01/2013
@@ -37,36 +39,16 @@ const int64_t kHighDuration =
kOfflineLicenseDuration); kOfflineLicenseDuration);
const char* kRenewalServerUrl = const char* kRenewalServerUrl =
"https://test.google.com/license/GetCencLicense"; "https://test.google.com/license/GetCencLicense";
const wvcdm::KeyId kKeyId = "357adc89f1673433c36c621f1b5c41ee"; const KeyId kKeyId = "357adc89f1673433c36c621f1b5c41ee";
const wvcdm::KeyId kAnotherKeyId = "another_key_id"; const KeyId kAnotherKeyId = "another_key_id";
const wvcdm::KeyId kSomeRandomKeyId = "some_random_key_id"; const KeyId kSomeRandomKeyId = "some_random_key_id";
const wvcdm::CdmSessionId kSessionId = "mock_session_id"; const CdmSessionId kSessionId = "mock_session_id";
int64_t GetLicenseRenewalDelay(int64_t license_duration) { int64_t GetLicenseRenewalDelay(int64_t license_duration) {
return license_duration > kLicenseRenewalPeriod return license_duration > kLicenseRenewalPeriod
? license_duration - kLicenseRenewalPeriod ? license_duration - kLicenseRenewalPeriod
: 0; : 0;
} }
} // namespace
namespace wvcdm {
// protobuf generated classes.
using video_widevine_server::sdk::License;
using video_widevine_server::sdk::License_Policy;
using video_widevine_server::sdk::LicenseIdentification;
using video_widevine_server::sdk::STREAMING;
using video_widevine_server::sdk::OFFLINE;
// gmock methods
using ::testing::_;
using ::testing::AtLeast;
using ::testing::InSequence;
using ::testing::MockFunction;
using ::testing::Pair;
using ::testing::Return;
using ::testing::StrictMock;
using ::testing::UnorderedElementsAre;
class MockCdmEventListener : public WvCdmEventListener { class MockCdmEventListener : public WvCdmEventListener {
public: public:
@@ -85,6 +67,25 @@ class MockMaxResEngine : public MaxResEngine {
MOCK_METHOD1(CanDecrypt, bool(const KeyId& key_id)); MOCK_METHOD1(CanDecrypt, bool(const KeyId& key_id));
}; };
} // namespace
// protobuf generated classes.
using video_widevine_server::sdk::License;
using video_widevine_server::sdk::License_Policy;
using video_widevine_server::sdk::LicenseIdentification;
using video_widevine_server::sdk::STREAMING;
using video_widevine_server::sdk::OFFLINE;
// gmock methods
using ::testing::_;
using ::testing::AtLeast;
using ::testing::InSequence;
using ::testing::MockFunction;
using ::testing::Pair;
using ::testing::Return;
using ::testing::StrictMock;
using ::testing::UnorderedElementsAre;
class PolicyEngineTest : public ::testing::Test { class PolicyEngineTest : public ::testing::Test {
protected: protected:
virtual void SetUp() { virtual void SetUp() {
@@ -1906,4 +1907,4 @@ TEST_F(PolicyEngineQueryTest, QuerySuccess_RenewWithFutureStartTime) {
EXPECT_EQ(kRenewalServerUrl, query_info[QUERY_KEY_RENEWAL_SERVER_URL]); EXPECT_EQ(kRenewalServerUrl, query_info[QUERY_KEY_RENEWAL_SERVER_URL]);
} }
} // wvcdm } // namespace wvcdm

View File

@@ -9,6 +9,8 @@
#include "log.h" #include "log.h"
#include "string_conversions.h" #include "string_conversions.h"
namespace wvcdm {
namespace { namespace {
const int kReadBufferSize = 1024; const int kReadBufferSize = 1024;
@@ -69,8 +71,6 @@ void ConcatenateChunkedResponse(const std::string http_response,
} // namespace } // namespace
namespace wvcdm {
UrlRequest::UrlRequest(const std::string& url) UrlRequest::UrlRequest(const std::string& url)
: is_connected_(false), socket_(url) { : is_connected_(false), socket_(url) {
Reconnect(); Reconnect();

View File

@@ -2,8 +2,8 @@
// //
// Timer - Platform independent interface for a Timer class // Timer - Platform independent interface for a Timer class
// //
#ifndef WVCDM_CORE_TIMER_H_ #ifndef CDM_BASE_CORE_TIMER_H_
#define WVCDM_CORE_TIMER_H_ #define CDM_BASE_CORE_TIMER_H_
#include "wv_cdm_types.h" #include "wv_cdm_types.h"
@@ -48,4 +48,4 @@ class Timer {
} // namespace wvcdm } // namespace wvcdm
#endif // WVCDM_CORE_TIMER_H_ #endif // CDM_BASE_CORE_TIMER_H_

View File

@@ -49,7 +49,8 @@ CdmResponseType WvContentDecryptionModule::OpenSession(
} }
return cdm_engine_->OpenSession(key_system, property_set, origin, return cdm_engine_->OpenSession(key_system, property_set, origin,
event_listener, session_id); event_listener, NULL /* forced_session_id */,
session_id);
} }
CdmResponseType WvContentDecryptionModule::CloseSession( CdmResponseType WvContentDecryptionModule::CloseSession(

View File

@@ -52,7 +52,7 @@ test_src_dir := .
include $(LOCAL_PATH)/unit-test.mk include $(LOCAL_PATH)/unit-test.mk
test_name := timer_unittest test_name := timer_unittest
test_src_dir := ../core/test test_src_dir := .
include $(LOCAL_PATH)/unit-test.mk include $(LOCAL_PATH)/unit-test.mk
test_name := test_name :=

View File

@@ -176,6 +176,7 @@ enum {
kLicenseRequestNonceGenerationError = ERROR_DRM_VENDOR_MIN + 161, kLicenseRequestNonceGenerationError = ERROR_DRM_VENDOR_MIN + 161,
kLicenseRequestSigningError = ERROR_DRM_VENDOR_MIN + 162, kLicenseRequestSigningError = ERROR_DRM_VENDOR_MIN + 162,
kEmptyLicenseRequest = ERROR_DRM_VENDOR_MIN + 163, kEmptyLicenseRequest = ERROR_DRM_VENDOR_MIN + 163,
kDuplicateSessionIdSpecified = ERROR_DRM_VENDOR_MIN + 164,
kLicenseRenewalProhibited = ERROR_DRM_VENDOR_MIN + 165, kLicenseRenewalProhibited = ERROR_DRM_VENDOR_MIN + 165,
kErrorWVDrmMaxErrorUsed = ERROR_DRM_VENDOR_MIN + 165, kErrorWVDrmMaxErrorUsed = ERROR_DRM_VENDOR_MIN + 165,

View File

@@ -341,6 +341,8 @@ static android::status_t mapCdmResponseType(wvcdm::CdmResponseType res) {
return kLicenseRequestSigningError; return kLicenseRequestSigningError;
case wvcdm::EMPTY_LICENSE_REQUEST: case wvcdm::EMPTY_LICENSE_REQUEST:
return kEmptyLicenseRequest; return kEmptyLicenseRequest;
case wvcdm::DUPLICATE_SESSION_ID_SPECIFIED:
return kDuplicateSessionIdSpecified;
case wvcdm::LICENSE_RENEWAL_PROHIBITED: case wvcdm::LICENSE_RENEWAL_PROHIBITED:
return kLicenseRenewalProhibited; return kLicenseRenewalProhibited;
case wvcdm::UNKNOWN_ERROR: case wvcdm::UNKNOWN_ERROR: