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" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "chrome/browser/captive_portal/captive_portal_service.h" | 12 #include "chrome/browser/captive_portal/captive_portal_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ssl/common_name_mismatch_handler.h" | 14 #include "chrome/browser/ssl/common_name_mismatch_handler.h" |
15 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 15 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
17 #include "components/captive_portal/captive_portal_testing_utils.h" | 17 #include "components/captive_portal/captive_portal_testing_utils.h" |
18 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
20 #include "net/base/test_data_directory.h" | |
21 #include "net/cert/x509_certificate.h" | 20 #include "net/cert/x509_certificate.h" |
22 #include "net/ssl/ssl_info.h" | 21 #include "net/ssl/ssl_info.h" |
23 #include "net/test/cert_test_util.h" | 22 #include "net/test/cert_test_util.h" |
24 #include "net/test/test_certificate_data.h" | 23 #include "net/test/test_certificate_data.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(web_contents, |
33 net::ERR_CERT_COMMON_NAME_INVALID, | 33 net::ERR_CERT_COMMON_NAME_INVALID, |
34 ssl_info, | 34 ssl_info, |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // Fake an Invalid Suggested URL Check result. | 330 // Fake an Invalid Suggested URL Check result. |
331 error_handler()->SendSuggestedUrlCheckResult( | 331 error_handler()->SendSuggestedUrlCheckResult( |
332 CommonNameMismatchHandler::SuggestedUrlCheckResult:: | 332 CommonNameMismatchHandler::SuggestedUrlCheckResult:: |
333 SUGGESTED_URL_NOT_AVAILABLE, | 333 SUGGESTED_URL_NOT_AVAILABLE, |
334 GURL()); | 334 GURL()); |
335 | 335 |
336 EXPECT_FALSE(error_handler()->IsTimerRunning()); | 336 EXPECT_FALSE(error_handler()->IsTimerRunning()); |
337 EXPECT_TRUE(error_handler()->ssl_interstitial_shown()); | 337 EXPECT_TRUE(error_handler()->ssl_interstitial_shown()); |
338 EXPECT_FALSE(error_handler()->redirected_to_suggested_url()); | 338 EXPECT_FALSE(error_handler()->redirected_to_suggested_url()); |
339 } | 339 } |
OLD | NEW |