Commit 9f3e50ad authored by Dan Harrington's avatar Dan Harrington Committed by Commit Bot

offline_metrics_collector_impl_unittest was broke due to DST

Using Time::Now() resulted in a test breakage due to daylight savings time.
Specifically, given Time t, (t+TimeDelta::FromDays(1)).LocalMidnight() results
in the same day due to DST.

To fix, I changed to use a fixed date.

Change-Id: I6278c3dce4654910589649b8f724b240ae983195
Reviewed-on: https://chromium-review.googlesource.com/c/1314614Reviewed-by: default avatarJustin DeWitt <dewittj@chromium.org>
Commit-Queue: Dan H <harringtond@google.com>
Cr-Commit-Position: refs/heads/master@{#605044}
parent 23af711f
...@@ -27,7 +27,9 @@ class OfflineMetricsCollectorTest : public testing::Test { ...@@ -27,7 +27,9 @@ class OfflineMetricsCollectorTest : public testing::Test {
// testing::Test: // testing::Test:
void SetUp() override { void SetUp() override {
test_clock().SetNow(base::Time::Now().LocalMidnight()); base::Time epoch;
ASSERT_TRUE(base::Time::FromUTCString("1 Jan 1994 GMT", &epoch));
test_clock().SetNow(epoch.LocalMidnight());
OfflineMetricsCollectorImpl::RegisterPrefs(pref_service_.registry()); OfflineMetricsCollectorImpl::RegisterPrefs(pref_service_.registry());
Reload(); Reload();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment