Testbed classes inherit from oemcrypto reference code

Merge from Widevine repo of http://go/wvgerrit/58200

This CL removes code from the testbed that is duplicated in the
reference code using inheritance.

bug: 76393338 Split mock into reference code and testbed code
test: unit tests
Change-Id: I7b5f5330a595fa1756e6dfdf75bc07addb6107a8
This commit is contained in:
Fred Gylys-Colwell
2018-09-02 13:20:14 -07:00
parent a0961a8834
commit 3a2d291dc5
8 changed files with 98 additions and 97 deletions

View File

@@ -15,7 +15,7 @@
#include <openssl/rsa.h>
#include "OEMCryptoCENC.h" // Needed for enums only.
#include "OEMCryptoCENC.h"
#include "file_store.h"
#include "lock.h"
#include "oemcrypto_auth_ref.h"
@@ -42,7 +42,7 @@ class CryptoEngine {
virtual ~CryptoEngine();
virtual bool Initialize() { return true; }
virtual bool Initialize();
bool ValidRootOfTrust() { return root_of_trust_.Validate(); }
@@ -74,7 +74,7 @@ class CryptoEngine {
virtual void Terminate() {}
SessionId CreateSession();
virtual SessionId OpenSession();
bool DestroySession(SessionId sid);
@@ -94,7 +94,7 @@ class CryptoEngine {
// Returns the max HDCP version supported.
virtual OEMCrypto_HDCP_Capability config_maximum_hdcp_capability();
UsageTable& usage_table() { return usage_table_; }
UsageTable& usage_table() { return *(usage_table_.get()); }
wvcdm::FileSystem* file_system() { return file_system_.get(); }
// If config_local_display_only() returns true, we pretend we are using a
@@ -172,14 +172,14 @@ class CryptoEngine {
protected:
explicit CryptoEngine(scoped_ptr<wvcdm::FileSystem> file_system);
virtual SessionContext* MakeSession(SessionId sid);
virtual UsageTable* MakeUsageTable();
uint8_t* destination_;
private:
ActiveSessions sessions_;
AuthenticationRoot root_of_trust_;
wvcdm::Lock session_table_lock_;
scoped_ptr<wvcdm::FileSystem> file_system_;
UsageTable usage_table_;
scoped_ptr<UsageTable> usage_table_;
CORE_DISALLOW_COPY_AND_ASSIGN(CryptoEngine);
};