[ Merge of http://go/wvgerrit/170073 ] Removed the file "error_string_util.cpp" and its header, moving the OEMCryptoResult to string converter to "wv_cdm_types.cpp". This extra file served little purpose, and created a dependency on the CDM utils to the CDM itself. This is part of the effort to fix the formatting of WV metrics; making enum-to-string conversion uniform throughout the CDM. Bug: 239462891 Test: adb shell dumpsys android.hardware.drm.IDrmFactory/widevine -m Test: Manual testing with Google TV Change-Id: I4bf95d26b623f5b8fa86bdb2578cbc4ee65125cb
82 lines
2.1 KiB
C++
82 lines
2.1 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"
|
|
|
|
namespace wvcdm {
|
|
void PrintTo(CdmResponseEnum value, ::std::ostream* os) {
|
|
*os << CdmResponseEnumToString(value);
|
|
}
|
|
|
|
void PrintTo(const CdmResponseType& value, ::std::ostream* os) {
|
|
*os << value.ToString();
|
|
}
|
|
|
|
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 << OemCryptoResultToString(value);
|
|
}
|
|
|
|
namespace okp {
|
|
void PrintTo(const SystemState& state, std::ostream* os) {
|
|
*os << SystemStateToString(state);
|
|
}
|
|
} // namespace okp
|
|
} // namespace wvcdm
|