Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Unified Diff: ios/web/web_state/wk_web_view_security_util_unittest.mm

Issue 2864133002: Convert iOS to use X509CertificateBytes. (Closed)
Patch Set: static_cast, more unittest Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/web_state/wk_web_view_security_util.mm ('k') | net/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/wk_web_view_security_util_unittest.mm
diff --git a/ios/web/web_state/wk_web_view_security_util_unittest.mm b/ios/web/web_state/wk_web_view_security_util_unittest.mm
index d2eb9c05fa2cd2207626604d35fb8ec121044b43..d7d77d36ad9c035ae5afc5391a08023548a41b0d 100644
--- a/ios/web/web_state/wk_web_view_security_util_unittest.mm
+++ b/ios/web/web_state/wk_web_view_security_util_unittest.mm
@@ -14,6 +14,7 @@
#include "net/cert/x509_cert_types.h"
#include "net/cert/x509_certificate.h"
#include "net/cert/x509_util.h"
+#include "net/cert/x509_util_ios.h"
#include "net/ssl/ssl_info.h"
#include "testing/gtest/include/gtest/gtest.h"
#import "testing/gtest_mac.h"
@@ -37,8 +38,10 @@ NSArray* MakeTestCertChain(const std::string& subject) {
&der_cert);
base::ScopedCFTypeRef<SecCertificateRef> cert(
- net::X509Certificate::CreateOSCertHandleFromBytes(der_cert.data(),
- der_cert.size()));
+ net::x509_util::CreateSecCertificateFromBytes(
+ reinterpret_cast<const uint8_t*>(der_cert.data()), der_cert.size()));
+ if (!cert)
+ return nullptr;
NSArray* result = @[ reinterpret_cast<id>(cert.get()) ];
return result;
}
@@ -68,6 +71,7 @@ typedef PlatformTest WKWebViewSecurityUtilTest;
TEST_F(WKWebViewSecurityUtilTest, CreationCertFromChain) {
scoped_refptr<net::X509Certificate> cert =
CreateCertFromChain(MakeTestCertChain(kTestSubject));
+ ASSERT_TRUE(cert);
EXPECT_TRUE(cert->subject().GetDisplayName() == kTestSubject);
}
@@ -103,6 +107,7 @@ TEST_F(WKWebViewSecurityUtilTest, CreationCertFromTrust) {
base::ScopedCFTypeRef<SecTrustRef> trust =
CreateTestTrust(MakeTestCertChain(kTestSubject));
scoped_refptr<net::X509Certificate> cert = CreateCertFromTrust(trust);
+ ASSERT_TRUE(cert);
EXPECT_TRUE(cert->subject().GetDisplayName() == kTestSubject);
}
« no previous file with comments | « ios/web/web_state/wk_web_view_security_util.mm ('k') | net/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698