Send test name to server
Merge from Widevine repo of http://go/wvgerrit/59700 This CL sets the environment variable MODEL_NAME to be the current unit test. When running on a test platform, this environment variable is used in the license request as model_name. test: unit tests. bug: 38004627 Change-Id: I347c5cec35942d68285cc01615b976097f37d214
This commit is contained in:
@@ -7,11 +7,12 @@
|
||||
#include "test_base.h"
|
||||
|
||||
#include <getopt.h>
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/cmac.h>
|
||||
#include <openssl/err.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "cdm_engine.h"
|
||||
#include "crypto_session.h"
|
||||
@@ -204,9 +205,19 @@ void WvCdmTestBase::SetUp() {
|
||||
::testing::Test::SetUp();
|
||||
Properties::set_provisioning_messages_are_binary(binary_provisioning_);
|
||||
Properties::Init();
|
||||
// Log the current test name, to help with debugging when the log and stdout
|
||||
// are not the same.
|
||||
const ::testing::TestInfo* const test_info =
|
||||
::testing::UnitTest::GetInstance()->current_test_info();
|
||||
LOGD("Running test %s.%s", test_info->test_case_name(), test_info->name());
|
||||
// Some test environments allow the model name of the device to be set
|
||||
// dynamically using an environment variable. The model name will show up in
|
||||
// the license server logs as the part of the device idenfication as
|
||||
// "model_name".
|
||||
std::stringstream ss;
|
||||
ss << test_info->test_case_name() << "." << test_info->name();
|
||||
int overwrite = 1; // Set value even if already set.
|
||||
setenv("MODEL_NAME", ss.str().c_str(), overwrite);
|
||||
CryptoSession::SetCryptoSessionFactory(new TestCryptoSessionFactory());
|
||||
// TODO(fredgc): Add a test version of DeviceFiles.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user