OLD | NEW |
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 "net/cert/multi_threaded_cert_verifier.h" | 5 #include "net/cert/multi_threaded_cert_verifier.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 &request_handle, | 272 &request_handle, |
273 BoundNetLog()); | 273 BoundNetLog()); |
274 ASSERT_EQ(ERR_IO_PENDING, error); | 274 ASSERT_EQ(ERR_IO_PENDING, error); |
275 EXPECT_TRUE(request_handle); | 275 EXPECT_TRUE(request_handle); |
276 error = callback.WaitForResult(); | 276 error = callback.WaitForResult(); |
277 verifier_.ClearCache(); | 277 verifier_.ClearCache(); |
278 } | 278 } |
279 } | 279 } |
280 | 280 |
281 // Tests that a canceled request is not leaked. | 281 // Tests that a canceled request is not leaked. |
282 TEST_F(MultiThreadedCertVerifierTest, CancelRequestThenQuit) { | 282 #if !defined(LEAK_SANITIZER) |
| 283 #define MAYBE_CancelRequestThenQuit CancelRequestThenQuit |
| 284 #else |
| 285 // See PR303886. LeakSanitizer flags a leak here. |
| 286 #define MAYBE_CancelRequestThenQuit DISABLED_CancelRequestThenQuit |
| 287 #endif |
| 288 TEST_F(MultiThreadedCertVerifierTest, MAYBE_CancelRequestThenQuit) { |
283 base::FilePath certs_dir = GetTestCertsDirectory(); | 289 base::FilePath certs_dir = GetTestCertsDirectory(); |
284 scoped_refptr<X509Certificate> test_cert( | 290 scoped_refptr<X509Certificate> test_cert( |
285 ImportCertFromFile(certs_dir, "ok_cert.pem")); | 291 ImportCertFromFile(certs_dir, "ok_cert.pem")); |
286 ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert); | 292 ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert); |
287 | 293 |
288 int error; | 294 int error; |
289 CertVerifyResult verify_result; | 295 CertVerifyResult verify_result; |
290 TestCompletionCallback callback; | 296 TestCompletionCallback callback; |
291 CertVerifier::RequestHandle request_handle; | 297 CertVerifier::RequestHandle request_handle; |
292 | 298 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 Mock::VerifyAndClearExpectations(&trust_provider); | 476 Mock::VerifyAndClearExpectations(&trust_provider); |
471 ASSERT_EQ(ERR_IO_PENDING, error); | 477 ASSERT_EQ(ERR_IO_PENDING, error); |
472 EXPECT_TRUE(request_handle); | 478 EXPECT_TRUE(request_handle); |
473 error = callback.WaitForResult(); | 479 error = callback.WaitForResult(); |
474 EXPECT_EQ(ERR_CERT_COMMON_NAME_INVALID, error); | 480 EXPECT_EQ(ERR_CERT_COMMON_NAME_INVALID, error); |
475 ASSERT_EQ(3u, verifier_.requests()); | 481 ASSERT_EQ(3u, verifier_.requests()); |
476 ASSERT_EQ(1u, verifier_.cache_hits()); | 482 ASSERT_EQ(1u, verifier_.cache_hits()); |
477 } | 483 } |
478 | 484 |
479 } // namespace net | 485 } // namespace net |
OLD | NEW |