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

Side by Side Diff: net/ocsp/nss_ocsp_unittest.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "net/ocsp/nss_ocsp.h" 5 #include "net/ocsp/nss_ocsp.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 17 matching lines...) Expand all
28 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
29 29
30 namespace net { 30 namespace net {
31 31
32 namespace { 32 namespace {
33 33
34 // Matches the caIssuers hostname from the generated certificate. 34 // Matches the caIssuers hostname from the generated certificate.
35 const char kAiaHost[] = "aia-test.invalid"; 35 const char kAiaHost[] = "aia-test.invalid";
36 // Returning a single DER-encoded cert, so the mime-type must be 36 // Returning a single DER-encoded cert, so the mime-type must be
37 // application/pkix-cert per RFC 5280. 37 // application/pkix-cert per RFC 5280.
38 const char kAiaHeaders[] = "HTTP/1.1 200 OK\0" 38 const char kAiaHeaders[] =
39 "Content-type: application/pkix-cert\0" 39 "HTTP/1.1 200 OK\0"
40 "\0"; 40 "Content-type: application/pkix-cert\0"
41 "\0";
41 42
42 class AiaResponseHandler : public net::URLRequestJobFactory::ProtocolHandler { 43 class AiaResponseHandler : public net::URLRequestJobFactory::ProtocolHandler {
43 public: 44 public:
44 AiaResponseHandler(const std::string& headers, const std::string& cert_data) 45 AiaResponseHandler(const std::string& headers, const std::string& cert_data)
45 : headers_(headers), cert_data_(cert_data), request_count_(0) {} 46 : headers_(headers), cert_data_(cert_data), request_count_(0) {}
46 virtual ~AiaResponseHandler() {} 47 virtual ~AiaResponseHandler() {}
47 48
48 // net::URLRequestJobFactory::ProtocolHandler implementation: 49 // net::URLRequestJobFactory::ProtocolHandler implementation:
49 virtual net::URLRequestJob* MaybeCreateJob( 50 virtual net::URLRequestJob* MaybeCreateJob(
50 net::URLRequest* request, 51 net::URLRequest* request,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 EnsureNSSHttpIOInit(); 99 EnsureNSSHttpIOInit();
99 } 100 }
100 101
101 virtual void TearDown() { 102 virtual void TearDown() {
102 ShutdownNSSHttpIO(); 103 ShutdownNSSHttpIO();
103 104
104 if (handler_) 105 if (handler_)
105 URLRequestFilter::GetInstance()->RemoveHostnameHandler("http", kAiaHost); 106 URLRequestFilter::GetInstance()->RemoveHostnameHandler("http", kAiaHost);
106 } 107 }
107 108
108 CertVerifier* verifier() const { 109 CertVerifier* verifier() const { return verifier_.get(); }
109 return verifier_.get();
110 }
111 110
112 int request_count() const { 111 int request_count() const { return handler_->request_count(); }
113 return handler_->request_count();
114 }
115 112
116 protected: 113 protected:
117 const CertificateList empty_cert_list_; 114 const CertificateList empty_cert_list_;
118 115
119 private: 116 private:
120 TestURLRequestContext context_; 117 TestURLRequestContext context_;
121 AiaResponseHandler* handler_; 118 AiaResponseHandler* handler_;
122 scoped_refptr<CertVerifyProc> verify_proc_; 119 scoped_refptr<CertVerifyProc> verify_proc_;
123 scoped_ptr<CertVerifier> verifier_; 120 scoped_ptr<CertVerifier> verifier_;
124 }; 121 };
(...skipping 29 matching lines...) Expand all
154 151
155 error = test_callback.WaitForResult(); 152 error = test_callback.WaitForResult();
156 153
157 EXPECT_EQ(OK, error); 154 EXPECT_EQ(OK, error);
158 155
159 // Ensure that NSS made an AIA request for the missing intermediate. 156 // Ensure that NSS made an AIA request for the missing intermediate.
160 EXPECT_LT(0, request_count()); 157 EXPECT_LT(0, request_count());
161 } 158 }
162 159
163 } // namespace net 160 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698