Merge from http://go/wvgerrit/158917 Use go/yamllint as reference and obfuscate portion of output to run on an online yaml validator. Sample output: http://go/cl/481370906 Test: Netflix, Play TV and Movies, Youtube Test: adb shell dumpsys android.hardware.drm.IDrmFactory/widevine Test: ./build_and_run_all_unit_tests.sh Bug: 239462891 Change-Id: I1abf1aa50aa25b97b1f6c10995c324d6de04d056
80 lines
2.0 KiB
C++
80 lines
2.0 KiB
C++
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine License
|
|
// Agreement.
|
|
// This file adds some print methods so that when unit tests fail, the
|
|
// will print the name of an enumeration instead of the numeric value.
|
|
|
|
#include "test_printers.h"
|
|
|
|
#include "error_string_util.h"
|
|
|
|
namespace wvcdm {
|
|
void PrintTo(const enum CdmResponseType& value, ::std::ostream* os) {
|
|
*os << CdmResponseTypeToString(value);
|
|
}
|
|
|
|
void PrintTo(const enum CdmLicenseType& value, ::std::ostream* os) {
|
|
switch (value) {
|
|
case kLicenseTypeOffline:
|
|
*os << "kLicenseTypeOffline";
|
|
break;
|
|
case kLicenseTypeStreaming:
|
|
*os << "kLicenseTypeStreaming";
|
|
break;
|
|
case kLicenseTypeRelease:
|
|
*os << "kLicenseTypeRelease";
|
|
break;
|
|
default:
|
|
*os << "Unknown CdmLicenseType";
|
|
break;
|
|
}
|
|
}
|
|
|
|
void PrintTo(const enum CdmSecurityLevel& value, ::std::ostream* os) {
|
|
switch (value) {
|
|
case kSecurityLevelUninitialized:
|
|
*os << "kSecurityLevelUninitialized";
|
|
break;
|
|
case kSecurityLevelL1:
|
|
*os << "kSecurityLevelL1";
|
|
break;
|
|
case kSecurityLevelL2:
|
|
*os << "kSecurityLevelL2";
|
|
break;
|
|
case kSecurityLevelL3:
|
|
*os << "kSecurityLevelL3";
|
|
break;
|
|
case kSecurityLevelUnknown:
|
|
*os << "kSecurityLevelUnknown";
|
|
break;
|
|
default:
|
|
*os << "Unknown CdmSecurityLevel";
|
|
break;
|
|
}
|
|
}
|
|
|
|
void PrintTo(const enum CdmCertificateType& value, ::std::ostream* os) {
|
|
switch (value) {
|
|
case kCertificateWidevine:
|
|
*os << "kCertificateWidevine";
|
|
break;
|
|
case kCertificateX509:
|
|
*os << "kCertificateX509";
|
|
break;
|
|
default:
|
|
*os << "Unknown CdmCertificateType";
|
|
break;
|
|
}
|
|
}
|
|
|
|
void PrintTo(const enum OEMCryptoResult& value, ::std::ostream* os) {
|
|
*os << wvutil::OEMCryptoResultToString(value);
|
|
}
|
|
|
|
namespace okp {
|
|
void PrintTo(const SystemState& state, std::ostream* os) {
|
|
*os << SystemStateToString(state);
|
|
}
|
|
} // namespace okp
|
|
} // namespace wvcdm
|