Sync fake clock for nonce tests

Because the fake clock is getting out of sync with the real clock
for the nonce flood tests, add a call to TestSleep::SyncFakeClock()
in Clock::GetCurrentTime() to force a sync.

Merged from http://go/wvgerrit/132883

Test: duration_use_case_test and nonce flood tests on bonito
Bug: 198329759
Change-Id: I2d66032a88dd0996252f1c31aee250246e6868fe
This commit is contained in:
Vicky Min
2021-09-01 22:13:10 +00:00
parent 7d91a78cb5
commit 3ca173fa16

View File

@@ -35,6 +35,7 @@ FakeClock* g_fake_clock = nullptr;
// On devices running a fake OEMCrypto, we can use a fake sleep and fake time.
int64_t Clock::GetCurrentTime() {
wvcdm::TestSleep::SyncFakeClock();
if (g_fake_clock == nullptr) g_fake_clock = new FakeClock();
return g_fake_clock->now() / 1000;
}