Index: net/quic/test_tools/crypto_test_utils_chromium.cc |
diff --git a/net/quic/test_tools/crypto_test_utils_chromium.cc b/net/quic/test_tools/crypto_test_utils_chromium.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..509101a1ecc91a78d2c5329635c504220ea59ca6 |
--- /dev/null |
+++ b/net/quic/test_tools/crypto_test_utils_chromium.cc |
@@ -0,0 +1,55 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "net/quic/test_tools/crypto_test_utils.h" |
+ |
+#include "base/files/file_path.h" |
+#include "base/logging.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "net/base/test_data_directory.h" |
+#include "net/cert/cert_verifier.h" |
+#include "net/cert/test_root_certs.h" |
+#include "net/cert/x509_certificate.h" |
+#include "net/quic/crypto/proof_verifier_chromium.h" |
+#include "net/test/cert_test_util.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace net { |
+ |
+namespace test { |
+ |
+class TestProofVerifierChromium : public ProofVerifierChromium { |
+ public: |
+ explicit TestProofVerifierChromium(CertVerifier* cert_verifier) |
+ : ProofVerifierChromium(cert_verifier), |
+ cert_verifier_(cert_verifier) { |
+ } |
+ virtual ~TestProofVerifierChromium() { } |
+ |
+ void InstallRootCertificate() { |
wtc
2013/06/24 22:36:56
This method should just be inlined in the construc
ramant (doing other things)
2013/06/28 19:16:56
Done.
|
+ // Load and install the root for the validated chain. |
+ root_cert_ = ImportCertFromFile(GetTestCertsDirectory(), |
+ "proof_verify.crt"); |
wtc
2013/06/24 22:36:56
The root certificate file name should ideally be p
ramant (doing other things)
2013/06/28 19:16:56
Done.
|
+ ASSERT_NE(static_cast<X509Certificate*>(NULL), root_cert_); |
+ scoped_root_.Reset(root_cert_.get()); |
+ } |
+ |
+ private: |
+ scoped_refptr<X509Certificate> root_cert_; |
wtc
2013/06/24 22:36:56
Remove the root_cert_ member. The scoped_root_ mem
ramant (doing other things)
2013/06/28 19:16:56
Done.
|
+ ScopedTestRoot scoped_root_; |
+ scoped_ptr<CertVerifier> cert_verifier_; |
+}; |
+ |
+// static |
+ProofVerifier* CryptoTestUtils::ProofVerifierForTesting() { |
+ TestProofVerifierChromium* proof_verifier = |
+ new TestProofVerifierChromium(CertVerifier::CreateDefault()); |
+ proof_verifier->InstallRootCertificate(); |
+ return proof_verifier; |
+} |
+ |
+} // namespace test |
+ |
+} // namespace net |