Improvements to TestBase

This patch merges some features that were added to TestBase in
http://go/wvgerrit/92349 in the Widevine Repo. Certain parameters to
TestBase that could have been const but weren't now are. The caller to
Initialize() can now specify additional, platform-specific help text to
be displayed after the generic help text. And some missing headers were
added to test_base.h.

The Android code does not yet take advantage of any of this, but it
could in the future.

Bug: 145013234
Test: Android Unit Tests
Change-Id: I3c54532a39641622d454256b25979ad89727d43f
This commit is contained in:
John W. Bruce
2020-01-27 16:52:46 -08:00
parent 169c5b3d10
commit 1bc1bad1f0
2 changed files with 16 additions and 5 deletions

View File

@@ -32,7 +32,7 @@ using wvcdm::metrics::EngineMetrics;
namespace wvcdm {
namespace {
void show_menu(char* prog_name) {
void show_menu(const char* prog_name, const std::string& extra_help_text) {
std::cout << std::endl;
std::cout << "usage: " << prog_name << " [options]" << std::endl << std::endl;
std::cout << " enclose multiple arguments in '' when using adb shell"
@@ -97,6 +97,8 @@ void show_menu(char* prog_name) {
<< " configure the provisioning server url, please include http[s]"
<< " in the url" << std::endl
<< std::endl;
std::cout << extra_help_text << std::endl;
}
/*
@@ -393,7 +395,8 @@ void WvCdmTestBase::EnsureProvisioned() {
ASSERT_EQ(NO_ERROR, cdm_engine.CloseSession(session_id));
}
bool WvCdmTestBase::Initialize(int argc, char** argv) {
bool WvCdmTestBase::Initialize(int argc, const char* const argv[],
const std::string& extra_help_text) {
Properties::Init();
bool is_cast_receiver = false;
bool force_load_test_keybox = false; // TODO(fredgc): obsolete. remove.
@@ -454,7 +457,7 @@ bool WvCdmTestBase::Initialize(int argc, char** argv) {
}
if (show_usage) {
show_menu(argv[0]);
show_menu(argv[0], extra_help_text);
return false;
}