Source release 15.3.0

This commit is contained in:
John W. Bruce
2020-02-11 14:22:17 -08:00
parent 2990f23065
commit 1ff9f8588a
29 changed files with 534 additions and 153 deletions

View File

@@ -4,7 +4,11 @@
#include <assert.h>
#include <gtest/gtest.h>
#include <string.h>
#include <time.h>
#include <algorithm>
#include <string>
#include <vector>
#if defined(__linux__)
#include <sys/utsname.h>
@@ -19,11 +23,34 @@
using namespace widevine;
TestHost* g_host = nullptr;
std::string g_sandbox_id = "";
namespace {
constexpr const char kSandboxIdParam[] = "--sandbox_id=";
// Following the pattern established by help text in test_base.cpp
constexpr const char kExtraHelpText[] =
" --sandbox_id=<sandbox_id>\n"
" Specifies the Sandbox ID that should be sent to OEMCrypto via\n"
" OEMCrypto_SetSandbox(). On most platforms, since Sandbox IDs are not\n"
" in use, this parameter should be omitted.\n";
} // namespace
int main(int argc, char** argv) {
// Init gtest and let it consume arguments.
::testing::InitGoogleTest(&argc, argv);
// Find and filter out the Sandbox ID, if any.
std::vector<std::string> args(argv, argv + argc);
auto sandbox_id_iter = std::find_if(std::begin(args) + 1, std::end(args),
[](const std::string& elem) -> bool {
return elem.find(kSandboxIdParam) == 0;
});
if (sandbox_id_iter != std::end(args)) {
g_sandbox_id = sandbox_id_iter->substr(strlen(kSandboxIdParam));
args.erase(sandbox_id_iter);
}
// Set up a Host and initialize the library. This makes these services
// available to the tests. We would do this in the test suite itself, but the
// core & OEMCrypto tests don't know they depend on this for storage.
@@ -46,15 +73,22 @@ int main(int argc, char** argv) {
#endif
client_info.build_info = __DATE__;
Cdm::Status status =
Cdm::initialize(Cdm::kNoSecureOutput, client_info, g_host, g_host, g_host,
static_cast<Cdm::LogLevel>(wvcdm::g_cutoff));
Cdm::Status status = Cdm::initialize(
Cdm::kNoSecureOutput, client_info, g_host, g_host, g_host,
static_cast<Cdm::LogLevel>(wvcdm::g_cutoff), g_sandbox_id);
(void)status; // status is now used when assertions are turned off.
assert(status == Cdm::kSuccess);
// This must take place after the call to Cdm::initialize() because it may
// make calls that are only valid after the library is initialized.
if (!wvcdm::WvCdmTestBase::Initialize(argc, argv)) return 0;
std::vector<const char*> new_argv(args.size());
std::transform(
std::begin(args), std::end(args), std::begin(new_argv),
[](const std::string& arg) -> const char* { return arg.c_str(); });
// This must take place after the call to Cdm::initialize() because it makes
// calls that are only valid after the library is initialized.
if (!wvcdm::WvCdmTestBase::Initialize(new_argv.size(), new_argv.data(),
kExtraHelpText)) {
return 0;
}
return RUN_ALL_TESTS();
}