Chromium Code Reviews| 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 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 namespace net { | 8 namespace net { |
| 9 | 9 |
| 10 MockCryptoClientStream::MockCryptoClientStream( | 10 MockCryptoClientStream::MockCryptoClientStream( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 | 44 |
| 45 case COLD_START: { | 45 case COLD_START: { |
| 46 handshake_confirmed_ = false; | 46 handshake_confirmed_ = false; |
| 47 encryption_established_ = false; | 47 encryption_established_ = false; |
| 48 break; | 48 break; |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 | 53 |
| 54 void MockCryptoClientStream::SendOnCryptoHandshakeEvent( | |
| 55 QuicSession::CryptoHandshakeEvent event) { | |
|
ramant (doing other things)
2013/08/19 18:39:05
overly nit: consider adding a "DCHECK_NE(event, CO
Ryan Hamilton
2013/08/19 18:51:18
I like the idea, but COLD_START is one of the hans
| |
| 56 encryption_established_ = true; | |
| 57 if (event == QuicSession::HANDSHAKE_CONFIRMED) { | |
| 58 handshake_confirmed_ = true; | |
| 59 SetConfigNegotiated(); | |
| 60 } | |
| 61 session()->OnCryptoHandshakeEvent(event); | |
| 62 } | |
| 63 | |
| 54 void MockCryptoClientStream::SetConfigNegotiated() { | 64 void MockCryptoClientStream::SetConfigNegotiated() { |
| 55 ASSERT_FALSE(session()->config()->negotiated()); | 65 ASSERT_FALSE(session()->config()->negotiated()); |
| 56 QuicTagVector cgst; | 66 QuicTagVector cgst; |
| 57 cgst.push_back(kINAR); | 67 cgst.push_back(kINAR); |
| 58 cgst.push_back(kQBIC); | 68 cgst.push_back(kQBIC); |
| 59 session()->config()->set_congestion_control(cgst, kQBIC); | 69 session()->config()->set_congestion_control(cgst, kQBIC); |
| 60 session()->config()->set_idle_connection_state_lifetime( | 70 session()->config()->set_idle_connection_state_lifetime( |
| 61 QuicTime::Delta::FromSeconds(2 * kDefaultTimeoutSecs), | 71 QuicTime::Delta::FromSeconds(2 * kDefaultTimeoutSecs), |
| 62 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs)); | 72 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs)); |
| 63 session()->config()->set_max_streams_per_connection( | 73 session()->config()->set_max_streams_per_connection( |
| 64 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection); | 74 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection); |
| 65 | 75 |
| 66 CryptoHandshakeMessage msg; | 76 CryptoHandshakeMessage msg; |
| 67 session()->config()->ToHandshakeMessage(&msg); | 77 session()->config()->ToHandshakeMessage(&msg); |
| 68 string error_details; | 78 string error_details; |
| 69 const QuicErrorCode error = | 79 const QuicErrorCode error = |
| 70 session()->config()->ProcessClientHello(msg, &error_details); | 80 session()->config()->ProcessClientHello(msg, &error_details); |
| 71 ASSERT_EQ(QUIC_NO_ERROR, error); | 81 ASSERT_EQ(QUIC_NO_ERROR, error); |
| 72 ASSERT_TRUE(session()->config()->negotiated()); | 82 ASSERT_TRUE(session()->config()->negotiated()); |
| 73 } | 83 } |
| 74 | 84 |
| 75 } // namespace net | 85 } // namespace net |
| OLD | NEW |