Add comments to unit tests

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

Partners have been requesting more explanation for what each test is
doing.  This is an attempt to clarify some of the tests.

Bug: 119640588
Test: unit tests
Change-Id: I270203b4e8fa7e65abb55297788e4d55856e7dcd
This commit is contained in:
Fred Gylys-Colwell
2019-03-03 21:16:55 -08:00
parent 50e4d67415
commit 5f7803dedd
7 changed files with 306 additions and 21 deletions

View File

@@ -8,8 +8,13 @@
namespace wvoec {
// Keeps track of which features are supported by the version of OEMCrypto being
// tested. See the integration guide for a list of optional features.
class DeviceFeatures {
public:
// There are several possible methods used to derive a set of known session
// keys. For example, the test can install a known test keybox, or it can
// parse the OEM certificate.
enum DeriveMethod { // Method to use derive session keys.
NO_METHOD, // Cannot derive known session keys.
LOAD_TEST_KEYBOX, // Call LoadTestKeybox before deriving keys.
@@ -32,15 +37,24 @@ class DeviceFeatures {
uint32_t api_version;
OEMCrypto_ProvisioningMethod provisioning_method;
// This should be called from the test program's main procedure.
void Initialize(bool is_cast_receiver, bool force_load_test_keybox);
// Generate a GTest filter of tests that should not be run. This should be
// called after Initialize. Tests are filtered out based on which features
// are not supported. For example, a device that uses Provisioning 3.0 will
// have all keybox tests filtered out.
std::string RestrictFilter(const std::string& initial_filter);
private:
// Decide which method should be used to derive session keys, based on
// supported featuers.
void PickDerivedKey();
bool IsTestKeyboxInstalled();
// Add a GTest filter restriction to the current filter.
void FilterOut(std::string* current_filter, const std::string& new_filter);
};
// There is one global set of features for the version of OEMCrypto being
// tested. This should be initialized in the test program's main procedure.
extern DeviceFeatures global_features;
const char* ProvisioningMethodName(OEMCrypto_ProvisioningMethod method);