Source release v3.5.0
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
|
||||
using namespace widevine;
|
||||
|
||||
namespace {
|
||||
const std::string kCertificateFilename = "cert.bin";
|
||||
} // namespace
|
||||
|
||||
TestHost::TestHost() {
|
||||
Reset();
|
||||
}
|
||||
@@ -19,14 +23,17 @@ void TestHost::Reset() {
|
||||
gettimeofday(&tv, NULL);
|
||||
now_ = (tv.tv_sec * 1000LL) + (tv.tv_usec / 1000LL);
|
||||
|
||||
save_device_cert_ = false;
|
||||
|
||||
// Surprisingly, std::priority_queue has no clear().
|
||||
while (!timers_.empty()) {
|
||||
timers_.pop();
|
||||
}
|
||||
|
||||
files_.clear();
|
||||
files_["cert.bin"] =
|
||||
std::string((const char*)kDeviceCert, kDeviceCertSize);
|
||||
files_[kCertificateFilename.c_str()] = (device_cert_.size() > 0)
|
||||
? device_cert_
|
||||
: std::string((const char*)kDeviceCert, kDeviceCertSize);
|
||||
}
|
||||
|
||||
void TestHost::ElapseTime(int64_t milliseconds) {
|
||||
@@ -37,9 +44,9 @@ void TestHost::ElapseTime(int64_t milliseconds) {
|
||||
} else {
|
||||
Timer t = timers_.top();
|
||||
timers_.pop();
|
||||
ASSERT_GE(t.expiry_time, now_);
|
||||
now_ = t.expiry_time;
|
||||
t.client->onTimerExpired(t.context);
|
||||
ASSERT_GE(t.expiry_time(), now_);
|
||||
now_ = t.expiry_time();
|
||||
t.client()->onTimerExpired(t.context());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,6 +67,10 @@ bool TestHost::write(const std::string& name,
|
||||
const std::string& data) {
|
||||
LOGD("write file: %s", name.c_str());
|
||||
files_[name] = data;
|
||||
if (save_device_cert_ && kCertificateFilename.compare(name) == 0) {
|
||||
device_cert_ = data;
|
||||
save_device_cert_ = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -114,7 +125,7 @@ void TestHost::cancel(IClient* client) {
|
||||
Timer t = timers_.top();
|
||||
timers_.pop();
|
||||
|
||||
if (t.client != client) {
|
||||
if (t.client() != client) {
|
||||
others.push(t);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user