Merge "Improvements to TestBase"

This commit is contained in:
John Bruce
2020-01-31 01:48:37 +00:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 5 deletions

View File

@@ -32,7 +32,7 @@ using wvcdm::metrics::EngineMetrics;
namespace wvcdm { namespace wvcdm {
namespace { 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 << std::endl;
std::cout << "usage: " << prog_name << " [options]" << std::endl << std::endl; std::cout << "usage: " << prog_name << " [options]" << std::endl << std::endl;
std::cout << " enclose multiple arguments in '' when using adb shell" 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]" << " configure the provisioning server url, please include http[s]"
<< " in the url" << std::endl << " in the url" << std::endl
<< 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)); 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(); Properties::Init();
bool is_cast_receiver = false; bool is_cast_receiver = false;
bool force_load_test_keybox = false; // TODO(fredgc): obsolete. remove. bool force_load_test_keybox = false; // TODO(fredgc): obsolete. remove.
@@ -454,7 +457,7 @@ bool WvCdmTestBase::Initialize(int argc, char** argv) {
} }
if (show_usage) { if (show_usage) {
show_menu(argv[0]); show_menu(argv[0], extra_help_text);
return false; return false;
} }

View File

@@ -5,6 +5,9 @@
#ifndef WVCDM_CORE_TEST_BASE_H_ #ifndef WVCDM_CORE_TEST_BASE_H_
#define WVCDM_CORE_TEST_BASE_H_ #define WVCDM_CORE_TEST_BASE_H_
#include <string>
#include <vector>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "cdm_engine.h" #include "cdm_engine.h"
@@ -29,8 +32,13 @@ class WvCdmTestBase : public ::testing::Test {
// Returns true if the test program should continue, if false, the caller // Returns true if the test program should continue, if false, the caller
// should exit. This should be called by main() to allow the user to pass in // should exit. This should be called by main() to allow the user to pass in
// command line switches. // command line switches. The |extra_help_text| parameter can be used to
static bool Initialize(int argc, char **argv); // append platform-specific information to the usage information printed when
// invalid flags are detected. For instance, a platform might add information
// about platform-specific flags that were already parsed before calling
// Initialize().
static bool Initialize(int argc, const char* const argv[],
const std::string& extra_help_text = std::string());
// Install a test keybox, if appropriate. // Install a test keybox, if appropriate.
static void InstallTestRootOfTrust(); static void InstallTestRootOfTrust();