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

Side by Side Diff: net/base/x509_certificate_unittest.cc

Issue 9447084: Refactor Pickle Read methods to use higher performance PickleIterator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jar feedback Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "base/sha1.h" 9 #include "base/sha1.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 scoped_refptr<X509Certificate> cert = X509Certificate::CreateFromHandle( 1036 scoped_refptr<X509Certificate> cert = X509Certificate::CreateFromHandle(
1037 google_cert_handle, intermediates); 1037 google_cert_handle, intermediates);
1038 ASSERT_NE(static_cast<X509Certificate*>(NULL), cert.get()); 1038 ASSERT_NE(static_cast<X509Certificate*>(NULL), cert.get());
1039 1039
1040 X509Certificate::FreeOSCertHandle(google_cert_handle); 1040 X509Certificate::FreeOSCertHandle(google_cert_handle);
1041 X509Certificate::FreeOSCertHandle(thawte_cert_handle); 1041 X509Certificate::FreeOSCertHandle(thawte_cert_handle);
1042 1042
1043 Pickle pickle; 1043 Pickle pickle;
1044 cert->Persist(&pickle); 1044 cert->Persist(&pickle);
1045 1045
1046 void* iter = NULL; 1046 PickleReader iter(pickle);
1047 scoped_refptr<X509Certificate> cert_from_pickle = 1047 scoped_refptr<X509Certificate> cert_from_pickle =
1048 X509Certificate::CreateFromPickle( 1048 X509Certificate::CreateFromPickle(
1049 pickle, &iter, X509Certificate::PICKLETYPE_CERTIFICATE_CHAIN); 1049 pickle, &iter, X509Certificate::PICKLETYPE_CERTIFICATE_CHAIN);
1050 ASSERT_NE(static_cast<X509Certificate*>(NULL), cert_from_pickle); 1050 ASSERT_NE(static_cast<X509Certificate*>(NULL), cert_from_pickle);
1051 EXPECT_TRUE(X509Certificate::IsSameOSCert( 1051 EXPECT_TRUE(X509Certificate::IsSameOSCert(
1052 cert->os_cert_handle(), cert_from_pickle->os_cert_handle())); 1052 cert->os_cert_handle(), cert_from_pickle->os_cert_handle()));
1053 const X509Certificate::OSCertHandles& cert_intermediates = 1053 const X509Certificate::OSCertHandles& cert_intermediates =
1054 cert->GetIntermediateCertificates(); 1054 cert->GetIntermediateCertificates();
1055 const X509Certificate::OSCertHandles& pickle_intermediates = 1055 const X509Certificate::OSCertHandles& pickle_intermediates =
1056 cert_from_pickle->GetIntermediateCertificates(); 1056 cert_from_pickle->GetIntermediateCertificates();
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 #define MAYBE_VerifyMixed DISABLED_VerifyMixed 2039 #define MAYBE_VerifyMixed DISABLED_VerifyMixed
2040 #else 2040 #else
2041 #define MAYBE_VerifyMixed VerifyMixed 2041 #define MAYBE_VerifyMixed VerifyMixed
2042 #endif 2042 #endif
2043 WRAPPED_INSTANTIATE_TEST_CASE_P( 2043 WRAPPED_INSTANTIATE_TEST_CASE_P(
2044 MAYBE_VerifyMixed, 2044 MAYBE_VerifyMixed,
2045 X509CertificateWeakDigestTest, 2045 X509CertificateWeakDigestTest,
2046 testing::ValuesIn(kVerifyMixedTestData)); 2046 testing::ValuesIn(kVerifyMixedTestData));
2047 2047
2048 } // namespace net 2048 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698