// 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 namespace std { void PrintTo(future_status status, ostream* os) { switch (status) { case future_status::ready: *os << "future_status::ready"; return; case future_status::timeout: *os << "future_status::timeout"; return; case future_status::deferred: *os << "future_status::deferred"; return; } *os << "(status) << ")>"; } } // namespace std