Delete assumption TimeMicrosToNtp can match RealTimeClock

Flakiness of the test reveals this assumption doesn't hold and shouldn't be rely on.
Currently there is no code that use it. Plans to rely on it silently adjusted.

Bug: webrtc:8610
Change-Id: Id24f2a36c8fb188b518f5301c4b278836885d140
Reviewed-on: https://webrtc-review.googlesource.com/56860
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22160}
This commit is contained in:
Danil Chapovalov
2018-02-22 16:34:50 +01:00
committed by Commit Bot
parent 6ce03592c6
commit 89c79383e4
2 changed files with 2 additions and 25 deletions

View File

@ -16,29 +16,6 @@
namespace webrtc {
// Disabled as flake: http://bugs.webrtc.org/8610
#ifdef WEBRTC_IOS
#define MAYBE_TimeMicrosToNtpMatchRealTimeClockInitially \
DISABLED_TimeMicrosToNtpMatchRealTimeClockInitially
#else
#define MAYBE_TimeMicrosToNtpMatchRealTimeClockInitially \
TimeMicrosToNtpMatchRealTimeClockInitially
#endif
TEST(TimeUtilTest, MAYBE_TimeMicrosToNtpMatchRealTimeClockInitially) {
Clock* legacy_clock = Clock::GetRealTimeClock();
NtpTime before_legacy_time = TimeMicrosToNtp(rtc::TimeMicros());
NtpTime legacy_time = legacy_clock->CurrentNtpTime();
NtpTime after_legacy_time = TimeMicrosToNtp(rtc::TimeMicros());
// This test will fail once every 136 years, when NtpTime wraparound.
// More often than that, it will fail if system adjust ntp time while test
// is running.
// To mitigate ntp time adjustment and potentional different precisions of
// Clock and TimeMicrosToNtp, relax expectation by a millisecond.
EXPECT_GE(legacy_time.ToMs(), before_legacy_time.ToMs() - 1);
EXPECT_LE(legacy_time.ToMs(), after_legacy_time.ToMs() + 1);
}
TEST(TimeUtilTest, TimeMicrosToNtpDoesntChangeBetweenRuns) {
rtc::ScopedFakeClock clock;
// TimeMicrosToNtp is not pure: it behave differently between different