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

Unified Diff: chrome/browser/ssl/ssl_error_classification.cc

Issue 1317593002: Have SSLErrorHandler decide which type of interstitial to display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 5 years, 4 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
« no previous file with comments | « chrome/browser/ssl/ssl_error_classification.h ('k') | chrome/browser/ssl/ssl_error_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ssl/ssl_error_classification.cc
diff --git a/chrome/browser/ssl/ssl_error_classification.cc b/chrome/browser/ssl/ssl_error_classification.cc
index dc953fa3afa0ba2ea0949d5e73e941391a7af654..765209d6983750ad7dc55994ca4ad347cf5cc501 100644
--- a/chrome/browser/ssl/ssl_error_classification.cc
+++ b/chrome/browser/ssl/ssl_error_classification.cc
@@ -117,6 +117,9 @@ int GetLevensteinDistance(const std::string& str1,
return kSecondRow[str2.size()];
}
+// The time to use when doing build time operations in browser tests.
+base::Time g_testing_build_time;
+
} // namespace
SSLErrorClassification::SSLErrorClassification(
@@ -242,26 +245,44 @@ base::TimeDelta SSLErrorClassification::TimePassedSinceExpiry() const {
}
bool SSLErrorClassification::IsUserClockInThePast(const base::Time& time_now) {
+ base::Time build_time;
+ if (!g_testing_build_time.is_null()) {
+ build_time = g_testing_build_time;
+ } else {
#if defined(DONT_EMBED_BUILD_METADATA) && !defined(OFFICIAL_BUILD)
- return false;
+ return false;
#else
- base::Time build_time = base::GetBuildTime();
+ build_time = base::GetBuildTime();
+#endif
+ }
+
if (time_now < build_time - base::TimeDelta::FromDays(2))
return true;
return false;
-#endif
}
bool SSLErrorClassification::IsUserClockInTheFuture(
const base::Time& time_now) {
+ base::Time build_time;
+ if (!g_testing_build_time.is_null()) {
+ build_time = g_testing_build_time;
+ } else {
#if defined(DONT_EMBED_BUILD_METADATA) && !defined(OFFICIAL_BUILD)
- return false;
+ return false;
#else
- base::Time build_time = base::GetBuildTime();
+ build_time = base::GetBuildTime();
+#endif
+ }
+
if (time_now > build_time + base::TimeDelta::FromDays(365))
return true;
return false;
-#endif
+}
+
+// static
+void SSLErrorClassification::SetBuildTimeForTesting(
+ const base::Time& testing_time) {
+ g_testing_build_time = testing_time;
}
bool SSLErrorClassification::MaybeWindowsLacksSHA256Support() {
« no previous file with comments | « chrome/browser/ssl/ssl_error_classification.h ('k') | chrome/browser/ssl/ssl_error_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698