| 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/quic/test_tools/crypto_test_utils.h" | 5 #include "net/quic/test_tools/crypto_test_utils.h" |
| 6 | 6 |
| 7 #include "net/quic/crypto/channel_id.h" | 7 #include "net/quic/crypto/channel_id.h" |
| 8 #include "net/quic/crypto/common_cert_set.h" | 8 #include "net/quic/crypto/common_cert_set.h" |
| 9 #include "net/quic/crypto/crypto_handshake.h" | 9 #include "net/quic/crypto/crypto_handshake.h" |
| 10 #include "net/quic/crypto/quic_crypto_server_config.h" | 10 #include "net/quic/crypto/quic_crypto_server_config.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 channel_id_source_async(false) { | 176 channel_id_source_async(false) { |
| 177 } | 177 } |
| 178 | 178 |
| 179 // static | 179 // static |
| 180 int CryptoTestUtils::HandshakeWithFakeServer( | 180 int CryptoTestUtils::HandshakeWithFakeServer( |
| 181 PacketSavingConnection* client_conn, | 181 PacketSavingConnection* client_conn, |
| 182 QuicCryptoClientStream* client) { | 182 QuicCryptoClientStream* client) { |
| 183 PacketSavingConnection* server_conn = | 183 PacketSavingConnection* server_conn = |
| 184 new PacketSavingConnection(true, client_conn->supported_versions()); | 184 new PacketSavingConnection(true, client_conn->supported_versions()); |
| 185 TestSession server_session(server_conn, DefaultQuicConfig()); | 185 TestSession server_session(server_conn, DefaultQuicConfig()); |
| 186 | 186 server_session.InitializeSession(); |
| 187 QuicCryptoServerConfig crypto_config(QuicCryptoServerConfig::TESTING, | 187 QuicCryptoServerConfig crypto_config(QuicCryptoServerConfig::TESTING, |
| 188 QuicRandom::GetInstance()); | 188 QuicRandom::GetInstance()); |
| 189 |
| 189 SetupCryptoServerConfigForTest( | 190 SetupCryptoServerConfigForTest( |
| 190 server_session.connection()->clock(), | 191 server_session.connection()->clock(), |
| 191 server_session.connection()->random_generator(), | 192 server_session.connection()->random_generator(), |
| 192 server_session.config(), &crypto_config); | 193 server_session.config(), &crypto_config); |
| 193 | 194 |
| 194 QuicCryptoServerStream server(crypto_config, &server_session); | 195 QuicCryptoServerStream server(crypto_config, &server_session); |
| 195 server_session.SetCryptoStream(&server); | 196 server_session.SetCryptoStream(&server); |
| 196 | 197 |
| 197 // The client's handshake must have been started already. | 198 // The client's handshake must have been started already. |
| 198 CHECK_NE(0u, client_conn->packets_.size()); | 199 CHECK_NE(0u, client_conn->packets_.size()); |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg)); | 592 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg)); |
| 592 scoped_ptr<CryptoHandshakeMessage> parsed( | 593 scoped_ptr<CryptoHandshakeMessage> parsed( |
| 593 CryptoFramer::ParseMessage(bytes->AsStringPiece())); | 594 CryptoFramer::ParseMessage(bytes->AsStringPiece())); |
| 594 CHECK(parsed.get()); | 595 CHECK(parsed.get()); |
| 595 | 596 |
| 596 return *parsed; | 597 return *parsed; |
| 597 } | 598 } |
| 598 | 599 |
| 599 } // namespace test | 600 } // namespace test |
| 600 } // namespace net | 601 } // namespace net |
| OLD | NEW |