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

Side by Side Diff: net/quic/test_tools/crypto_test_utils_test.cc

Issue 2848203002: Add a platform implementation of QuicTest and QuicTestWithParam (Closed)
Patch Set: net/quic/platform/impl/quic_test_impl.cc Created 3 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
OLDNEW
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/quic/test_tools/crypto_test_utils.h" 5 #include "net/quic/test_tools/crypto_test_utils.h"
6 6
7 #include "net/quic/core/crypto/crypto_server_config_protobuf.h" 7 #include "net/quic/core/crypto/crypto_server_config_protobuf.h"
8 #include "net/quic/core/quic_utils.h" 8 #include "net/quic/core/quic_utils.h"
9 #include "net/quic/platform/api/quic_test.h"
9 #include "net/quic/platform/api/quic_text_utils.h" 10 #include "net/quic/platform/api/quic_text_utils.h"
10 #include "net/quic/test_tools/mock_clock.h" 11 #include "net/quic/test_tools/mock_clock.h"
11 #include "net/test/gtest_util.h" 12 #include "net/test/gtest_util.h"
12 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14 13
15 using std::string; 14 using std::string;
16 15
17 namespace net { 16 namespace net {
18 namespace test { 17 namespace test {
19 18
20 class ShloVerifier { 19 class ShloVerifier {
21 public: 20 public:
22 ShloVerifier( 21 ShloVerifier(
23 QuicCryptoServerConfig* crypto_config, 22 QuicCryptoServerConfig* crypto_config,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 QuicSocketAddress client_addr_; 101 QuicSocketAddress client_addr_;
103 const QuicClock* clock_; 102 const QuicClock* clock_;
104 QuicReferenceCountedPointer<QuicSignedServerConfig> signed_config_; 103 QuicReferenceCountedPointer<QuicSignedServerConfig> signed_config_;
105 QuicCompressedCertsCache* compressed_certs_cache_; 104 QuicCompressedCertsCache* compressed_certs_cache_;
106 105
107 QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> params_; 106 QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> params_;
108 QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result> 107 QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result>
109 result_; 108 result_;
110 }; 109 };
111 110
111 class CryptoTestUtilsTest : public QuicTest {};
112
112 TEST(CryptoTestUtilsTest, TestGenerateFullCHLO) { 113 TEST(CryptoTestUtilsTest, TestGenerateFullCHLO) {
113 MockClock clock; 114 MockClock clock;
114 QuicCryptoServerConfig crypto_config( 115 QuicCryptoServerConfig crypto_config(
115 QuicCryptoServerConfig::TESTING, QuicRandom::GetInstance(), 116 QuicCryptoServerConfig::TESTING, QuicRandom::GetInstance(),
116 crypto_test_utils::ProofSourceForTesting()); 117 crypto_test_utils::ProofSourceForTesting());
117 QuicSocketAddress server_addr; 118 QuicSocketAddress server_addr;
118 QuicSocketAddress client_addr(QuicIpAddress::Loopback4(), 1); 119 QuicSocketAddress client_addr(QuicIpAddress::Loopback4(), 1);
119 QuicReferenceCountedPointer<QuicSignedServerConfig> signed_config( 120 QuicReferenceCountedPointer<QuicSignedServerConfig> signed_config(
120 new QuicSignedServerConfig); 121 new QuicSignedServerConfig);
121 QuicCompressedCertsCache compressed_certs_cache( 122 QuicCompressedCertsCache compressed_certs_cache(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // Verify that full_chlo can pass crypto_config's verification. 166 // Verify that full_chlo can pass crypto_config's verification.
166 ShloVerifier shlo_verifier(&crypto_config, server_addr, client_addr, &clock, 167 ShloVerifier shlo_verifier(&crypto_config, server_addr, client_addr, &clock,
167 signed_config, &compressed_certs_cache); 168 signed_config, &compressed_certs_cache);
168 crypto_config.ValidateClientHello( 169 crypto_config.ValidateClientHello(
169 full_chlo, client_addr.host(), server_addr, version, &clock, 170 full_chlo, client_addr.host(), server_addr, version, &clock,
170 signed_config, shlo_verifier.GetValidateClientHelloCallback()); 171 signed_config, shlo_verifier.GetValidateClientHelloCallback());
171 } 172 }
172 173
173 } // namespace test 174 } // namespace test
174 } // namespace net 175 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/crypto_test_utils.cc ('k') | net/quic/test_tools/quic_crypto_server_config_peer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698