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

Unified Diff: chrome/browser/safe_browsing/protocol_manager.cc

Issue 160225: Fix the root cause of flakiness in SafeBrowsingProtocolManagerTest.TestGetHashBackOffTimes (Closed)
Patch Set: Created 11 years, 5 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: chrome/browser/safe_browsing/protocol_manager.cc
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index 974016195fd7e804ce672ea52025861c8223ab7d..a720bcc28adc3b1ee51930f21c8928f7fabb60dd 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -222,7 +222,7 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete(
HandleReKey();
}
} else if (response_code >= 300) {
- HandleGetHashError();
+ HandleGetHashError(Time::Now());
SB_DLOG(INFO) << "SafeBrowsing GetHash request for: " << source->url()
<< ", failed with error: " << response_code;
}
@@ -626,9 +626,9 @@ void SafeBrowsingProtocolManager::HandleReKey() {
IssueKeyRequest();
}
-void SafeBrowsingProtocolManager::HandleGetHashError() {
+void SafeBrowsingProtocolManager::HandleGetHashError(const Time& now) {
int next = GetNextBackOffTime(&gethash_error_count_, &gethash_back_off_mult_);
- next_gethash_time_ = Time::Now() + TimeDelta::FromSeconds(next);
+ next_gethash_time_ = now + TimeDelta::FromSeconds(next);
}
void SafeBrowsingProtocolManager::UpdateFinished(bool success) {
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager.h ('k') | chrome/browser/safe_browsing/protocol_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698