| 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 11 matching lines...) Expand all Loading... |
| 22 #include "net/test/cert_test_util.h" | 22 #include "net/test/cert_test_util.h" |
| 23 #include "net/test/test_certificate_data.h" | 23 #include "net/test/test_certificate_data.h" |
| 24 #include "net/test/test_data_directory.h" | 24 #include "net/test/test_data_directory.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 class SSLErrorHandlerForTest : public SSLErrorHandler { | 27 class SSLErrorHandlerForTest : public SSLErrorHandler { |
| 28 public: | 28 public: |
| 29 SSLErrorHandlerForTest(Profile* profile, | 29 SSLErrorHandlerForTest(Profile* profile, |
| 30 content::WebContents* web_contents, | 30 content::WebContents* web_contents, |
| 31 const net::SSLInfo& ssl_info) | 31 const net::SSLInfo& ssl_info) |
| 32 : SSLErrorHandler(web_contents, | 32 : SSLErrorHandler( |
| 33 net::ERR_CERT_COMMON_NAME_INVALID, | 33 web_contents, |
| 34 ssl_info, | 34 net::ERR_CERT_COMMON_NAME_INVALID, |
| 35 GURL(), | 35 ssl_info, |
| 36 0, | 36 GURL(), |
| 37 nullptr, | 37 0, |
| 38 base::Callback<void(bool)>()), | 38 nullptr, |
| 39 base::Callback<void(content::CertificateRequestResultType)>()), |
| 39 profile_(profile), | 40 profile_(profile), |
| 40 captive_portal_checked_(false), | 41 captive_portal_checked_(false), |
| 41 suggested_url_exists_(false), | 42 suggested_url_exists_(false), |
| 42 suggested_url_checked_(false), | 43 suggested_url_checked_(false), |
| 43 ssl_interstitial_shown_(false), | 44 ssl_interstitial_shown_(false), |
| 44 captive_portal_interstitial_shown_(false), | 45 captive_portal_interstitial_shown_(false), |
| 45 redirected_to_suggested_url_(false), | 46 redirected_to_suggested_url_(false), |
| 46 is_overridable_error_(true) {} | 47 is_overridable_error_(true) {} |
| 47 | 48 |
| 48 using SSLErrorHandler::StartHandlingError; | 49 using SSLErrorHandler::StartHandlingError; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 // Fake an Invalid Suggested URL Check result. | 331 // Fake an Invalid Suggested URL Check result. |
| 331 error_handler()->SendSuggestedUrlCheckResult( | 332 error_handler()->SendSuggestedUrlCheckResult( |
| 332 CommonNameMismatchHandler::SuggestedUrlCheckResult:: | 333 CommonNameMismatchHandler::SuggestedUrlCheckResult:: |
| 333 SUGGESTED_URL_NOT_AVAILABLE, | 334 SUGGESTED_URL_NOT_AVAILABLE, |
| 334 GURL()); | 335 GURL()); |
| 335 | 336 |
| 336 EXPECT_FALSE(error_handler()->IsTimerRunning()); | 337 EXPECT_FALSE(error_handler()->IsTimerRunning()); |
| 337 EXPECT_TRUE(error_handler()->ssl_interstitial_shown()); | 338 EXPECT_TRUE(error_handler()->ssl_interstitial_shown()); |
| 338 EXPECT_FALSE(error_handler()->redirected_to_suggested_url()); | 339 EXPECT_FALSE(error_handler()->redirected_to_suggested_url()); |
| 339 } | 340 } |
| OLD | NEW |