| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/tools/quic/quic_server_session.h" | 5 #include "net/tools/quic/quic_server_session.h" |
| 6 | 6 |
| 7 #include "net/quic/crypto/cached_network_parameters.h" | 7 #include "net/quic/crypto/cached_network_parameters.h" |
| 8 #include "net/quic/crypto/quic_crypto_server_config.h" | 8 #include "net/quic/crypto/quic_crypto_server_config.h" |
| 9 #include "net/quic/crypto/quic_random.h" | 9 #include "net/quic/crypto/quic_random.h" |
| 10 #include "net/quic/quic_connection.h" | 10 #include "net/quic/quic_connection.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 namespace net { | 43 namespace net { |
| 44 namespace tools { | 44 namespace tools { |
| 45 namespace test { | 45 namespace test { |
| 46 | 46 |
| 47 class QuicServerSessionPeer { | 47 class QuicServerSessionPeer { |
| 48 public: | 48 public: |
| 49 static QuicDataStream* GetIncomingDataStream( | 49 static QuicDataStream* GetIncomingDataStream( |
| 50 QuicServerSession* s, QuicStreamId id) { | 50 QuicServerSession* s, QuicStreamId id) { |
| 51 return s->GetIncomingDataStream(id); | 51 return s->GetIncomingDataStream(id); |
| 52 } | 52 } |
| 53 static QuicDataStream* GetDataStream(QuicServerSession* s, QuicStreamId id) { | |
| 54 return s->GetDataStream(id); | |
| 55 } | |
| 56 static void SetCryptoStream(QuicServerSession* s, | 53 static void SetCryptoStream(QuicServerSession* s, |
| 57 QuicCryptoServerStream* crypto_stream) { | 54 QuicCryptoServerStream* crypto_stream) { |
| 58 s->crypto_stream_.reset(crypto_stream); | 55 s->crypto_stream_.reset(crypto_stream); |
| 59 } | 56 } |
| 60 }; | 57 }; |
| 61 | 58 |
| 62 namespace { | 59 namespace { |
| 63 | 60 |
| 64 const size_t kMaxStreamsForTest = 10; | 61 const size_t kMaxStreamsForTest = 10; |
| 65 | 62 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 79 new StrictMock<MockConnection>(true, SupportedVersions(GetParam())); | 76 new StrictMock<MockConnection>(true, SupportedVersions(GetParam())); |
| 80 session_.reset(new QuicServerSession(config_, connection_, &owner_)); | 77 session_.reset(new QuicServerSession(config_, connection_, &owner_)); |
| 81 MockClock clock; | 78 MockClock clock; |
| 82 handshake_message_.reset(crypto_config_.AddDefaultConfig( | 79 handshake_message_.reset(crypto_config_.AddDefaultConfig( |
| 83 QuicRandom::GetInstance(), &clock, | 80 QuicRandom::GetInstance(), &clock, |
| 84 QuicCryptoServerConfig::ConfigOptions())); | 81 QuicCryptoServerConfig::ConfigOptions())); |
| 85 session_->InitializeSession(crypto_config_); | 82 session_->InitializeSession(crypto_config_); |
| 86 visitor_ = QuicConnectionPeer::GetVisitor(connection_); | 83 visitor_ = QuicConnectionPeer::GetVisitor(connection_); |
| 87 } | 84 } |
| 88 | 85 |
| 89 QuicVersion version() const { return connection_->version(); } | |
| 90 | |
| 91 StrictMock<MockQuicServerSessionVisitor> owner_; | 86 StrictMock<MockQuicServerSessionVisitor> owner_; |
| 92 StrictMock<MockConnection>* connection_; | 87 StrictMock<MockConnection>* connection_; |
| 93 QuicConfig config_; | 88 QuicConfig config_; |
| 94 QuicCryptoServerConfig crypto_config_; | 89 QuicCryptoServerConfig crypto_config_; |
| 95 scoped_ptr<QuicServerSession> session_; | 90 scoped_ptr<QuicServerSession> session_; |
| 96 scoped_ptr<CryptoHandshakeMessage> handshake_message_; | 91 scoped_ptr<CryptoHandshakeMessage> handshake_message_; |
| 97 QuicConnectionVisitorInterface* visitor_; | 92 QuicConnectionVisitorInterface* visitor_; |
| 98 }; | 93 }; |
| 99 | 94 |
| 100 // Compares CachedNetworkParameters. | 95 // Compares CachedNetworkParameters. |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 cached_network_params.set_serving_region(kTestServingRegion); | 417 cached_network_params.set_serving_region(kTestServingRegion); |
| 423 crypto_stream->set_previous_cached_network_params(cached_network_params); | 418 crypto_stream->set_previous_cached_network_params(cached_network_params); |
| 424 EXPECT_CALL(*connection_, ResumeConnectionState(_)).Times(1); | 419 EXPECT_CALL(*connection_, ResumeConnectionState(_)).Times(1); |
| 425 session_->OnConfigNegotiated(); | 420 session_->OnConfigNegotiated(); |
| 426 } | 421 } |
| 427 | 422 |
| 428 } // namespace | 423 } // namespace |
| 429 } // namespace test | 424 } // namespace test |
| 430 } // namespace tools | 425 } // namespace tools |
| 431 } // namespace net | 426 } // namespace net |
| OLD | NEW |