| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/mock_crypto_client_stream.h" | 5 #include "net/quic/test_tools/mock_crypto_client_stream.h" |
| 6 | 6 |
| 7 #include "net/quic/crypto/quic_decrypter.h" | 7 #include "net/quic/crypto/quic_decrypter.h" |
| 8 #include "net/quic/quic_client_session_base.h" | 8 #include "net/quic/quic_client_session_base.h" |
| 9 #include "net/quic/quic_server_id.h" | 9 #include "net/quic/quic_server_id.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 | 81 |
| 82 void MockCryptoClientStream::SetConfigNegotiated() { | 82 void MockCryptoClientStream::SetConfigNegotiated() { |
| 83 ASSERT_FALSE(session()->config()->negotiated()); | 83 ASSERT_FALSE(session()->config()->negotiated()); |
| 84 QuicTagVector cgst; | 84 QuicTagVector cgst; |
| 85 // TODO(rtenneti): Enable the following code after BBR code is checked in. | 85 // TODO(rtenneti): Enable the following code after BBR code is checked in. |
| 86 #if 0 | 86 #if 0 |
| 87 cgst.push_back(kTBBR); | 87 cgst.push_back(kTBBR); |
| 88 #endif | 88 #endif |
| 89 cgst.push_back(kQBIC); | 89 cgst.push_back(kQBIC); |
| 90 session()->config()->SetCongestionFeedback(cgst, kQBIC); | 90 QuicConfig config; |
| 91 session()->config()->SetIdleConnectionStateLifetime( | 91 config.SetCongestionFeedback(cgst, kQBIC); |
| 92 config.SetIdleConnectionStateLifetime( |
| 92 QuicTime::Delta::FromSeconds(2 * kMaximumIdleTimeoutSecs), | 93 QuicTime::Delta::FromSeconds(2 * kMaximumIdleTimeoutSecs), |
| 93 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs)); | 94 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs)); |
| 94 session()->config()->SetMaxStreamsPerConnection( | 95 config.SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection / 2, |
| 95 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection); | 96 kDefaultMaxStreamsPerConnection / 2); |
| 97 config.SetBytesForConnectionIdToSend(PACKET_8BYTE_CONNECTION_ID); |
| 96 | 98 |
| 97 CryptoHandshakeMessage msg; | 99 CryptoHandshakeMessage msg; |
| 98 session()->config()->ToHandshakeMessage(&msg); | 100 config.ToHandshakeMessage(&msg); |
| 99 string error_details; | 101 string error_details; |
| 100 const QuicErrorCode error = | 102 const QuicErrorCode error = |
| 101 session()->config()->ProcessPeerHello(msg, CLIENT, &error_details); | 103 session()->config()->ProcessPeerHello(msg, CLIENT, &error_details); |
| 102 ASSERT_EQ(QUIC_NO_ERROR, error); | 104 ASSERT_EQ(QUIC_NO_ERROR, error); |
| 103 ASSERT_TRUE(session()->config()->negotiated()); | 105 ASSERT_TRUE(session()->config()->negotiated()); |
| 104 session()->OnConfigNegotiated(); | 106 session()->OnConfigNegotiated(); |
| 105 } | 107 } |
| 106 | 108 |
| 107 QuicClientSessionBase* MockCryptoClientStream::client_session() { | 109 QuicClientSessionBase* MockCryptoClientStream::client_session() { |
| 108 return reinterpret_cast<QuicClientSessionBase*>(session()); | 110 return reinterpret_cast<QuicClientSessionBase*>(session()); |
| 109 } | 111 } |
| 110 | 112 |
| 111 } // namespace net | 113 } // namespace net |
| OLD | NEW |