Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ssl/ssl_error_handler.h" | 5 #include "chrome/browser/ssl/ssl_error_handler.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 clock_->Advance(base::TimeDelta::FromDays(111)); | 216 clock_->Advance(base::TimeDelta::FromDays(111)); |
| 217 tick_clock_->Advance(base::TimeDelta::FromDays(222)); | 217 tick_clock_->Advance(base::TimeDelta::FromDays(222)); |
| 218 | 218 |
| 219 SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta()); | 219 SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta()); |
| 220 ssl_info_.cert = | 220 ssl_info_.cert = |
| 221 net::ImportCertFromFile(net::GetTestCertsDirectory(), "ok_cert.pem"); | 221 net::ImportCertFromFile(net::GetTestCertsDirectory(), "ok_cert.pem"); |
| 222 ssl_info_.cert_status = net::CERT_STATUS_DATE_INVALID; | 222 ssl_info_.cert_status = net::CERT_STATUS_DATE_INVALID; |
| 223 error_handler_.reset( | 223 error_handler_.reset( |
| 224 new SSLErrorHandlerForTest(profile(), web_contents(), ssl_info_)); | 224 new SSLErrorHandlerForTest(profile(), web_contents(), ssl_info_)); |
| 225 error_handler_->SetNetworkTimeTrackerForTest(tracker_.get()); | 225 error_handler_->SetNetworkTimeTrackerForTest(tracker_.get()); |
| 226 | |
| 227 // Fix flakiness in case system time is off and tiggers a bad clock | |
|
estark
2016/12/01 00:17:21
typo: tiggers => triggers
also perhaps it would b
| |
| 228 // interstitial. | |
| 229 ssl_errors::SetBuildTimeForTesting(base::Time::Now()); | |
| 226 } | 230 } |
| 227 | 231 |
| 228 void TearDown() override { | 232 void TearDown() override { |
| 229 if (error_handler()) { | 233 if (error_handler()) { |
| 230 EXPECT_FALSE(error_handler()->IsTimerRunning()); | 234 EXPECT_FALSE(error_handler()->IsTimerRunning()); |
| 231 error_handler_.reset(nullptr); | 235 error_handler_.reset(nullptr); |
| 232 } | 236 } |
| 233 ChromeRenderViewHostTestHarness::TearDown(); | 237 ChromeRenderViewHostTestHarness::TearDown(); |
| 234 } | 238 } |
| 235 | 239 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 EXPECT_TRUE(error_handler()->ssl_interstitial_shown()); | 521 EXPECT_TRUE(error_handler()->ssl_interstitial_shown()); |
| 518 EXPECT_FALSE(error_handler()->IsTimerRunning()); | 522 EXPECT_FALSE(error_handler()->IsTimerRunning()); |
| 519 | 523 |
| 520 // Clear the error handler to test that, when the request completes, | 524 // Clear the error handler to test that, when the request completes, |
| 521 // it doesn't try to call a callback on a deleted SSLErrorHandler. | 525 // it doesn't try to call a callback on a deleted SSLErrorHandler. |
| 522 ClearErrorHandler(); | 526 ClearErrorHandler(); |
| 523 | 527 |
| 524 // Shut down the server to cancel the pending request. | 528 // Shut down the server to cancel the pending request. |
| 525 ASSERT_TRUE(test_server()->ShutdownAndWaitUntilComplete()); | 529 ASSERT_TRUE(test_server()->ShutdownAndWaitUntilComplete()); |
| 526 } | 530 } |
| OLD | NEW |