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

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

Issue 1772143002: Use network time for bad clock interstitial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IOS Created 4 years, 9 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/ssl/ssl_browser_tests.cc
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index 0f0c4656d414f90b1d0ac19b2d451207fa3b39ee..994c3feb0380a12aad3a2fa01cb411dded3c176b 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -49,6 +49,7 @@
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
+#include "components/network_time/network_time_tracker.h"
#include "components/prefs/pref_service.h"
#include "components/security_interstitials/core/controller_client.h"
#include "components/security_interstitials/core/metrics_helper.h"
@@ -523,12 +524,13 @@ class SSLUITest
ASSERT_TRUE(https_server_expired_.Start());
ASSERT_NO_FATAL_FAILURE(SetUpMockReporter());
- // Set up the build and current clock times to be more than a year apart.
- scoped_ptr<base::SimpleTestClock> mock_clock(new base::SimpleTestClock());
- mock_clock->SetNow(base::Time::NowFromSystemTime());
- mock_clock->Advance(base::TimeDelta::FromDays(367));
- SSLErrorHandler::SetClockForTest(mock_clock.get());
- ssl_errors::SetBuildTimeForTesting(base::Time::NowFromSystemTime());
+ // Set network time back ten minutes, which is sufficient to
+ // trigger the interstitial.
+ g_browser_process->network_time_tracker()->UpdateNetworkTime(
+ base::Time::Now() - base::TimeDelta::FromMinutes(10),
+ base::TimeDelta::FromMilliseconds(1), /* resolution */
+ base::TimeDelta::FromMilliseconds(500), /* latency */
+ base::TimeTicks::Now() /* posting time of this update */);
// Opt in to sending reports for invalid certificate chains.
certificate_reporting_test_utils::SetCertReportingOptIn(browser, opt_in);

Powered by Google App Engine
This is Rietveld 408576698