Refactor OEMCrypto Unit Tests
Merge from widevine repo of http://go/wvgerrit/21681 This CL refactors some oemcrypto unit tests in preparation for adding Provisioning 3.0 tests. - The signature GenerateNonce has changed. Instead of the caller passing in a pointer for the nonce, we store the nonce in a member variable of Session. - GenerateDerivedKeys is being replaced by InstallTestSessionKeys. This sets up and calls the appropriate derive keys method. This function is in the test class, instead of the session class so that multiple sessions in a class can share the same wrapped rsa key. This will be modified for provisioning 3.0 in a future CL. - Rename tests that require a keybox. Some tests are specific for using a keybox to request a DRM cert. These tests are renamed so we can filter them out on devices that use an OEM Cert. Corresponding tests for devices using provisioning 3.0 will be in a future CL. - Some member variables and methods in the class Session were not used. They are removed. - Added openssl smart pointer. - Comments. I added comments. - clang format. Change-Id: Ib579a322858e0ef92652a42167241b35cf85a041
This commit is contained in:
@@ -33,6 +33,7 @@ class WvGenericOperationsTest : public testing::Test {
|
||||
virtual void SetUp() {
|
||||
::testing::Test::SetUp();
|
||||
|
||||
// TODO(fredgc or gmorgan): This should be updated for provisioning 3.0
|
||||
// Load test keybox. This keybox will be used by any CryptoSession
|
||||
// created by the CDM under test.
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_LoadTestKeybox());
|
||||
@@ -72,7 +73,8 @@ class WvGenericOperationsTest : public testing::Test {
|
||||
void OecSessionSetup(uint32_t oec_session_id) {
|
||||
buffer_size_ = 160;
|
||||
oec_util_session_.SetSessionId(oec_session_id);
|
||||
oec_util_session_.GenerateTestSessionKeys();
|
||||
// TODO(fredgc or gmorgan): This should be updated for provisioning 3.0
|
||||
oec_util_session_.GenerateDerivedKeysFromKeybox();
|
||||
MakeFourKeys();
|
||||
}
|
||||
|
||||
@@ -202,7 +204,8 @@ TEST_F(WvGenericOperationsTest, NormalSessionOpenClose) {
|
||||
TEST_F(WvGenericOperationsTest, GenerateSessionKeys) {
|
||||
wvoec::Session s;
|
||||
ASSERT_NO_FATAL_FAILURE(s.open());
|
||||
ASSERT_NO_FATAL_FAILURE(s.GenerateTestSessionKeys());
|
||||
// TODO(fredgc or gmorgan): This should be updated for provisioning 3.0
|
||||
ASSERT_NO_FATAL_FAILURE(s.GenerateDerivedKeysFromKeybox());
|
||||
ASSERT_NO_FATAL_FAILURE(s.close());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user