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> |
11 | 11 |
12 #include "base/mac/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
13 #include "crypto/rsa_private_key.h" | 13 #include "crypto/rsa_private_key.h" |
14 #include "net/cert/x509_cert_types.h" | 14 #include "net/cert/x509_cert_types.h" |
15 #include "net/cert/x509_certificate.h" | 15 #include "net/cert/x509_certificate.h" |
16 #include "net/cert/x509_util.h" | 16 #include "net/cert/x509_util.h" |
17 #include "net/ssl/ssl_info.h" | 17 #include "net/ssl/ssl_info.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "testing/gtest_mac.h" | 19 #import "testing/gtest_mac.h" |
20 #include "testing/platform_test.h" | 20 #include "testing/platform_test.h" |
21 | 21 |
22 namespace web { | 22 namespace web { |
23 namespace { | 23 namespace { |
24 // Subject for testing self-signed certificate. | 24 // Subject for testing self-signed certificate. |
25 const char kTestSubject[] = "self-signed"; | 25 const char kTestSubject[] = "self-signed"; |
26 // Hostname for testing SecTrustRef objects. | 26 // Hostname for testing SecTrustRef objects. |
27 NSString* const kTestHost = @"www.example.com"; | 27 NSString* const kTestHost = @"www.example.com"; |
28 | 28 |
29 // Returns an autoreleased certificate chain for testing. Chain will contain a | 29 // Returns an autoreleased certificate chain for testing. Chain will contain a |
(...skipping 246 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 |