Update comments and unit tests for InstallKeyboxOrCert
Merge from Widevine repo of http://go/wvgerrit/66865 This CL updates the comments for the code that uses InstallKeyboxOrCert to install a keybox or oem cert at runtime. There is also a new unit test for the device id. There are not many unit tests because we don't want to accidentally overwrite the production keybox or cert on a device when running tests. bug: 111725154 test: unit tests Change-Id: Ide9b3d4732f3f96a723a128907babe7e59c02ffc
This commit is contained in:
@@ -557,6 +557,8 @@ TEST_F(OEMCryptoKeyboxTest, GetKeyDataNullPointer) {
|
||||
ASSERT_NE(OEMCrypto_SUCCESS, sts);
|
||||
}
|
||||
|
||||
// This test makes sure the installed keybox is valid. It doesn't really check
|
||||
// that it is a production keybox. That must be done by an integration test.
|
||||
TEST_F(OEMCryptoKeyboxTest, ProductionKeyboxValid) {
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_IsKeyboxValid());
|
||||
}
|
||||
@@ -584,6 +586,23 @@ TEST_F(OEMCryptoProv30Test, DeviceClaimsOEMCertificate) {
|
||||
ASSERT_EQ(OEMCrypto_OEMCertificate, OEMCrypto_GetProvisioningMethod());
|
||||
}
|
||||
|
||||
TEST_F(OEMCryptoProv30Test, GetDeviceId) {
|
||||
OEMCryptoResult sts;
|
||||
std::vector<uint8_t> dev_id(128, 0);
|
||||
size_t dev_id_len = dev_id.size();
|
||||
sts = OEMCrypto_GetDeviceID(&dev_id[0], &dev_id_len);
|
||||
if (sts == OEMCrypto_ERROR_NOT_IMPLEMENTED) return;
|
||||
if (sts == OEMCrypto_ERROR_SHORT_BUFFER) {
|
||||
ASSERT_GT(dev_id_len, 0u);
|
||||
dev_id.resize(dev_id_len);
|
||||
sts = OEMCrypto_GetDeviceID(&dev_id[0], &dev_id_len);
|
||||
}
|
||||
cout << " NormalGetDeviceId: dev_id = " << &dev_id[0]
|
||||
<< " len = " << dev_id_len << endl;
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, sts);
|
||||
}
|
||||
|
||||
|
||||
// The OEM certificate must be valid.
|
||||
TEST_F(OEMCryptoProv30Test, CertValidAPI15) {
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_IsKeyboxOrOEMCertValid());
|
||||
|
||||
Reference in New Issue
Block a user