Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Unified Diff: components/network_time/network_time_tracker.cc

Issue 2421143002: Fix broken clockstate.network2 histogram and add unit test (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/network_time/network_time_tracker.cc
diff --git a/components/network_time/network_time_tracker.cc b/components/network_time/network_time_tracker.cc
index d33de06568655a2f6a136e9a4ba7125385a8f8db..19e02b937ab40cb6e55689667de26e7e3e8b2c5c 100644
--- a/components/network_time/network_time_tracker.cc
+++ b/components/network_time/network_time_tracker.cc
@@ -305,6 +305,10 @@ base::TimeDelta NetworkTimeTracker::GetTimerDelayForTesting() const {
return timer_.GetCurrentDelay();
}
+void NetworkTimeTracker::EnableTimeQueriesForTesting() {
+ enable_time_queries_for_testing_ = true;
meacer 2016/10/17 23:45:48 If you want to keep the bool as is, I feel like fo
+}
+
NetworkTimeTracker::NetworkTimeResult NetworkTimeTracker::GetNetworkTime(
base::Time* network_time,
base::TimeDelta* uncertainty) const {
@@ -500,7 +504,8 @@ void NetworkTimeTracker::QueueCheckTime(base::TimeDelta delay) {
bool NetworkTimeTracker::ShouldIssueTimeQuery() {
// Do not query the time service if not enabled via Variations Service.
- if (!base::FeatureList::IsEnabled(kNetworkTimeServiceQuerying)) {
+ if (!base::FeatureList::IsEnabled(kNetworkTimeServiceQuerying) &&
+ !enable_time_queries_for_testing_) {
meacer 2016/10/17 21:35:20 Instead of adding a bool, can the test force enabl
estark 2016/10/17 21:45:37 It's possible, but it's takes an annoying large am
meacer 2016/10/17 23:45:48 Unless you want to refactor that code, I think thi
estark 2016/10/18 03:58:37 I like that idea, done.
return false;
}

Powered by Google App Engine
This is Rietveld 408576698