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

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

Issue 5973004: The CertVerifierJob destructor should delete canceled requests.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add a LOG(ERROR) message Created 10 years 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
« net/base/cert_verifier.cc ('K') | « net/base/cert_verifier.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/base/cert_verifier.h" 5 #include "net/base/cert_verifier.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "net/base/cert_test_util.h" 10 #include "net/base/cert_test_util.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 for (int i = 0; i < 5; ++i) { 250 for (int i = 0; i < 5; ++i) {
251 error = verifier.Verify(google_cert, "www2.example.com", 0, &verify_result, 251 error = verifier.Verify(google_cert, "www2.example.com", 0, &verify_result,
252 &callback, &request_handle); 252 &callback, &request_handle);
253 ASSERT_EQ(ERR_IO_PENDING, error); 253 ASSERT_EQ(ERR_IO_PENDING, error);
254 ASSERT_TRUE(request_handle != NULL); 254 ASSERT_TRUE(request_handle != NULL);
255 error = callback.WaitForResult(); 255 error = callback.WaitForResult();
256 verifier.ClearCache(); 256 verifier.ClearCache();
257 } 257 }
258 } 258 }
259 259
260 // Tests that a canceled request is not leaked.
261 TEST_F(CertVerifierTest, CancelRequestThenQuit) {
262 scoped_ptr<CertVerifier> verifier(new CertVerifier);
willchan no longer on Chromium 2011/01/04 21:33:54 Nit: Does this need to be heap allocated?
263
264 FilePath certs_dir = GetTestCertsDirectory();
265 scoped_refptr<X509Certificate> google_cert(
266 ImportCertFromFile(certs_dir, "google.single.der"));
267 ASSERT_NE(static_cast<X509Certificate*>(NULL), google_cert);
268
269 int error;
270 CertVerifyResult verify_result;
271 TestCompletionCallback callback;
272 CertVerifier::RequestHandle request_handle;
273
274 error = verifier->Verify(google_cert, "www.example.com", 0, &verify_result,
275 &callback, &request_handle);
276 ASSERT_EQ(ERR_IO_PENDING, error);
277 ASSERT_TRUE(request_handle != NULL);
278 verifier->CancelRequest(request_handle);
279 verifier.reset();
280 }
281
260 } // namespace net 282 } // namespace net
OLDNEW
« net/base/cert_verifier.cc ('K') | « net/base/cert_verifier.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698