| 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 #if !defined(LEAK_SANITIZER) | 282 TEST_F(MultiThreadedCertVerifierTest, CancelRequestThenQuit) { |
| 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) { | |
| 289 base::FilePath certs_dir = GetTestCertsDirectory(); | 283 base::FilePath certs_dir = GetTestCertsDirectory(); |
| 290 scoped_refptr<X509Certificate> test_cert( | 284 scoped_refptr<X509Certificate> test_cert( |
| 291 ImportCertFromFile(certs_dir, "ok_cert.pem")); | 285 ImportCertFromFile(certs_dir, "ok_cert.pem")); |
| 292 ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert); | 286 ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert); |
| 293 | 287 |
| 294 int error; | 288 int error; |
| 295 CertVerifyResult verify_result; | 289 CertVerifyResult verify_result; |
| 296 TestCompletionCallback callback; | 290 TestCompletionCallback callback; |
| 297 CertVerifier::RequestHandle request_handle; | 291 CertVerifier::RequestHandle request_handle; |
| 298 | 292 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 Mock::VerifyAndClearExpectations(&trust_provider); | 470 Mock::VerifyAndClearExpectations(&trust_provider); |
| 477 ASSERT_EQ(ERR_IO_PENDING, error); | 471 ASSERT_EQ(ERR_IO_PENDING, error); |
| 478 EXPECT_TRUE(request_handle); | 472 EXPECT_TRUE(request_handle); |
| 479 error = callback.WaitForResult(); | 473 error = callback.WaitForResult(); |
| 480 EXPECT_EQ(ERR_CERT_COMMON_NAME_INVALID, error); | 474 EXPECT_EQ(ERR_CERT_COMMON_NAME_INVALID, error); |
| 481 ASSERT_EQ(3u, verifier_.requests()); | 475 ASSERT_EQ(3u, verifier_.requests()); |
| 482 ASSERT_EQ(1u, verifier_.cache_hits()); | 476 ASSERT_EQ(1u, verifier_.cache_hits()); |
| 483 } | 477 } |
| 484 | 478 |
| 485 } // namespace net | 479 } // namespace net |
| OLD | NEW |