// Copyright 2020 Google LLC. All Rights Reserved. #include "api/license_whitebox_test_base.h" #include #include "api/test_data.h" namespace widevine { void LicenseWhiteboxTestBase::SetUp() { const std::vector init_data = GetLicenseInitData(); ASSERT_EQ(WB_License_Create(init_data.data(), init_data.size(), &whitebox_), WB_RESULT_OK); const auto public_key_data = GetMatchingLicensePublicKey(); public_key_.reset(RsaPublicKey::Create( std::string(public_key_data.begin(), public_key_data.end()))); ASSERT_TRUE(public_key_); } void LicenseWhiteboxTestBase::TearDown() { WB_License_Delete(whitebox_); } void LicenseWhiteboxTestBase::Modify(std::vector* data) const { ASSERT_TRUE(data); ASSERT_GT(data->size(), 0u); // Bitwise-not the first byte so that we are guaranteed to have at least one // byte different from the original data. data->data()[0] = ~data->data()[0]; } } // namespace widevine