Source release 16.2.0
This commit is contained in:
@@ -18,10 +18,12 @@ const std::string kCertificateFilename = "cert.bin";
|
||||
} // namespace
|
||||
|
||||
TestHost::TestHost() { Reset(); }
|
||||
TestHost::~TestHost() { wvcdm::TestSleep::set_callback(nullptr); }
|
||||
|
||||
void TestHost::Reset() {
|
||||
auto now = std::chrono::steady_clock().now();
|
||||
now_ = now.time_since_epoch() / std::chrono::milliseconds(1);
|
||||
wvcdm::TestSleep::set_callback(this);
|
||||
|
||||
save_device_cert_ = false;
|
||||
|
||||
@@ -57,14 +59,14 @@ int TestHost::NumTimers() const { return timers_.size(); }
|
||||
bool TestHost::read(const std::string& name, std::string* data) {
|
||||
StorageMap::iterator it = files_.find(name);
|
||||
bool ok = it != files_.end();
|
||||
LOGD("read file: %s: %s", name.c_str(), ok ? "ok" : "fail");
|
||||
LOGV("read file: %s: %s", name.c_str(), ok ? "ok" : "fail");
|
||||
if (!ok) return false;
|
||||
*data = it->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestHost::write(const std::string& name, const std::string& data) {
|
||||
LOGD("write file: %s", name.c_str());
|
||||
LOGV("write file: %s", name.c_str());
|
||||
files_[name] = data;
|
||||
if (save_device_cert_ && kCertificateFilename.compare(name) == 0) {
|
||||
device_cert_ = data;
|
||||
@@ -76,12 +78,12 @@ bool TestHost::write(const std::string& name, const std::string& data) {
|
||||
bool TestHost::exists(const std::string& name) {
|
||||
StorageMap::iterator it = files_.find(name);
|
||||
bool ok = it != files_.end();
|
||||
LOGD("exists? %s: %s", name.c_str(), ok ? "true" : "false");
|
||||
LOGV("exists? %s: %s", name.c_str(), ok ? "true" : "false");
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TestHost::remove(const std::string& name) {
|
||||
LOGD("remove: %s", name.c_str());
|
||||
LOGV("remove: %s", name.c_str());
|
||||
if (name.empty()) {
|
||||
// If no name, delete all files (see DeviceFiles::DeleteAllFiles())
|
||||
files_.clear();
|
||||
|
||||
Reference in New Issue
Block a user