run android/copy_files from cdm repo to sync files in Android tm-widevine-release. Changes include: 1. Update ODK to 17.1 2. update in license_protocol.proto 3. updates in oemcrypto unit tests 4. A few cdm and util test updates 5. Prov4 unit test fixes Originating CLs: https://widevine-internal-review.googlesource.com/c/cdm/+/155289/ https://widevine-internal-review.googlesource.com/c/cdm/+/155429/ https://widevine-internal-review.googlesource.com/c/cdm/+/155430/ https://widevine-internal-review.googlesource.com/c/cdm/+/154415/ https://widevine-internal-review.googlesource.com/c/cdm/+/156457/ https://widevine-internal-review.googlesource.com/c/cdm/+/156878/ https://widevine-internal-review.googlesource.com/c/cdm/+/156879/ https://widevine-internal-review.googlesource.com/c/cdm/+/156425/ https://widevine-internal-review.googlesource.com/c/cdm/+/156486/ https://widevine-internal-review.googlesource.com/c/cdm/+/156539/ https://widevine-internal-review.googlesource.com/c/cdm/+/156542/ Test: ran oemcrypto unit tests and ODK tests Test: ran gts media test cases Bug: 239201888 Change-Id: Iad9aff72aec5ba42296582837f34dd704bc11810
45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
// Copyright 2019 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine License
|
|
// Agreement.
|
|
//
|
|
// Clock - A fake clock just for running tests. This is used when running
|
|
// OEMCrypto unit tests. It is not used when tests include the CE CDM source
|
|
// code because that uses the clock in cdm/test_host.cpp instead.
|
|
|
|
#include <chrono>
|
|
|
|
#include "clock.h"
|
|
#include "test_sleep.h"
|
|
|
|
namespace wvutil {
|
|
|
|
namespace {
|
|
// A fake clock that only advances when TestSleep::Sleep is called.
|
|
class FakeClock : public TestSleep::CallBack {
|
|
public:
|
|
FakeClock() {
|
|
auto now = std::chrono::system_clock().now();
|
|
now_ = now.time_since_epoch() / std::chrono::milliseconds(1);
|
|
TestSleep::set_callback(this);
|
|
}
|
|
~FakeClock() { TestSleep::set_callback(nullptr); }
|
|
void ElapseTime(int64_t milliseconds) { now_ += milliseconds; }
|
|
|
|
int64_t now() const { return now_; }
|
|
|
|
private:
|
|
int64_t now_;
|
|
};
|
|
|
|
FakeClock* g_fake_clock = nullptr;
|
|
} // namespace
|
|
|
|
// On devices running a fake OEMCrypto, we can use a fake sleep and fake time.
|
|
int64_t Clock::GetCurrentTime() {
|
|
TestSleep::SyncFakeClock();
|
|
if (g_fake_clock == nullptr) g_fake_clock = new FakeClock();
|
|
return g_fake_clock->now() / 1000;
|
|
}
|
|
|
|
} // namespace wvutil
|