Common test main

Merge from Widevine repo of http://go/wvgerrit/56521

This CL adds a common main routine for integration tests.  It sets a
default test configuration for the provisioning and license server
urls and certificates, and allows the user to set them on the command
line.

Test: current unit tests still pass.
Bug: 72354901 Fix Generic Crypto tests.
Change-Id: I604a3d9e15d50da5041794624c4571c0dcb091f5
This commit is contained in:
Fred Gylys-Colwell
2018-08-03 17:09:19 -07:00
parent 4af5aaf18a
commit e635d4d384
11 changed files with 707 additions and 772 deletions

View File

@@ -10,18 +10,32 @@
#include "config_test_env.h"
#include "crypto_session.h"
#include "metrics_collections.h"
#include "string_conversions.h"
namespace wvcdm {
// This is the base class for Widevine CDM integration tests. It's main use is
// to configure OEMCrypto to use a test keybox.
class WvCdmTestBase : public ::testing::Test {
public:
WvCdmTestBase() {}
WvCdmTestBase() : config_(default_config_) {}
virtual ~WvCdmTestBase() {}
virtual void SetUp();
virtual std::string binary_key_id() const { return a2bs_hex(config_.key_id()); }
// 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
// command line switches.
static bool Initialize(int argc, char **argv);
// Install a test keybox, if appropriate.
static void InstallTestRootOfTrust();
// The default test configuration. This is influenced by command line
// arguments before any tests are created.
static ConfigTestEnv default_config_;
// Configuration for an individual test. This is initialized to be the
// default configuration, but can be modified by the test itself.
ConfigTestEnv config_;
};
class TestCryptoSession : public CryptoSession {