Fix TimeRollbackPrevention Test
(This is a merge of http://go/wvgerrit/107243.) This code is based on a bug report and patch from Sony. The TimeRollbackPrevention test was failing when run with CE CDM and the OEC Ref, although it passed in some other configurations. The cause was twofold: 1) The test sleep code was not accounting for rollback when calculating the clock drift, causing incorrect time values to elapse. 2) Fixing the previous exposed a bug in the CE CDM test host where it did not handle negative time passing correctly. This patch expands Sony's fix with additional comments and some code cleanup to try to make the code clearer and more robust against future errors, particularly in the error-prone TestHost code. Bug: 169942369 Test: jenkins/ce_cdm_tests Test: build_and_run_all_unit_tests.sh Test: x86-64, all CE CDM unit tests Change-Id: Id52b8c38255f70b04bc2735c4e309fb90992f53e
This commit is contained in:
@@ -44,8 +44,8 @@ class TestSleep {
|
||||
// Roll the system clock forward to undo all previous calls to
|
||||
// RollBackSystemTime. Returns true on success.
|
||||
static bool ResetRollback() {
|
||||
return total_clock_rollback_ == 0 ||
|
||||
RollbackSystemTime(-total_clock_rollback_);
|
||||
return total_clock_rollback_seconds_ == 0 ||
|
||||
RollbackSystemTime(-total_clock_rollback_seconds_);
|
||||
}
|
||||
|
||||
// Returns true if the system time can be rolled back. This is true on some
|
||||
@@ -67,7 +67,7 @@ class TestSleep {
|
||||
static CallBack* callback_;
|
||||
// The sum of all calls to RollBackSystemTime. Kept so we can undo all changes
|
||||
// at the end of a test.
|
||||
static int total_clock_rollback_;
|
||||
static int total_clock_rollback_seconds_;
|
||||
};
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
Reference in New Issue
Block a user