Fixed test and log formatting for CdmResponseType.
[ Merge of http://go/wvgerrit/168397 ] When CdmResponseType (enum) was transformed to CdmResponseType (struct), the test printers where not updated to print the result of failed comparisons. In addition, several logs statements were updated haphazardly, leaving inconsistencies and potential compiler-specific behavior. This CL replaces CdmResponseType std::string operator with a ToString() method. This is to make it consistent with Google's C++ style guide on conversion operators vs methods. The string conversion function is now defined in wv_cdm_types.cpp instead of inline in the header file. The PrintTo function has been implemented along with the other CDM test printers in test_printers.cpp. Bug: 273989359 Test: run_x86_64_tests Test: MediaDrmParameterizedTests on redfin Test: Forrest drm_compliance Change-Id: Ibfaa17029046b75b1c8c278f7bd7e04a24379848
This commit is contained in:
@@ -111,7 +111,7 @@ TEST_F(CdmOtaKeyboxTest, BasicTest) {
|
||||
} else {
|
||||
std::cout << " "
|
||||
<< "Could not find system id before test. ";
|
||||
PrintTo(system_id_status.Enum(), &std::cout);
|
||||
PrintTo(system_id_status, &std::cout);
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ TEST_F(CdmOtaKeyboxTest, BasicTest) {
|
||||
} else {
|
||||
std::cout << " "
|
||||
<< "Could not find system id after first provisioning. ";
|
||||
PrintTo(system_id_status.Enum(), &std::cout);
|
||||
PrintTo(system_id_status, &std::cout);
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ TEST_F(CdmOtaKeyboxTest, BasicTest) {
|
||||
} else {
|
||||
std::cout << " "
|
||||
<< "Could not find system id after second provisioning. ";
|
||||
PrintTo(system_id_status.Enum(), &std::cout);
|
||||
PrintTo(system_id_status, &std::cout);
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,14 @@
|
||||
#include "error_string_util.h"
|
||||
|
||||
namespace wvcdm {
|
||||
void PrintTo(const CdmResponseEnum& value, ::std::ostream* os) {
|
||||
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:
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
namespace wvcdm {
|
||||
void PrintTo(const enum CdmResponseEnum& value, ::std::ostream* os);
|
||||
void PrintTo(CdmResponseEnum value, ::std::ostream* os);
|
||||
void PrintTo(const CdmResponseType& value, ::std::ostream* os);
|
||||
void PrintTo(const enum CdmLicenseType& value, ::std::ostream* os);
|
||||
void PrintTo(const enum CdmSecurityLevel& value, ::std::ostream* os);
|
||||
void PrintTo(const enum CdmCertificateType& value, ::std::ostream* os);
|
||||
|
||||
Reference in New Issue
Block a user