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

Unified Diff: ios/web/net/crw_cert_verification_controller_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/net/crw_cert_verification_controller.mm ('k') | ios/web/net/crw_ssl_status_updater_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/net/crw_cert_verification_controller_unittest.mm
diff --git a/ios/web/net/crw_cert_verification_controller_unittest.mm b/ios/web/net/crw_cert_verification_controller_unittest.mm
index aac4d43d3e1d33465b1e094c5f98d14b6dfdabf4..5414b54be7a2878c0f3ddb52af3276f2aedb1824 100644
--- a/ios/web/net/crw_cert_verification_controller_unittest.mm
+++ b/ios/web/net/crw_cert_verification_controller_unittest.mm
@@ -12,6 +12,7 @@
#include "ios/web/public/web_thread.h"
#import "ios/web/web_state/wk_web_view_security_util.h"
#include "net/cert/x509_certificate.h"
+#include "net/cert/x509_util_ios_and_mac.h"
#include "net/test/cert_test_util.h"
#include "net/test/test_data_directory.h"
@@ -36,20 +37,15 @@ class CRWCertVerificationControllerTest : public web::WebTest {
net::ImportCertFromFile(net::GetTestCertsDirectory(), kCertFileName);
ASSERT_TRUE(cert_);
- NSArray* chain = GetChain(cert_);
- valid_trust_ = web::CreateServerTrustFromChain(chain, kHostName);
+ base::ScopedCFTypeRef<CFMutableArrayRef> chain(
+ net::x509_util::CreateSecCertificateArrayForX509Certificate(
+ cert_.get()));
+ ASSERT_TRUE(chain);
+ valid_trust_ = web::CreateServerTrustFromChain(
+ static_cast<NSArray*>(chain.get()), kHostName);
web::EnsureFutureTrustEvaluationSucceeds(valid_trust_.get());
- invalid_trust_ = web::CreateServerTrustFromChain(chain, kHostName);
- }
-
- // Returns NSArray of SecCertificateRef objects for the given |cert|.
- NSArray* GetChain(const scoped_refptr<net::X509Certificate>& cert) const {
- NSMutableArray* result = [NSMutableArray
- arrayWithObject:static_cast<id>(cert->os_cert_handle())];
- for (SecCertificateRef intermediate : cert->GetIntermediateCertificates()) {
- [result addObject:static_cast<id>(intermediate)];
- }
- return result;
+ invalid_trust_ = web::CreateServerTrustFromChain(
+ static_cast<NSArray*>(chain.get()), kHostName);
}
// Synchronously returns result of
« no previous file with comments | « ios/web/net/crw_cert_verification_controller.mm ('k') | ios/web/net/crw_ssl_status_updater_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698