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

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

Issue 2610183004: Wrap SSL error handler configuration with a lazy instance (Closed)
Patch Set: Add ForTesting to config setter methods Created 3 years, 11 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/captive_portal/captive_portal_browsertest.cc ('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_browser_tests.cc
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index 68c9e2a7d06a635d99b3d85e9f674aaf66cbb11e..539de5da88f7e988e1b95e6854f83ac261af6238 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -214,11 +214,11 @@ class SSLInterstitialTimerObserver {
: web_contents_(web_contents), message_loop_runner_(new base::RunLoop) {
callback_ = base::Bind(&SSLInterstitialTimerObserver::OnTimerStarted,
base::Unretained(this));
- SSLErrorHandler::SetInterstitialTimerStartedCallbackForTest(&callback_);
+ SSLErrorHandler::SetInterstitialTimerStartedCallbackForTesting(&callback_);
}
~SSLInterstitialTimerObserver() {
- SSLErrorHandler::SetInterstitialTimerStartedCallbackForTest(nullptr);
+ SSLErrorHandler::SetInterstitialTimerStartedCallbackForTesting(nullptr);
}
// Waits until the interstitial delay timer in SSLErrorHandler is started.
@@ -962,7 +962,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorCausedByClockUsingBuildTime) {
new base::SimpleTestClock());
mock_clock->SetNow(base::Time::NowFromSystemTime());
mock_clock->Advance(base::TimeDelta::FromDays(367));
- SSLErrorHandler::SetClockForTest(mock_clock.get());
+ SSLErrorHandler::SetClockForTesting(mock_clock.get());
ssl_errors::SetBuildTimeForTesting(base::Time::NowFromSystemTime());
ui_test_utils::NavigateToURL(browser(),
@@ -2804,7 +2804,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest,
base::SimpleTestClock mock_clock;
mock_clock.SetNow(base::Time::NowFromSystemTime());
mock_clock.Advance(base::TimeDelta::FromDays(367));
- SSLErrorHandler::SetClockForTest(&mock_clock);
+ SSLErrorHandler::SetClockForTesting(&mock_clock);
ssl_errors::SetBuildTimeForTesting(base::Time::NowFromSystemTime());
ui_test_utils::NavigateToURL(browser(),
@@ -3072,7 +3072,7 @@ IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, OnDemandFetchClockOk) {
// Use a testing clock set to the time that GoodTimeResponseHandler
// returns, to simulate the system clock matching the network time.
base::SimpleTestClock testing_clock;
- SSLErrorHandler::SetClockForTest(&testing_clock);
+ SSLErrorHandler::SetClockForTesting(&testing_clock);
testing_clock.SetNow(
base::Time::FromJsTime(network_time::kGoodTimeResponseHandlerJsTime));
// Set the build time to match the testing clock, to ensure that the
@@ -3080,7 +3080,8 @@ IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, OnDemandFetchClockOk) {
ssl_errors::SetBuildTimeForTesting(testing_clock.Now());
// Set a long timeout to ensure that the on-demand time fetch completes.
- SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta::FromHours(1));
+ SSLErrorHandler::SetInterstitialDelayForTesting(
+ base::TimeDelta::FromHours(1));
WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(contents);
@@ -3122,7 +3123,7 @@ IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, OnDemandFetchClockWrong) {
// GoodTimeResponseHandler returns, simulating a system clock that is
// 30 days ahead of the network time.
base::SimpleTestClock testing_clock;
- SSLErrorHandler::SetClockForTest(&testing_clock);
+ SSLErrorHandler::SetClockForTesting(&testing_clock);
testing_clock.SetNow(
base::Time::FromJsTime(network_time::kGoodTimeResponseHandlerJsTime));
testing_clock.Advance(base::TimeDelta::FromDays(30));
@@ -3131,7 +3132,8 @@ IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, OnDemandFetchClockWrong) {
ssl_errors::SetBuildTimeForTesting(testing_clock.Now());
// Set a long timeout to ensure that the on-demand time fetch completes.
- SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta::FromHours(1));
+ SSLErrorHandler::SetInterstitialDelayForTesting(
+ base::TimeDelta::FromHours(1));
WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(contents);
@@ -3172,7 +3174,7 @@ IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest,
TimeoutExpiresBeforeFetchCompletes) {
ASSERT_TRUE(https_server_expired_.Start());
// Set the timer to fire immediately.
- SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta());
+ SSLErrorHandler::SetInterstitialDelayForTesting(base::TimeDelta());
ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/"));
WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
@@ -3198,7 +3200,8 @@ IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest,
IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, StopBeforeTimeoutExpires) {
ASSERT_TRUE(https_server_expired_.Start());
// Set the timer to a long delay.
- SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta::FromHours(1));
+ SSLErrorHandler::SetInterstitialDelayForTesting(
+ base::TimeDelta::FromHours(1));
WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(contents);
@@ -3234,7 +3237,8 @@ IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, StopBeforeTimeoutExpires) {
IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, ReloadBeforeTimeoutExpires) {
ASSERT_TRUE(https_server_expired_.Start());
// Set the timer to a long delay.
- SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta::FromHours(1));
+ SSLErrorHandler::SetInterstitialDelayForTesting(
+ base::TimeDelta::FromHours(1));
WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
SSLInterstitialTimerObserver interstitial_timer_observer(contents);
@@ -3270,7 +3274,8 @@ IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest,
ASSERT_TRUE(https_server_expired_.Start());
ASSERT_TRUE(https_server_.Start());
// Set the timer to a long delay.
- SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta::FromHours(1));
+ SSLErrorHandler::SetInterstitialDelayForTesting(
+ base::TimeDelta::FromHours(1));
WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
SSLInterstitialTimerObserver interstitial_timer_observer(contents);
@@ -3305,7 +3310,7 @@ IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest,
CloseTabBeforeNetworkFetchCompletes) {
ASSERT_TRUE(https_server_expired_.Start());
// Set the timer to fire immediately.
- SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta());
+ SSLErrorHandler::SetInterstitialDelayForTesting(base::TimeDelta());
ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/"));
WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
@@ -3510,7 +3515,8 @@ IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest,
CommonNameMismatchHandler::set_state_for_testing(
CommonNameMismatchHandler::IGNORE_REQUESTS_FOR_TESTING);
// Set delay long enough so that the page appears loading.
- SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta::FromHours(1));
+ SSLErrorHandler::SetInterstitialDelayForTesting(
+ base::TimeDelta::FromHours(1));
SSLInterstitialTimerObserver interstitial_timer_observer(contents);
ui_test_utils::NavigateToURLWithDisposition(
@@ -3578,7 +3584,8 @@ IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest,
CommonNameMismatchHandler::set_state_for_testing(
CommonNameMismatchHandler::IGNORE_REQUESTS_FOR_TESTING);
// Set delay long enough so that the page appears loading.
- SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta::FromHours(1));
+ SSLErrorHandler::SetInterstitialDelayForTesting(
+ base::TimeDelta::FromHours(1));
SSLInterstitialTimerObserver interstitial_timer_observer(contents);
ui_test_utils::NavigateToURLWithDisposition(
@@ -3644,7 +3651,8 @@ IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest,
CommonNameMismatchHandler::set_state_for_testing(
CommonNameMismatchHandler::IGNORE_REQUESTS_FOR_TESTING);
// Set delay long enough so that the page appears loading.
- SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta::FromHours(1));
+ SSLErrorHandler::SetInterstitialDelayForTesting(
+ base::TimeDelta::FromHours(1));
SSLInterstitialTimerObserver interstitial_timer_observer(contents);
ui_test_utils::NavigateToURLWithDisposition(
« no previous file with comments | « chrome/browser/captive_portal/captive_portal_browsertest.cc ('k') | chrome/browser/ssl/ssl_error_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698