Source release v2.1.2-0-773 + third_party libs
Change-Id: Ia07608577b65b301c22a8ff4bf7f743c2d3f9274
This commit is contained in:
@@ -47,8 +47,8 @@ double GetCurrentTestTime() {
|
||||
return tv.tv_sec;
|
||||
}
|
||||
|
||||
using wvcdm::kStringPairs;
|
||||
using wvcdm::kVectorPairs;
|
||||
using wvcdm::StringPairs;
|
||||
using wvcdm::VectorPairs;
|
||||
|
||||
// These classes below are naive implementation of the abstract classes defined
|
||||
// in the CDM interface (content_decryptiom_module.h), which are used for tests
|
||||
@@ -357,8 +357,8 @@ class TestHost : public cdm::Host, public IHostTime {
|
||||
cdm::ContentDecryptionModule* host_cdm_ptr_;
|
||||
|
||||
// These are containers for the platform sharing data.
|
||||
std::set<kStringPairs> platform_strings_set_;
|
||||
std::set<kVectorPairs> platform_vectors_set_;
|
||||
std::set<StringPairs> platform_strings_set_;
|
||||
std::set<VectorPairs> platform_vectors_set_;
|
||||
TestHostFile test_host_file_;
|
||||
void LoadPersistentValues();
|
||||
SimplePThread simple_thread_;
|
||||
@@ -473,12 +473,12 @@ void TestHost::GetPrivateData(int32_t* instance,
|
||||
|
||||
int TestHost::GetPlatformString(const std::string& name,
|
||||
std::string* value) {
|
||||
std::set<kStringPairs>::iterator it;
|
||||
std::set<StringPairs>::iterator it;
|
||||
|
||||
for (it = platform_strings_set_.begin();
|
||||
it != platform_strings_set_.end(); ++it) {
|
||||
|
||||
kStringPairs sp = *it;
|
||||
StringPairs sp = *it;
|
||||
std::string x = sp.first;
|
||||
std::string y = sp.second;
|
||||
if (x == name) {
|
||||
@@ -492,14 +492,14 @@ int TestHost::GetPlatformString(const std::string& name,
|
||||
|
||||
int TestHost::SetPlatformString(const std::string& name,
|
||||
const std::string& value) {
|
||||
kStringPairs sp(name, value);
|
||||
StringPairs sp(name, value);
|
||||
platform_strings_set_.insert(sp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int TestHost::PersistPlatformString(const std::string& name,
|
||||
const std::string& value) {
|
||||
kStringPairs sp(name, value);
|
||||
StringPairs sp(name, value);
|
||||
// Write the pairs to a file such that they can be retrieved by
|
||||
// GetPlatformString() even after a power cycle.
|
||||
return 1;
|
||||
@@ -508,17 +508,17 @@ int TestHost::PersistPlatformString(const std::string& name,
|
||||
int TestHost::SetPlatformByteArray(const std::string& name,
|
||||
const std::vector<uint8_t>& value) {
|
||||
// A zero value pair is an erase only.
|
||||
std::set<kVectorPairs>::iterator it;
|
||||
std::set<VectorPairs>::iterator it;
|
||||
for (it = platform_vectors_set_.begin();
|
||||
it != platform_vectors_set_.end(); ++it) {
|
||||
kVectorPairs vp = *it;
|
||||
VectorPairs vp = *it;
|
||||
if (vp.first == name) {
|
||||
platform_vectors_set_.erase(vp);
|
||||
}
|
||||
}
|
||||
|
||||
if (value.size() > 0) {
|
||||
kVectorPairs vp(name, value);
|
||||
VectorPairs vp(name, value);
|
||||
platform_vectors_set_.insert(vp);
|
||||
}
|
||||
|
||||
@@ -540,7 +540,7 @@ int TestHost::PersistPlatformByteArray(const std::string& name,
|
||||
memcpy(&string_buffer[0], &value[0], value.size());
|
||||
test_host_file_.Write(&string_buffer[0], value.size());
|
||||
}
|
||||
kVectorPairs vp(name, value);
|
||||
VectorPairs vp(name, value);
|
||||
|
||||
SetPlatformByteArray(name, value);
|
||||
// open file and persist this so that it can be retrieved as a string/vector
|
||||
@@ -550,11 +550,11 @@ int TestHost::PersistPlatformByteArray(const std::string& name,
|
||||
|
||||
int TestHost::GetPlatformByteArray(const std::string& name,
|
||||
std::vector<uint8_t>* value) {
|
||||
std::set<kVectorPairs>::iterator it;
|
||||
std::set<VectorPairs>::iterator it;
|
||||
for (it = platform_vectors_set_.begin();
|
||||
it != platform_vectors_set_.end(); ++it) {
|
||||
|
||||
kVectorPairs vp = *it;
|
||||
VectorPairs vp = *it;
|
||||
std::string x = vp.first;
|
||||
if (x == name) {
|
||||
*value = vp.second;
|
||||
@@ -693,7 +693,6 @@ std::string g_client_auth;
|
||||
wvcdm::KeyId g_key_id;
|
||||
wvcdm::CdmKeySystem g_key_system;
|
||||
std::string g_license_server;
|
||||
std::string g_port;
|
||||
wvcdm::KeyId g_wrong_key_id;
|
||||
int g_use_full_path = 0; // cannot use boolean in getopt_long
|
||||
|
||||
@@ -735,7 +734,7 @@ class WvCdmApiTest : public testing::Test {
|
||||
|
||||
// emulate pulling a certificate out of persistent storage.
|
||||
static const size_t kPrivacyCertSize = 256;
|
||||
kVectorBytes cert(kPrivacyCertSize);
|
||||
VectorBytes cert(kPrivacyCertSize);
|
||||
for (size_t i = 0; i < cert.size(); i++) {
|
||||
cert[i] = i;
|
||||
}
|
||||
@@ -756,18 +755,19 @@ class WvCdmApiTest : public testing::Test {
|
||||
if (status == cdm::kNeedsDeviceCertificate) {
|
||||
std::string provisioning_server_url;
|
||||
std::string prov_request;
|
||||
if (cdm_->GetProvisioningRequest(&prov_request,
|
||||
&provisioning_server_url) == cdm::kSuccess) {
|
||||
|
||||
UrlRequest url_request(provisioning_server_url,
|
||||
kDefaultHttpsPort, true, true);
|
||||
|
||||
status = cdm_->GetProvisioningRequest(&prov_request,
|
||||
&provisioning_server_url);
|
||||
if (status == cdm::kSuccess) {
|
||||
UrlRequest url_request(provisioning_server_url);
|
||||
url_request.PostCertRequestInQueryString(prov_request);
|
||||
std::string message;
|
||||
int resp_bytes = url_request.GetResponse(&message);
|
||||
|
||||
if (resp_bytes) {
|
||||
if (cdm_->HandleProvisioningResponse(message) == cdm::kSuccess) {
|
||||
std::string message;
|
||||
bool ok = url_request.GetResponse(&message);
|
||||
EXPECT_TRUE(ok);
|
||||
|
||||
if (ok) {
|
||||
status = cdm_->HandleProvisioningResponse(message);
|
||||
if (status == cdm::kSuccess) {
|
||||
status = cdm_->GenerateKeyRequest(NULL, 0,
|
||||
(const uint8_t*)init_data.data(), init_data.length());
|
||||
}
|
||||
@@ -782,7 +782,7 @@ class WvCdmApiTest : public testing::Test {
|
||||
const std::string& client_auth,
|
||||
int expected_response) {
|
||||
// Use secure connection and chunk transfer coding.
|
||||
UrlRequest url_request(server_url + client_auth, g_port, true, true);
|
||||
UrlRequest url_request(server_url + client_auth);
|
||||
if (!url_request.is_connected()) {
|
||||
return "";
|
||||
}
|
||||
@@ -887,20 +887,12 @@ class WvCdmApiTest : public testing::Test {
|
||||
buf.num_subsamples = 1;
|
||||
buf.timestamp = 10;
|
||||
|
||||
TestBuffer* out_buf =
|
||||
dynamic_cast<TestBuffer*>(host_->Allocate(buf.data_size));
|
||||
memset(out_buf->Data(), 0, buf.data_size);
|
||||
|
||||
TestDecryptedBlock output;
|
||||
output.SetDecryptedBuffer(out_buf);
|
||||
|
||||
cdm::Status status;
|
||||
status = cdm_->Decrypt(buf, &output);
|
||||
cdm::Status status = cdm_->Decrypt(buf, &output);
|
||||
|
||||
EXPECT_EQ(cdm::kSuccess, status);
|
||||
EXPECT_EQ(0, memcmp(output.DecryptedBuffer()->Data(), &data.decrypt_data[0],
|
||||
buf.data_size));
|
||||
LOGI("Verbose Acknowledgement of Test Pass!!!\n");
|
||||
}
|
||||
|
||||
// Level 1 / Level 2 payload comes back in the cpu memory as cleartext.
|
||||
@@ -976,22 +968,14 @@ class WvCdmApiTest : public testing::Test {
|
||||
buf.num_subsamples = sub.size();
|
||||
buf.timestamp = 10;
|
||||
|
||||
TestBuffer* out_buf = dynamic_cast<TestBuffer*>(host_->Allocate(
|
||||
buf.data_size));
|
||||
memset(out_buf->Data(), 0, buf.data_size);
|
||||
|
||||
TestDecryptedBlock output;
|
||||
output.SetDecryptedBuffer(out_buf);
|
||||
|
||||
cdm::Status status;
|
||||
status = cdm_->Decrypt(buf, &output);
|
||||
cdm::Status status = cdm_->Decrypt(buf, &output);
|
||||
|
||||
EXPECT_EQ(cdm::kSuccess, status);
|
||||
EXPECT_EQ(
|
||||
0,
|
||||
memcmp(output.DecryptedBuffer()->Data(), &data.decrypt_data[0],
|
||||
buf.data_size));
|
||||
LOGI("Verbose Acknowledgement of Test Pass!!!\n");
|
||||
}
|
||||
|
||||
void DecryptClearSubsampleTestWithMissingSubsampleInfo() {
|
||||
@@ -1064,15 +1048,9 @@ class WvCdmApiTest : public testing::Test {
|
||||
//buf.num_subsamples = sub.size();
|
||||
buf.timestamp = 10;
|
||||
|
||||
TestBuffer* out_buf =
|
||||
dynamic_cast<TestBuffer*>(host_->Allocate(buf.data_size));
|
||||
memset(out_buf->Data(), 0, buf.data_size);
|
||||
|
||||
TestDecryptedBlock output;
|
||||
output.SetDecryptedBuffer(out_buf);
|
||||
|
||||
cdm::Status status;
|
||||
status = cdm_->Decrypt(buf, &output);
|
||||
cdm::Status status = cdm_->Decrypt(buf, &output);
|
||||
EXPECT_EQ(cdm::kDecryptError, status);
|
||||
|
||||
buf.subsamples = &sub[0];
|
||||
@@ -1088,7 +1066,6 @@ class WvCdmApiTest : public testing::Test {
|
||||
buf.subsamples = NULL;
|
||||
status = cdm_->Decrypt(buf, &output);
|
||||
EXPECT_EQ(cdm::kDecryptError, status);
|
||||
LOGI("Verbose Acknowledgement of Test Pass!!!\n");
|
||||
}
|
||||
|
||||
// Level 1 passes encrypted payload straight through. By calling the
|
||||
@@ -1157,8 +1134,6 @@ class WvCdmApiTest : public testing::Test {
|
||||
EXPECT_EQ(cdm::kSuccess, status);
|
||||
status = cdm_->DecryptDecodeAndRenderFrame(buf);
|
||||
EXPECT_EQ(cdm::kSuccess, status);
|
||||
|
||||
LOGI("Verbose Acknowledgement of Level 1 Test Pass!!!\n");
|
||||
}
|
||||
|
||||
// Level 1 passes encrypted payload straight through. By calling the
|
||||
@@ -1240,8 +1215,6 @@ class WvCdmApiTest : public testing::Test {
|
||||
EXPECT_EQ(cdm::kSuccess, status);
|
||||
status = cdm_->DecryptDecodeAndRenderFrame(buf);
|
||||
EXPECT_EQ(cdm::kSuccess, status);
|
||||
|
||||
LOGI("Verbose Acknowledgement of Level 1 Test Pass!!!\n");
|
||||
}
|
||||
|
||||
void WithMissingSubsampleInfoTest() {
|
||||
@@ -1335,8 +1308,6 @@ class WvCdmApiTest : public testing::Test {
|
||||
EXPECT_EQ(cdm::kDecryptError, status);
|
||||
status = cdm_->DecryptDecodeAndRenderFrame(buf);
|
||||
EXPECT_EQ(cdm::kDecryptError, status);
|
||||
|
||||
LOGI("Verbose Acknowledgement of Level 1 Test Pass!!!\n");
|
||||
}
|
||||
|
||||
void TimerTest(void* session_id) { host_->SetTimer(1000, session_id); }
|
||||
@@ -1505,14 +1476,12 @@ int main(int argc, char** argv) {
|
||||
// The following variables are configurable through command line options.
|
||||
g_license_server.assign(config.license_server());
|
||||
g_key_id.assign(config.key_id());
|
||||
g_port.assign(config.port());
|
||||
std::string license_server(g_license_server);
|
||||
|
||||
int show_usage = 0;
|
||||
static const struct option long_options[] = {
|
||||
{"use_full_path", no_argument, &g_use_full_path, 0},
|
||||
{"keyid", required_argument, NULL, 'k'},
|
||||
{"port", required_argument, NULL, 'p'},
|
||||
{"server", required_argument, NULL, 's'},
|
||||
{"vmodule", required_argument, NULL, 0},
|
||||
{"v", required_argument, NULL, 0},
|
||||
@@ -1528,11 +1497,6 @@ int main(int argc, char** argv) {
|
||||
g_key_id.assign(optarg);
|
||||
break;
|
||||
}
|
||||
case 'p': {
|
||||
g_port.clear();
|
||||
g_port.assign(optarg);
|
||||
break;
|
||||
}
|
||||
case 's': {
|
||||
g_license_server.clear();
|
||||
g_license_server.assign(optarg);
|
||||
@@ -1559,11 +1523,6 @@ int main(int argc, char** argv) {
|
||||
std::cout << " e.g. adb shell '" << argv[0] << " --server=\"url\"'"
|
||||
<< std::endl << std::endl;
|
||||
|
||||
std::cout << std::setw(30) << std::left << " --port=<connection port>";
|
||||
std::cout << "specifies the port number, in decimal format" << std::endl;
|
||||
std::cout << std::setw(30) << std::left << " ";
|
||||
std::cout << "default: " << g_port << std::endl;
|
||||
|
||||
std::cout << std::setw(30) << std::left << " --server=<server_url>";
|
||||
std::cout
|
||||
<< "configure the license server url, please include http[s] in the url"
|
||||
@@ -1584,12 +1543,10 @@ int main(int argc, char** argv) {
|
||||
|
||||
std::cout << std::endl;
|
||||
std::cout << "Server: " << g_license_server << std::endl;
|
||||
std::cout << "Port: " << g_port << std::endl;
|
||||
std::cout << "KeyID: " << g_key_id << std::endl << std::endl;
|
||||
|
||||
g_key_id = wvcdm::a2bs_hex(g_key_id);
|
||||
config.set_license_server(g_license_server);
|
||||
config.set_port(g_port);
|
||||
config.set_key_id(g_key_id);
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
|
||||
Reference in New Issue
Block a user