| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/security_state/security_state_model.h" | 5 #include "components/security_state/security_state_model.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "components/security_state/security_state_model_client.h" | 9 #include "components/security_state/security_state_model_client.h" |
| 10 #include "net/cert/x509_certificate.h" | 10 #include "net/cert/x509_certificate.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // content. | 105 // content. |
| 106 TEST(SecurityStateModelTest, SHA1WarningMixedContent) { | 106 TEST(SecurityStateModelTest, SHA1WarningMixedContent) { |
| 107 TestSecurityStateModelClient client; | 107 TestSecurityStateModelClient client; |
| 108 SecurityStateModel model; | 108 SecurityStateModel model; |
| 109 model.SetClient(&client); | 109 model.SetClient(&client); |
| 110 client.SetDisplayedMixedContent(true); | 110 client.SetDisplayedMixedContent(true); |
| 111 const SecurityStateModel::SecurityInfo& security_info1 = | 111 const SecurityStateModel::SecurityInfo& security_info1 = |
| 112 model.GetSecurityInfo(); | 112 model.GetSecurityInfo(); |
| 113 EXPECT_EQ(SecurityStateModel::DEPRECATED_SHA1_MINOR, | 113 EXPECT_EQ(SecurityStateModel::DEPRECATED_SHA1_MINOR, |
| 114 security_info1.sha1_deprecation_status); | 114 security_info1.sha1_deprecation_status); |
| 115 EXPECT_EQ(SecurityStateModel::DISPLAYED_MIXED_CONTENT, | 115 EXPECT_EQ(SecurityStateModel::CONTENT_STATUS_DISPLAYED, |
| 116 security_info1.mixed_content_status); | 116 security_info1.mixed_content_status); |
| 117 EXPECT_EQ(SecurityStateModel::NONE, security_info1.security_level); | 117 EXPECT_EQ(SecurityStateModel::NONE, security_info1.security_level); |
| 118 | 118 |
| 119 client.set_initial_security_level(SecurityStateModel::SECURITY_ERROR); | 119 client.set_initial_security_level(SecurityStateModel::SECURITY_ERROR); |
| 120 client.SetDisplayedMixedContent(false); | 120 client.SetDisplayedMixedContent(false); |
| 121 client.SetRanMixedContent(true); | 121 client.SetRanMixedContent(true); |
| 122 const SecurityStateModel::SecurityInfo& security_info2 = | 122 const SecurityStateModel::SecurityInfo& security_info2 = |
| 123 model.GetSecurityInfo(); | 123 model.GetSecurityInfo(); |
| 124 EXPECT_EQ(SecurityStateModel::DEPRECATED_SHA1_MINOR, | 124 EXPECT_EQ(SecurityStateModel::DEPRECATED_SHA1_MINOR, |
| 125 security_info2.sha1_deprecation_status); | 125 security_info2.sha1_deprecation_status); |
| 126 EXPECT_EQ(SecurityStateModel::RAN_MIXED_CONTENT, | 126 EXPECT_EQ(SecurityStateModel::CONTENT_STATUS_RAN, |
| 127 security_info2.mixed_content_status); | 127 security_info2.mixed_content_status); |
| 128 EXPECT_EQ(SecurityStateModel::SECURITY_ERROR, security_info2.security_level); | 128 EXPECT_EQ(SecurityStateModel::SECURITY_ERROR, security_info2.security_level); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // Tests that SHA1 warnings don't interfere with the handling of major | 131 // Tests that SHA1 warnings don't interfere with the handling of major |
| 132 // cert errors. | 132 // cert errors. |
| 133 TEST(SecurityStateModelTest, SHA1WarningBrokenHTTPS) { | 133 TEST(SecurityStateModelTest, SHA1WarningBrokenHTTPS) { |
| 134 TestSecurityStateModelClient client; | 134 TestSecurityStateModelClient client; |
| 135 SecurityStateModel model; | 135 SecurityStateModel model; |
| 136 model.SetClient(&client); | 136 model.SetClient(&client); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 << net::SSL_CONNECTION_VERSION_SHIFT); | 186 << net::SSL_CONNECTION_VERSION_SHIFT); |
| 187 client.SetCipherSuite(ciphersuite); | 187 client.SetCipherSuite(ciphersuite); |
| 188 const SecurityStateModel::SecurityInfo& security_info = | 188 const SecurityStateModel::SecurityInfo& security_info = |
| 189 model.GetSecurityInfo(); | 189 model.GetSecurityInfo(); |
| 190 EXPECT_FALSE(security_info.is_secure_protocol_and_ciphersuite); | 190 EXPECT_FALSE(security_info.is_secure_protocol_and_ciphersuite); |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace | 193 } // namespace |
| 194 | 194 |
| 195 } // namespace security_state | 195 } // namespace security_state |
| OLD | NEW |