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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 if (event == QuicSession::HANDSHAKE_CONFIRMED) { | 74 if (event == QuicSession::HANDSHAKE_CONFIRMED) { |
75 handshake_confirmed_ = true; | 75 handshake_confirmed_ = true; |
76 SetConfigNegotiated(); | 76 SetConfigNegotiated(); |
77 } | 77 } |
78 session()->OnCryptoHandshakeEvent(event); | 78 session()->OnCryptoHandshakeEvent(event); |
79 } | 79 } |
80 | 80 |
81 void MockCryptoClientStream::SetConfigNegotiated() { | 81 void MockCryptoClientStream::SetConfigNegotiated() { |
82 ASSERT_FALSE(session()->config()->negotiated()); | 82 ASSERT_FALSE(session()->config()->negotiated()); |
83 QuicTagVector cgst; | 83 QuicTagVector cgst; |
84 cgst.push_back(kINAR); | 84 cgst.push_back(kTSTP); |
85 cgst.push_back(kQBIC); | 85 cgst.push_back(kQBIC); |
86 session()->config()->set_congestion_feedback(cgst, kQBIC); | 86 session()->config()->set_congestion_feedback(cgst, kQBIC); |
87 session()->config()->set_idle_connection_state_lifetime( | 87 session()->config()->set_idle_connection_state_lifetime( |
88 QuicTime::Delta::FromSeconds(2 * kDefaultTimeoutSecs), | 88 QuicTime::Delta::FromSeconds(2 * kDefaultTimeoutSecs), |
89 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs)); | 89 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs)); |
90 session()->config()->set_max_streams_per_connection( | 90 session()->config()->set_max_streams_per_connection( |
91 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection); | 91 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection); |
92 | 92 |
93 CryptoHandshakeMessage msg; | 93 CryptoHandshakeMessage msg; |
94 session()->config()->ToHandshakeMessage(&msg); | 94 session()->config()->ToHandshakeMessage(&msg); |
95 string error_details; | 95 string error_details; |
96 const QuicErrorCode error = | 96 const QuicErrorCode error = |
97 session()->config()->ProcessPeerHello(msg, CLIENT, &error_details); | 97 session()->config()->ProcessPeerHello(msg, CLIENT, &error_details); |
98 ASSERT_EQ(QUIC_NO_ERROR, error); | 98 ASSERT_EQ(QUIC_NO_ERROR, error); |
99 ASSERT_TRUE(session()->config()->negotiated()); | 99 ASSERT_TRUE(session()->config()->negotiated()); |
100 } | 100 } |
101 | 101 |
102 QuicClientSessionBase* MockCryptoClientStream::client_session() { | 102 QuicClientSessionBase* MockCryptoClientStream::client_session() { |
103 return reinterpret_cast<QuicClientSessionBase*>(session()); | 103 return reinterpret_cast<QuicClientSessionBase*>(session()); |
104 } | 104 } |
105 | 105 |
106 } // namespace net | 106 } // namespace net |
OLD | NEW |