Create test FileSystems in a platform-specific manner
(This is a merge of http://go/wvgerrit/153552.) The correct way to create a FileSystem object for testing CdmEngine depends on the platform. However, our code has historically just instantiated a new FileSystem object using the default constructor. This works fine for Android and has historically worked fine for the CE CDM tests because they did not implement storage correctly. However, an upcoming commit will fix the implementation of storage in the CE CDM TestHost, causing tests that use a default FileSystem constructor to fail. This patch adds a new platform-defined function that instantiates per-origin test storage in a platform-correct way. For Android, it continues to use the default constructor, while for CE CDM, it uses the TestHost. Bug: 193060708 Test: x86-64 w/ storage separated Test: build_and_run_all_unit_tests.sh Change-Id: I0a9b6a4d3943e053d51d6018e392b7f215f50642
This commit is contained in:
@@ -324,12 +324,12 @@ void WvCdmTestBase::Provision() {
|
||||
std::string cert, wrapped_key;
|
||||
|
||||
CdmSessionId session_id;
|
||||
wvutil::FileSystem file_system;
|
||||
std::unique_ptr<wvutil::FileSystem> file_system(CreateTestFileSystem());
|
||||
|
||||
if (config_.provisioning_server() == "fake") {
|
||||
LOGD("Using fake provisioning server.");
|
||||
|
||||
TestCdmEngine cdm_engine(&file_system,
|
||||
TestCdmEngine cdm_engine(file_system.get(),
|
||||
std::shared_ptr<EngineMetrics>(new EngineMetrics));
|
||||
FakeProvisioningServer server;
|
||||
CdmResponseType result = cdm_engine.GetProvisioningRequest(
|
||||
@@ -349,7 +349,7 @@ void WvCdmTestBase::Provision() {
|
||||
EXPECT_EQ(NO_ERROR, result);
|
||||
} else {
|
||||
// TODO(fredgc): provision for different SPOIDs.
|
||||
TestCdmEngine cdm_engine(&file_system,
|
||||
TestCdmEngine cdm_engine(file_system.get(),
|
||||
std::shared_ptr<EngineMetrics>(new EngineMetrics));
|
||||
|
||||
CdmResponseType result = cdm_engine.GetProvisioningRequest(
|
||||
@@ -424,11 +424,11 @@ void WvCdmTestBase::Provision() {
|
||||
// that certificate from the provisioning request.
|
||||
void WvCdmTestBase::EnsureProvisioned() {
|
||||
CdmSessionId session_id;
|
||||
wvutil::FileSystem file_system;
|
||||
std::unique_ptr<wvutil::FileSystem> file_system(CreateTestFileSystem());
|
||||
// OpenSession will check if a DRM certificate exists, while
|
||||
// GenerateKeyRequest will actually load the wrapped private key.
|
||||
// Either may return a NEED_PROVISIONING error, so both have to be checked.
|
||||
TestCdmEngine cdm_engine(&file_system,
|
||||
TestCdmEngine cdm_engine(file_system.get(),
|
||||
std::shared_ptr<EngineMetrics>(new EngineMetrics));
|
||||
CdmResponseType status = cdm_engine.OpenSession(config_.key_system(), nullptr,
|
||||
nullptr, &session_id);
|
||||
|
||||
Reference in New Issue
Block a user