Source release 17.1.0
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
||||
// source code may only be used and distributed under the Widevine Master
|
||||
// License Agreement.
|
||||
// source code may only be used and distributed under the Widevine License
|
||||
// Agreement.
|
||||
#ifndef WVCDM_CDM_TEST_TEST_HOST_H_
|
||||
#define WVCDM_CDM_TEST_TEST_HOST_H_
|
||||
|
||||
@@ -15,30 +15,47 @@
|
||||
// This provides a host environment for running CDM tests. It implements the
|
||||
// IStorage, IClock and ITimer interfaces that a host would normally implement,
|
||||
// while allowing them to be manipulated by the test.
|
||||
class TestHost : public widevine::Cdm::IStorage,
|
||||
public widevine::Cdm::IClock,
|
||||
class TestHost : public widevine::Cdm::IClock,
|
||||
public widevine::Cdm::ITimer,
|
||||
public wvcdm::TestSleep::CallBack {
|
||||
public wvutil::TestSleep::CallBack {
|
||||
public:
|
||||
class Storage : public widevine::Cdm::IStorage {
|
||||
public:
|
||||
typedef std::map<std::string, std::string> StorageMap;
|
||||
|
||||
explicit Storage(bool is_global);
|
||||
~Storage() override {}
|
||||
void Reset();
|
||||
|
||||
// Reset the file system to contain the specified files.
|
||||
void ResetFiles(const StorageMap& files) { files_ = files; };
|
||||
const StorageMap& files() const { return files_; }
|
||||
|
||||
// widevine::Cdm::IStorage
|
||||
bool read(const std::string& name, std::string* data) override;
|
||||
bool write(const std::string& name, const std::string& data) override;
|
||||
bool exists(const std::string& name) override;
|
||||
bool remove(const std::string& name) override;
|
||||
int32_t size(const std::string& name) override;
|
||||
bool list(std::vector<std::string>* names) override;
|
||||
|
||||
private:
|
||||
bool is_global_;
|
||||
StorageMap files_;
|
||||
|
||||
bool CheckFilename(const std::string& name);
|
||||
};
|
||||
|
||||
TestHost();
|
||||
~TestHost();
|
||||
~TestHost() override;
|
||||
void Reset();
|
||||
|
||||
// Used for manipulating and inspecting timer states during testing.
|
||||
void ElapseTime(int64_t milliseconds) override;
|
||||
int NumTimers() const;
|
||||
size_t NumTimers() const;
|
||||
|
||||
// This should be called before trying to write the cert.bin file. This is
|
||||
// used when testing device provisioning.
|
||||
void SaveProvisioningInformation() { save_device_cert_ = true; }
|
||||
|
||||
// widevine::Cdm::IStorage
|
||||
bool read(const std::string& name, std::string* data) override;
|
||||
bool write(const std::string& name, const std::string& data) override;
|
||||
bool exists(const std::string& name) override;
|
||||
bool remove(const std::string& name) override;
|
||||
int32_t size(const std::string& name) override;
|
||||
bool list(std::vector<std::string>* names) override;
|
||||
Storage& global_storage() { return global_storage_; }
|
||||
Storage& per_origin_storage() { return per_origin_storage_; }
|
||||
|
||||
// widevine::Cdm::IClock
|
||||
int64_t now() override;
|
||||
@@ -71,11 +88,8 @@ class TestHost : public widevine::Cdm::IStorage,
|
||||
int64_t now_;
|
||||
std::priority_queue<Timer> timers_;
|
||||
|
||||
std::string device_cert_;
|
||||
bool save_device_cert_;
|
||||
|
||||
typedef std::map<std::string, std::string> StorageMap;
|
||||
StorageMap files_;
|
||||
Storage global_storage_;
|
||||
Storage per_origin_storage_;
|
||||
};
|
||||
|
||||
// Owned and managed by the test runner.
|
||||
|
||||
Reference in New Issue
Block a user