| 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 #import "ios/web/web_state/wk_web_view_security_util.h" | 5 #import "ios/web/web_state/wk_web_view_security_util.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 #include <Security/Security.h> | 8 #include <Security/Security.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 TEST_F(WKWebViewSecurityUtilTest, CreationCertFromEmptyChain) { | 80 TEST_F(WKWebViewSecurityUtilTest, CreationCertFromEmptyChain) { |
| 81 EXPECT_FALSE(CreateCertFromChain(@[])); | 81 EXPECT_FALSE(CreateCertFromChain(@[])); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Tests MakeTrustValid with self-signed cert. | 84 // Tests MakeTrustValid with self-signed cert. |
| 85 TEST_F(WKWebViewSecurityUtilTest, MakingTrustValid) { | 85 TEST_F(WKWebViewSecurityUtilTest, MakingTrustValid) { |
| 86 // Create invalid trust object. | 86 // Create invalid trust object. |
| 87 base::ScopedCFTypeRef<SecTrustRef> trust = | 87 base::ScopedCFTypeRef<SecTrustRef> trust = |
| 88 CreateTestTrust(MakeTestCertChain(kTestSubject)); | 88 CreateTestTrust(MakeTestCertChain(kTestSubject)); |
| 89 | 89 |
| 90 SecTrustResultType result = -1; | 90 SecTrustResultType result = kSecTrustResultInvalid; |
| 91 SecTrustEvaluate(trust, &result); | 91 SecTrustEvaluate(trust, &result); |
| 92 EXPECT_EQ(kSecTrustResultRecoverableTrustFailure, result); | 92 EXPECT_EQ(kSecTrustResultRecoverableTrustFailure, result); |
| 93 | 93 |
| 94 // Make sure that trust becomes valid after | 94 // Make sure that trust becomes valid after |
| 95 // |EnsureFutureTrustEvaluationSucceeds| call. | 95 // |EnsureFutureTrustEvaluationSucceeds| call. |
| 96 EnsureFutureTrustEvaluationSucceeds(trust); | 96 EnsureFutureTrustEvaluationSucceeds(trust); |
| 97 SecTrustEvaluate(trust, &result); | 97 SecTrustEvaluate(trust, &result); |
| 98 EXPECT_EQ(kSecTrustResultProceed, result); | 98 EXPECT_EQ(kSecTrustResultProceed, result); |
| 99 } | 99 } |
| 100 | 100 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 GetSecurityStyleFromTrustResult(kSecTrustResultUnspecified)); | 276 GetSecurityStyleFromTrustResult(kSecTrustResultUnspecified)); |
| 277 } | 277 } |
| 278 | 278 |
| 279 // Tests GetSecurityStyleFromTrustResult with invalid SecTrustResultType result. | 279 // Tests GetSecurityStyleFromTrustResult with invalid SecTrustResultType result. |
| 280 TEST_F(WKWebViewSecurityUtilTest, GetSecurityStyleFromInvalidResult) { | 280 TEST_F(WKWebViewSecurityUtilTest, GetSecurityStyleFromInvalidResult) { |
| 281 EXPECT_EQ(SECURITY_STYLE_UNKNOWN, | 281 EXPECT_EQ(SECURITY_STYLE_UNKNOWN, |
| 282 GetSecurityStyleFromTrustResult(kSecTrustResultInvalid)); | 282 GetSecurityStyleFromTrustResult(kSecTrustResultInvalid)); |
| 283 } | 283 } |
| 284 | 284 |
| 285 } // namespace web | 285 } // namespace web |
| OLD | NEW |