(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